/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700;800&display=swap');

:root {
    --primary: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #a855f7; /* Purple */
    --success: #10b981;
    --danger: #ef4444;
    --dark: #0f172a;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(255, 255, 255, 0.4);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 16px -8px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 40px -15px rgba(0,0,0,0.1);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
        --card-bg: rgba(30, 41, 59, 0.75);
        --card-border: rgba(255, 255, 255, 0.08);
        --text-main: #f8fafc;
        --text-muted: #94a3b8;
        --gray-50: #0f172a;
        --gray-100: #1e293b;
        --gray-200: #334155;
        --gray-300: #475569;
        --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.3), 0 8px 16px -8px rgba(0,0,0,0.3);
        --shadow-lg: 0 20px 40px -15px rgba(0,0,0,0.4);
    }
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* Main Container (1080px desktop constraint) */
.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px 0;
}

/* Header Styles */
.site-header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

@media (prefers-color-scheme: dark) {
    .site-header {
        background: rgba(15, 23, 42, 0.7);
    }
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

.logo svg {
    width: 32px;
    height: 32px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-link {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-main);
    position: relative;
    padding: 8px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* LINE Login Button */
.btn-line-login {
    background: linear-gradient(135deg, #06c755 0%, #05b04b 100%);
    color: #ffffff !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.2);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-line-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(6, 199, 85, 0.35);
    background: linear-gradient(135deg, #05b04b 0%, #04963f 100%);
}

.btn-line-login svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* User Profile in Header */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding: 6px 12px;
    border-radius: 30px;
    background: var(--gray-100);
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--gray-200);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

.btn-logout:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

/* Footer Styles */
.site-footer {
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    padding: 48px 0 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-info h3 {
    color: var(--text-main);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.footer-info p {
    max-width: 380px;
    margin-bottom: 16px;
}

.footer-links h4 {
    color: var(--text-main);
    margin-bottom: 16px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 4px;
}

.footer-bottom {
    border-top: 1px solid var(--gray-200);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 4px;
}

.mobile-nav-toggle svg {
    width: 28px;
    height: 28px;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    padding: 32px;
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.2);
}

/* Button Base */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--gray-300);
    transform: translateY(-2px);
}

/* Hero Section (Welcome) */
.hero-section {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 48px;
    align-items: center;
    margin-bottom: 64px;
}

.hero-text h1 {
    font-size: 2.75rem;
    line-height: 1.2;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.hero-image {
    width: 100%;
    max-height: 400px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--card-border);
    position: relative;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Features Grid */
.features-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 64px;
}

.feature-card {
    text-align: center;
}

.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.feature-card h3 {
    margin-bottom: 12px;
    font-size: 1.25rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* CTA Area */
.cta-area {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
    border-radius: 30px;
    border: 1px solid var(--card-border);
    margin-bottom: 48px;
}

.cta-area h2 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.cta-area p {
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 32px;
}

/* Member Area CSS */
.member-profile {
    display: flex;
    align-items: center;
    gap: 32px;
    margin-bottom: 40px;
}

.member-avatar-large {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 4px solid var(--primary-light);
    box-shadow: var(--shadow-md);
    object-fit: cover;
}

.member-details h2 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.member-meta {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.member-badge {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* History Section */
.history-section h3 {
    margin-bottom: 24px;
    font-size: 1.4rem;
    border-left: 4px solid var(--primary);
    padding-left: 12px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.history-item {
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 24px;
    background: rgba(255,255,255,0.3);
    transition: var(--transition);
}

@media (prefers-color-scheme: dark) {
    .history-item {
        border-color: var(--gray-700);
        background: rgba(30,41,59,0.3);
    }
}

.history-item:hover {
    border-color: var(--primary-light);
    background: var(--card-bg);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

@media (prefers-color-scheme: dark) {
    .history-header {
        border-color: var(--gray-700);
    }
}

.history-title {
    font-size: 1.1rem;
    color: var(--primary);
}

.history-time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-answers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.answer-group {
    font-size: 0.9rem;
}

.answer-label {
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.answer-value {
    color: var(--text-main);
}

.empty-state {
    text-align: center;
    padding: 48px;
    border: 2px dashed var(--gray-300);
    border-radius: 16px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Modal Styles for Mock Login */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    width: 90%;
    max-width: 450px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-title {
    font-size: 1.4rem;
    margin-bottom: 12px;
    text-align: center;
    color: var(--primary);
}

.modal-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 24px;
}

.mock-users-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.mock-user-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 14px;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: var(--transition);
    color: var(--text-main);
}

@media (prefers-color-scheme: dark) {
    .mock-user-btn {
        border-color: var(--gray-700);
    }
}

.mock-user-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.mock-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.mock-user-info {
    flex: 1;
}

.mock-user-name {
    font-weight: 600;
    font-size: 1rem;
}

.mock-user-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-close {
    width: 100%;
    padding: 10px;
    background: var(--gray-100);
    border: none;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--text-main);
}

/* Loading Spinner Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gray-50);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: var(--transition);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .hero-section {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 32px;
    }
    
    .hero-text h1 {
        font-size: 2.25rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .history-answers {
        grid-template-columns: 1fr;
    }
    
    .nav-menu {
        display: none; /* Hide desktop menu */
        position: absolute;
        top: 72px;
        left: 0;
        width: 100%;
        background: var(--card-bg);
        border-bottom: 1px solid var(--card-border);
        flex-direction: column;
        padding: 24px;
        gap: 16px;
        backdrop-filter: blur(12px);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .mobile-nav-toggle {
        display: block;
    }
    
    .member-profile {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .member-meta {
        justify-content: center;
    }
}

/* ==========================================
   AICC 官網圖片網格與影片特殊排版樣式
   ========================================== */
:root {
    --vw: 1080;
    --ratio: calc(var(--vw) / 1080);
}

.image-gallery {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-item {
    width: 100%;
    max-width: 1080px;
    position: relative;
    margin: 0 auto;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

.gallery-item video {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* 單張圖片樣式 */
.gallery-item.single img {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
}

.sp-layout-2-5 {
    background-color: rgb(242, 242, 242);
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding-top: calc(150px * var(--ratio));
    height: calc(1080px * var(--ratio));
}

.sp-layout-2-5 .side-images-container {
    display: flex;
    justify-content: center;
    gap: calc(40px * var(--ratio));
    width: 100%;
    margin: 0 auto;
}

.sp-layout-2-5 .side-image,
.sp-layout-2-5 .side-video {
    width: calc(420px * var(--ratio));
}

.sp-layout-2-5 .side-image img,
.sp-layout-2-5 .side-video video {
    width: 100%;
    height: auto;
    display: block;
}

.sp-layout-4-2 {
    background-color: rgb(242, 242, 242);
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: calc(40px * var(--ratio)) 0;
}

.sp-layout-4-2 .side-images-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    margin-bottom: calc(55px * var(--ratio));
    gap: 20px;
}

.sp-layout-4-2 .side-video,
.sp-layout-4-2 .side-image {
    width: 50%;
}

.sp-layout-4-2 .side-video video,
.sp-layout-4-2 .side-image img {
    width: 100%;
    height: auto;
    display: block;
}

.sp-layout-4-3 {
    background-image: url("https://d2r2oxip99zbzl.cloudfront.net/aicc/production/home/AICC-4/AICC活軟骨4-3.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    max-width: 1080px;
    height: calc(2270px * var(--ratio));
    margin: 0 auto;
    padding-top: calc(350px * var(--ratio));
}

.sp-layout-4-3 .side-images-container {
    display: flex;
    flex-direction: column;
    gap: calc(55px * var(--ratio));
    width: 100%;
    margin: 0 auto;
}

.sp-layout-4-3 .full-video {
    width: calc(860px * var(--ratio));
    margin: 0 auto;
    margin-bottom: calc(55px * var(--ratio));
}

.sp-layout-4-6 {
    background-image: url("https://d2r2oxip99zbzl.cloudfront.net/aicc/production/home/AICC-4/AICC活軟骨4-6.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    max-width: 1080px;
    height: calc(1080px * var(--ratio));
    padding-top: calc(320px * var(--ratio));
    margin: 0 auto;
}

.sp-layout-4-6 .line-qrcode {
    width: calc(290px * var(--ratio));
    height: auto;
    object-fit: cover;
    margin: 0 auto;
}

.sp-layout-4-6 .line-qrcode-img {
    width: 100%;
    height: auto;
    display: block;
}

/* 針對寬度小於 1080px（如手機版）的響應式覆蓋，以確保不會跑版 */
@media (max-width: 1080px) {
    :root {
        --vw: 100vw;
    }
    
    .sp-layout-2-5 {
        height: auto;
        padding: 40px 16px;
    }
    
    .sp-layout-2-5 .side-images-container {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .sp-layout-2-5 .side-image,
    .sp-layout-2-5 .side-video {
        width: 100%;
        max-width: 500px;
    }
    
    .sp-layout-4-2 .side-images-container {
        width: 100%;
        padding: 0 16px;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .sp-layout-4-2 .side-video,
    .sp-layout-4-2 .side-image {
        width: 100%;
        max-width: 500px;
    }
    
    .sp-layout-4-3 {
        height: auto;
        padding: 80px 16px;
    }
    
    .sp-layout-4-3 .full-video {
        width: 100%;
        max-width: 600px;
        margin-bottom: 24px;
    }
    
    .sp-layout-4-6 {
        height: auto;
        aspect-ratio: 1;
        padding-top: 30%;
    }
    
    .sp-layout-4-6 .line-qrcode {
        width: 25%;
    }
}
