/* ==========================================
   1. CORE VARIABLES & MASTER THEME
   ========================================== */
:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
}

/* ==========================================
   2. GLOBAL RESET & BASE STYLES
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1250px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================
   3. PASSWORD OVERLAY
   ========================================== */
#password-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000;
    transition: opacity 0.4s ease;
}

.password-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    text-align: center;
    max-width: 420px;
    width: 90%;
}

.password-box h2 {
    margin-top: 0;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.password-box p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.password-box input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
}

.password-box input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.password-box button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    transition: background 0.2s;
}

.password-box button:hover {
    background: var(--primary-hover);
}

.error-msg {
    color: #ef4444;
    margin-top: 16px;
    font-weight: 600;
    font-size: 0.9rem;
    display: none;
    background: #fee2e2;
    padding: 10px;
    border-radius: 6px;
}

/* ==========================================
   4. HERO HEADER BANNER
   ========================================== */
header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 50px 20px;
    text-align: center;
    margin-bottom: -40px;
    padding-bottom: 80px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

header p {
    color: #dbeafe;
    font-size: 1.15rem;
    font-weight: 300;
}

main {
    position: relative;
    z-index: 10;
}

.welcome-box {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 35px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--secondary);
}

.welcome-box h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.welcome-box p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* ==========================================
   5. PORTAL GRID (INDEX PAGE)
   ========================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 50px;
}

.card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: var(--border-color);
    transition: background 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #bfdbfe;
}

.card:hover::before { background: var(--primary); }

.card h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 12px; }

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 24px;
    flex-grow: 1;
}

/* ==========================================
   6. SPLIT SIDEBAR WORKSPACE SYSTEM
   ========================================== */
.workspace {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    position: relative;
    z-index: 10;
}

nav {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 30px;
    height: fit-content;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

nav h2 {
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bg-color);
}

nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

nav li a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.925rem;
    padding: 10px 12px;
    border-radius: 6px;
    display: block;
    transition: all 0.2s ease;
}

nav li a:hover {
    background-color: var(--bg-color);
    color: var(--primary);
}

nav li a.active {
    background-color: #eff6ff;
    color: var(--primary);
    font-weight: 600;
    border-left: 4px solid var(--primary);
    border-radius: 0 6px 6px 0;
}

/* Sub-level item indenting for inside sections */
nav li.sub-item a {
    padding-left: 28px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

nav li.sub-item a.active {
    color: var(--primary);
    border-left: 4px solid var(--primary);
    background-color: #eff6ff;
}

/* ==========================================
   7. MAIN CONTENT SUB-PANEL
   ========================================== */
main.unit {
    background: var(--card-bg);
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    margin-bottom: 50px;
}

.unit h2 {
    color: var(--text-main);
    font-size: 1.5rem;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--bg-color);
}

/* ==========================================
   8. BUTTON CONTROLS & INNER NAVIGATION
   ========================================== */
.btn {
    display: inline-block;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card .btn {
    background: #eff6ff;
    color: var(--primary);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    align-self: flex-start;
}

.card:hover .btn {
    background: var(--primary);
    color: white;
}

.primary-btn { background: var(--primary); color: white; }
.primary-btn:hover { background: var(--primary-hover); }

.secondary-btn { background: #e5e7eb; color: var(--text-main); }
.secondary-btn:hover { background: #d1d5db; }

.finish-btn { background: var(--secondary); color: white; }
.finish-btn:hover { background: var(--secondary-hover); }

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 25px;
    margin-top: 35px;
}

/* ==========================================
   9. INTERACTIVE COMPONENTS (VIDEO & Q&A)
   ========================================== */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin-bottom: 35px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
}

.video-wrapper iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border: 0;
}

details {
    margin-bottom: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    transition: all 0.2s ease;
}

details:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

details[open] {
    border-color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.05);
}

summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
    user-select: none;
    font-size: 0.98rem;
    outline: none;
}

.ans {
    margin-top: 14px;
    color: #059669; /* Emerald Green */
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    font-weight: 500;
    font-size: 0.95rem;
}

/* ==========================================
   10. FOOTER & RESPONSIVE LAYOUT
   ========================================== */
footer {
    text-align: center;
    padding: 30px;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

@media (max-width: 992px) {
    .workspace { grid-template-columns: 1fr; gap: 25px; }
    nav { position: relative; top: 0; max-height: none; }
    header h1 { font-size: 2rem; }
    .nav-container { flex-direction: column; gap: 12px; }
    .nav-container .btn { width: 100%; text-align: center; }
}