:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #e0edff;
    --secondary: #0ea5e9;
    --accent: #fbbf24;
    --danger: #ef4444;
    --dark: #0f172a;
    --light: #f9fafb;
    --white: #ffffff;
    --gray: #6b7280;
    --gray-soft: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background: radial-gradient(circle at top left, #dbeafe 0, #f9fafb 45%, #eef2ff 100%);
    color: var(--dark);
    line-height: 1.6;
}

/* APP SHELL */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


/* =========================================
   FIXED NAVBAR (DESKTOP)
   ========================================= */

.app-header {
    position: sticky;
    top: 0;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    z-index: 9999;
    height: 75px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
}

.logo-link { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; flex-shrink: 0; }
.logo-title { font-size: 1.4rem; font-weight: 800; color: #0f172a; }

/* Wrapper Desktop */
.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-grow: 1;
    margin-left: 2rem;
}

.top-nav ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.top-nav a { text-decoration: none !important; color: #475569; font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; }

/* Sembunyikan ikon tab bar di desktop */
.nav-icon { display: none; }

.nav-account-container { display: flex; align-items: center; gap: 1rem; }
.user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.u-name { font-size: 0.85rem; color: #0f172a; font-weight: 700; white-space: nowrap; }
.u-badge { font-size: 0.7rem; background: #f1f5f9; color: #64748b; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.nav-button-group { display: flex; gap: 0.5rem; }
.btn-danger { color: #ef4444 !important; border: 1px solid #fee2e2 !important; }


/* MAIN LAYOUT */
.app-main {
    flex: 1;
    max-width: 1120px;
    margin: 1.5rem auto 2.5rem;
    padding: 0 1rem;
}

.view-section {
    display: none;
    animation: fadeIn 0.35s ease-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* HERO SECTION */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2.3fr);
    gap: 2rem;
    padding: 2.5rem;
    border-radius: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.08);
    margin-bottom: 2.5rem;
}

.hero-text h1 { font-size: clamp(1.9rem, 3vw, 2.4rem); margin: 0.5rem 0 0.75rem; color: var(--dark); }
.hero-text p { margin: 0 0 1.25rem; color: #1f2933; max-width: 32rem; }
.hero-badge { display: inline-flex; align-items: center; gap: 0.4rem; background: rgba(15, 23, 42, 0.9); color: var(--white); padding: 0.25rem 0.8rem; border-radius: 999px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.8rem; color: #1e293b; }
.hero-meta span { padding: 0.25rem 0.65rem; border-radius: 999px; background: rgba(15, 23, 42, 0.05); }

/* Hero side card */
.hero-panel { display: flex; align-items: stretch; }
.hero-card { background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.15); color: var(--white); border-radius: 16px; padding: 1.5rem; position: relative; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3); }

/* SECTIONS TITLES */
.section-title { font-size: 1.4rem; margin-bottom: 0.2rem; color: var(--dark); }
.section-subtitle { margin-top: 0; margin-bottom: 1.4rem; color: #4b5563; max-width: 40rem; font-size: 0.93rem; }
.section-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }

/* CHIPS & TAGS */
.chip { display: inline-flex; align-items: center; padding: 0.2rem 0.75rem; border-radius: 999px; font-size: 0.8rem; background: rgba(15, 23, 42, 0.04); color: #111827; }
.chip-soft { background: rgba(191, 219, 254, 0.7); color: #1d4ed8; }
.tag { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: 999px; background: #e5e7eb; font-size: 0.8rem; color: #374151; }

/* BUTTONS */
a, .btn, .link-button { text-decoration: none !important; }
.btn { border: none; border-radius: 999px; padding: 0.55rem 1.3rem; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: background 0.2s, transform 0.1s, box-shadow 0.15s; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }
.btn-primary { background: var(--primary); color: var(--white); box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-ghost { background: rgba(15, 23, 42, 0.02); color: #0f172a; border: 1px solid rgba(148, 163, 184, 0.6); }
.btn-ghost:hover { background: #f1f5f9; color: var(--primary-dark); }
.btn-full { width: 100%; }

/* CARDS & DASHBOARD GRID */
.card { background: rgba(255, 255, 255, 0.96); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 1.4rem 1.5rem; margin-bottom: 1.5rem; border: 1px solid rgba(226, 232, 240, 0.9); }
.card-compact { padding: 1rem 1.1rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-top: 1rem; }
.dashboard-card { background: #ffffff; border-radius: 16px; padding: 1.5rem; border: 1px solid rgba(226, 232, 240, 0.6); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02), 0 10px 15px rgba(0, 0, 0, 0.03); cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; gap: 0.5rem; }
.dashboard-card:hover { transform: translateY(-6px); box-shadow: 0 20px 25px -5px rgba(37, 99, 235, 0.1), 0 8px 10px -6px rgba(37, 99, 235, 0.1); border-color: transparent; border-bottom: 4px solid var(--primary); }
.card-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; background: var(--primary-soft); border-radius: 12px; font-size: 1.4rem; margin-bottom: 0.5rem; color: var(--primary); }

/* INPUTS */
textarea, input[type="text"], select { width: 100%; border-radius: var(--radius-sm); border: 1px solid #d1d5db; padding: 0.55rem 0.7rem; font-family: var(--font-main); font-size: 0.9rem; outline: none; transition: border 0.15s, box-shadow 0.15s; background: #f9fafb; }
textarea:focus, input[type="text"]:focus, select:focus { border-color: #2563eb; box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3); background: #ffffff; }
.field-label { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.4rem; display: block; }
.helper-text { font-size: 0.85rem; color: #6b7280; margin-top: 0.4rem; }

/* LAB SIMULASI LAYOUT */
.lab-layout { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.4rem; }
.lab-left, .lab-right { display: flex; flex-direction: column; gap: 1rem; }
.lab-container { display: flex; flex-direction: column; height: 480px; border-radius: var(--radius-md); overflow: hidden; background: var(--white); }

/* AVATAR BARU EMOJI (DYNAMIC) */
.lab-visual { flex: 0 0 auto; background: linear-gradient(90deg, #eff6ff, #e0f2fe); display: flex; justify-content: center; align-items: center; padding: 0.75rem; }
.lab-avatar-wrapper { text-align: center; display: flex; flex-direction: column; align-items: center; }
.avatar-patient { width: 80px; height: 80px; border-radius: 999px; background: linear-gradient(135deg, #3b82f6, #8b5cf6); border: 4px solid var(--white); box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2); margin: 0 auto; display: flex; justify-content: center; align-items: center; font-size: 2.5rem; color: white; transition: all 0.3s ease; }
.lab-avatar-wrapper h3 { margin: 0.6rem 0 0.25rem; font-size: 0.95rem; }

.voice-wave { margin-top: 0.25rem; display: flex; gap: 4px; align-items: flex-end; height: 20px; opacity: 0; transition: opacity 0.15s; }
.voice-wave.active { opacity: 1; }
.voice-wave .bar { width: 3px; border-radius: 999px; background: #2563eb; animation: wave 1s infinite ease-in-out; }
.voice-wave .bar:nth-child(2) { animation-delay: 0.1s; }
.voice-wave .bar:nth-child(3) { animation-delay: 0.2s; }
.voice-wave .bar:nth-child(4) { animation-delay: 0.3s; }
@keyframes wave { 0%, 100% { height: 6px; } 50% { height: 18px; } }

.lab-chat { flex: 1; padding: 0.85rem; overflow-y: auto; background: #f9fafb; display: flex; flex-direction: column; gap: 0.45rem; }
.message { max-width: 78%; padding: 0.45rem 0.7rem; border-radius: 999px; font-size: 0.9rem; clear: both; display: block; margin-bottom: 8px;}
.message.bot { align-self: flex-start; background: #e5edff; color: #1f2937; border-bottom-left-radius: 4px; }
.message.user { align-self: flex-end; background: #2563eb; color: white; border-bottom-right-radius: 4px; }
.lab-input { padding: 0.6rem; background: #f1f5f9; display: flex; gap: 0.5rem; border-top: 1px solid #e5e7eb; }

/* STUDIO TUGAS */
.studio-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 1.4rem; }
.bullet-list { padding-left: 1.1rem; margin: 0.5rem 0 0; font-size: 0.9rem; color: #4b5563; }
.bullet-list li+li { margin-top: 0.25rem; }


/* =========================================
   BOTTOM NAVIGATION (DISCORD / IG STYLE) - 100% RESPONSIVE
   ========================================= */

@media (max-width: 992px) {
    /* Mencegah footer tertutup oleh menu di bawah */
    .app-shell { padding-bottom: 80px; }

    /* Sembunyikan Nav Desktop */
    .nav-wrapper {
        margin-left: auto;
        display: flex;
        justify-content: flex-end;
    }
    
    .nav-account-container {
        margin: 0;
        padding: 0;
        border: none;
        flex-direction: row;
    }

    /* 1. JADIKAN MENU UTAMA SEBAGAI BOTTOM TAB BAR */
    .top-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
        z-index: 10000;
        padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom)); 
    }

    .top-nav ul {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        gap: 0;
        margin: 0;
        padding: 0;
        width: 100%;
    }

    .top-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 0.5rem;
        color: #94a3b8; /* Abu-abu redup saat tidak aktif */
        border-radius: 12px;
        transition: color 0.2s;
        width: 100%;
        text-align: center;
    }

    /* 2. MUNCULKAN IKON */
    .nav-icon { 
        display: block; 
        font-size: 1.4rem; 
        line-height: 1;
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-text {
        font-size: 0.65rem;
        font-weight: 700;
        letter-spacing: 0.02em;
    }

    /* 3. LOGIKA AKTIF (MENYALA SAAT DIKLIK) */
    .view-section#home.active ~ * .top-nav a[onclick*="'home'"],
    .view-section#modules.active ~ * .top-nav a[onclick*="'modules'"],
    .view-section#lab.active ~ * .top-nav a[onclick*="'lab'"],
    .view-section#studio.active ~ * .top-nav a[onclick*="'studio'"] {
        color: var(--primary); /* Menyala Biru */
    }
    
    .view-section#home.active ~ * .top-nav a[onclick*="'home'"] .nav-icon,
    .view-section#modules.active ~ * .top-nav a[onclick*="'modules'"] .nav-icon,
    .view-section#lab.active ~ * .top-nav a[onclick*="'lab'"] .nav-icon,
    .view-section#studio.active ~ * .top-nav a[onclick*="'studio'"] .nav-icon {
        transform: scale(1.15) translateY(-2px); /* Animasi icon melompat sedikit */
    }
    
    /* 4. PERBAIKAN LAYOUT GRID MOBILE */
    .hero { grid-template-columns: 1fr; padding: 1.5rem 1rem; text-align: center; }
    .hero-text h1 { font-size: 1.8rem; }
    .hero-actions { flex-direction: column; gap: 0.5rem; }
    .hero-actions .btn { width: 100%; }
    .hero-meta { justify-content: center; }
    
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-card { flex-direction: row; align-items: center; text-align: left; padding: 1.25rem; }
    .dashboard-card .card-icon { margin-bottom: 0; flex-shrink: 0; }

    .lab-layout, .studio-grid { grid-template-columns: 1fr; }
    .lab-container { height: auto; min-height: 500px; }
    .lab-chat { height: 350px; flex: none; }
}

/* =========================================
   MODERN LMS MODULE UI & SMOOTH ACCORDION
   ========================================= */
.module-list { display: flex; flex-direction: column; gap: 1.2rem; }

.module-item { 
    background: #ffffff; 
    border-radius: 16px; 
    border: 1px solid #e2e8f0; 
    overflow: hidden; 
    transition: all 0.3s ease; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.02); 
}

.module-item:hover { 
    border-color: #cbd5e1; 
    box-shadow: 0 10px 20px -5px rgba(37,99,235,0.08); 
}

.module-header { 
    padding: 1.25rem 1.5rem; 
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: transparent; 
    transition: background 0.2s; 
    user-select: none; 
}

.module-header:hover { background: #f8fafc; }

.module-header-left { display: flex; gap: 1.25rem; align-items: center; }

/* Ikon Angka Pertemuan yang Mewah */
.module-number { 
    width: 48px; 
    height: 48px; 
    background: linear-gradient(135deg, #eff6ff, #dbeafe); 
    color: #1e40af; 
    border-radius: 14px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    font-size: 1.25rem; 
    font-weight: 800; 
    flex-shrink: 0; 
    border: 1px solid #bfdbfe;
}

.module-title-area h3 { 
    margin: 0 0 0.3rem 0; 
    font-size: 1.2rem; 
    color: #0f172a; 
    font-weight: 750; 
    line-height: 1.3; 
}

.module-meta-info { 
    font-size: 0.85rem; 
    color: #64748b; 
    display: flex; 
    gap: 0.6rem; 
    align-items: center; 
    flex-wrap: wrap;
}

.meta-dot { 
    display: inline-block; 
    width: 4px; 
    height: 4px; 
    border-radius: 50%; 
    background: #cbd5e1; 
}

/* Animasi Panah Berputar */
.accordion-icon { 
    width: 36px; 
    height: 36px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-radius: 50%; 
    background: #f1f5f9; 
    color: #64748b; 
    font-size: 0.9rem;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s; 
}

.module-item.open .accordion-icon { 
    transform: rotate(180deg); 
    background: #e0e7ff; 
    color: #4338ca; 
}

/* =========================================
   RAHASIA DROPDOWN MULUS (CSS GRID)
   ========================================= */
.module-content-wrapper { 
    display: grid; 
    grid-template-rows: 0fr; 
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
}

.module-item.open .module-content-wrapper { 
    grid-template-rows: 1fr; 
}

.module-content-inner { overflow: hidden; }

.module-content-body { padding: 0 1.5rem 1.5rem 1.5rem; }

/* Desain Deskripsi Modul */
.module-desc { 
    font-size: 0.95rem; 
    color: #475569; 
    line-height: 1.6; 
    background: #f8fafc; 
    padding: 1.25rem; 
    border-radius: 12px; 
    border-left: 4px solid var(--primary); 
    margin-bottom: 1.5rem; 
    margin-top: 0.5rem; 
}

/* Resource Grid/Video Embed */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.resource-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; }
.resource-card:hover { transform: translateY(-3px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05); border-color: #cbd5e1; }
.resource-header { background: #f8fafc; padding: 0.75rem 1rem; font-size: 0.85rem; font-weight: 700; color: #334155; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; gap: 0.5rem; }

.embed-responsive { position: relative; width: 100%; overflow: hidden; background: #0f172a; }
.aspect-video { padding-bottom: 56.25%; }
.aspect-doc { padding-bottom: 70%; background: #f1f5f9; }
.embed-responsive iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

/* Penyesuaian Responsif HP */
@media (max-width: 640px) {
    .module-header { flex-direction: column; align-items: flex-start; gap: 1rem; position: relative; padding: 1.25rem; }
    .accordion-icon { position: absolute; right: 1.25rem; top: 1.25rem; }
    .module-header-left { align-items: flex-start; }
    .module-number { width: 40px; height: 40px; font-size: 1.1rem; }
    .module-title-area h3 { font-size: 1.1rem; padding-right: 2.5rem; }
    .module-content-body { padding: 0 1.25rem 1.25rem; }
}

/* =========================================
   LAIN-LAIN (ANIMASI, WIDGET, DLL)
   ========================================= */

.typing-indicator { display: flex; gap: 4px; padding: 0.6rem 1rem; background: #e5edff; border-radius: 999px; border-bottom-left-radius: 4px; width: fit-content; align-items: center; margin-bottom: 0.5rem; }
.typing-dot { width: 6px; height: 6px; background: #60a5fa; border-radius: 50%; animation: typingBounce 1.4s infinite ease-in-out both; }
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(0); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

.glass-feature-card { display: flex; flex-direction: column; justify-content: center; }
.card-badge { background: rgba(255, 255, 255, 0.15); color: #fbbf24; padding: 0.35rem 0.8rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; width: fit-content; margin-bottom: 1rem; border: 1px solid rgba(255, 255, 255, 0.2); }
.glass-title { font-size: 1.35rem; margin: 0 0 0.75rem 0; color: #ffffff; font-weight: 700; }
.glass-desc { font-size: 0.95rem; color: #f8fafc; font-style: italic; margin: 0 0 1.25rem 0; line-height: 1.6; background: rgba(0, 0, 0, 0.2); padding: 1rem; border-left: 4px solid #3b82f6; border-radius: 6px 12px 12px 6px; }
.glass-list { list-style: none; padding: 0; margin: 0 0 1.5rem 0; color: #e2e8f0; font-size: 0.9rem; }
.glass-list li { margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.6rem; }
.checklist-icon { display: inline-flex; align-items: center; justify-content: center; background: rgba(16, 185, 129, 0.2); color: #34d399; width: 20px; height: 20px; border-radius: 50%; font-size: 0.75rem; font-weight: bold; }