/* ============================================
   БІЛІМ АЙНАСЫ — Main Stylesheet
   Palette: logo colors — black, blue, red, green, gold
   ============================================ */

:root {
    --primary:       #1a9fd4;
    --primary-dark:  #1480ab;
    --primary-light: #e1f4fc;
    --accent:        #f5a623;
    --accent-dark:   #d4880a;
    --accent-light:  #fef3cd;
    --success:       #43a047;
    --success-light: #e8f5e9;
    --warning:       #f5a623;
    --warning-light: #fef3cd;
    --danger:        #e53935;
    --danger-dark:   #c62828;
    --danger-light:  #ffebee;
    --nav-bg:        #0d1117;
    --nav-border:    #1e2530;
    --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;
    --white:    #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
    --shadow:    0 2px 8px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.10);
    --shadow-lg: 0 10px 32px rgba(0,0,0,.12);
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: .2s ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── Layout ──────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.site-main { flex: 1; padding: 32px 0 60px; }

/* ── Header ──────────────────────────────────────────────── */
.site-header {
    background: var(--nav-bg);
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 0 var(--nav-border), 0 4px 16px rgba(0,0,0,.4);
    border-bottom: 2px solid var(--primary);
}
.header-inner {
    display: flex; align-items: center; gap: 16px;
    height: 72px;
}

/* Logo */
.site-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.logo-img-wrap {
    width: 48px; height: 48px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.logo-img-wrap img { width: 48px; height: 48px; object-fit: contain; }
.logo-text { display: flex; flex-direction: column; }
.logo-title { font-size: 18px; font-weight: 800; color: var(--white); line-height: 1.2; letter-spacing: -.3px; }
.logo-sub { font-size: 9.5px; color: var(--gray-400); line-height: 1.3; text-transform: uppercase; letter-spacing: .6px; max-width: 220px; }

/* Gold accent stripe on logo */
.logo-title span { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link {
    padding: 8px 14px; border-radius: var(--radius-sm);
    color: var(--gray-300); font-size: 14px; font-weight: 500;
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    background: rgba(26,159,212,.15);
    color: var(--primary);
}
.nav-admin { color: var(--accent) !important; }
.nav-admin:hover { background: rgba(245,166,35,.15) !important; color: var(--accent) !important; }

.nav-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 4px; margin-left: auto;
}
.nav-toggle span {
    display: block; width: 22px; height: 2px;
    background: var(--gray-300); border-radius: 2px; transition: var(--transition);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; cursor: pointer;
    border: 2px solid transparent; transition: var(--transition);
    text-decoration: none; line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }

.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }

.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

.btn-outline { background: transparent; color: var(--gray-300); border-color: rgba(255,255,255,.2); }
.btn-outline:hover { background: rgba(255,255,255,.08); color: white; border-color: rgba(255,255,255,.4); }

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #2e7d32; color: white; }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); color: white; }

.btn-ghost { background: transparent; color: var(--gray-600); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }

.btn-white { background: white; color: var(--primary); border-color: white; }
.btn-white:hover { background: var(--gray-100); color: var(--primary-dark); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow); overflow: hidden;
}
.card-body { padding: 24px; }
.card-header {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h2, .card-header h3 { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); background: var(--gray-50); }

/* ── Course Cards ─────────────────────────────────────────── */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}
.course-card {
    background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow); overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--gray-200);
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.course-card-img {
    width: 100%; height: 190px;
    background: linear-gradient(135deg, var(--nav-bg) 0%, #1a2940 100%);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 56px; flex-shrink: 0;
    position: relative; overflow: hidden;
}
.course-card-img img { width: 100%; height: 100%; object-fit: cover; }

/* decorative corner stripe */
.course-card-img::after {
    content: ''; position: absolute; top: 0; right: 0;
    width: 6px; height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--accent), var(--success), var(--danger));
}

.course-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.course-card-title { font-size: 15px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; line-height: 1.45; }
.course-card-desc { font-size: 13.5px; color: var(--gray-500); flex: 1; margin-bottom: 14px; line-height: 1.55; }
.course-card-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.course-card-meta span { font-size: 12px; color: var(--gray-500); display: flex; align-items: center; gap: 4px; }
.course-card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
    background: var(--nav-bg);
    position: relative; overflow: hidden;
    padding: 64px 0 56px;
    margin-bottom: 40px;
}
/* Colorful accent line at bottom of hero */
.hero::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(to right, var(--primary), var(--accent), var(--success), var(--danger), var(--primary));
}
/* Subtle geometric pattern background */
.hero::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 60% 80% at 85% 50%, rgba(26,159,212,.12) 0%, transparent 70%),
        radial-gradient(ellipse 40% 60% at 5% 80%, rgba(245,166,35,.08) 0%, transparent 60%);
    pointer-events: none;
}
.hero-content { max-width: 700px; position: relative; }
.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(26,159,212,.15); color: var(--primary);
    border: 1px solid rgba(26,159,212,.3);
    padding: 6px 14px; border-radius: 100px;
    font-size: 13px; font-weight: 600; margin-bottom: 20px;
}
.hero h1 {
    font-size: clamp(28px, 4vw, 46px); font-weight: 800; color: white;
    line-height: 1.2; margin-bottom: 16px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 16px; color: var(--gray-400); line-height: 1.7; margin-bottom: 28px; }
.hero-stats { display: flex; gap: 36px; margin-top: 36px; position: relative; }
.hero-stat { border-left: 3px solid var(--primary); padding-left: 14px; }
.hero-stat:nth-child(2) { border-color: var(--accent); }
.hero-stat:nth-child(3) { border-color: var(--success); }
.hero-stat-num { font-size: 30px; font-weight: 800; color: white; line-height: 1; }
.hero-stat-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ── Section ─────────────────────────────────────────────── */
.section-title {
    font-size: 22px; font-weight: 800; color: var(--gray-900);
    margin-bottom: 24px; display: flex; align-items: center; gap: 12px;
}
.section-title::after {
    content: ''; flex: 1; height: 2px;
    background: linear-gradient(to right, var(--primary-light), transparent);
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
    font-size: 14px; color: var(--gray-800); background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,159,212,.12);
}
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    padding: 14px 18px; border-radius: var(--radius-sm);
    font-size: 14px; margin-bottom: 20px;
    border-left: 4px solid;
}
.alert-success { background: var(--success-light); color: #2e7d32; border-color: var(--success); }
.alert-error   { background: var(--danger-light);  color: #c62828; border-color: var(--danger); }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.alert-warning { background: var(--warning-light); color: #b45309; border-color: var(--warning); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 100px;
    font-size: 12px; font-weight: 600;
}
.badge-blue   { background: var(--primary-light);  color: var(--primary-dark); }
.badge-green  { background: var(--success-light);  color: var(--success); }
.badge-yellow { background: var(--accent-light);   color: #92400e; }
.badge-gray   { background: var(--gray-100);        color: var(--gray-600); }
.badge-red    { background: var(--danger-light);    color: var(--danger); }
.badge-dark   { background: var(--gray-800);        color: var(--gray-200); }

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
    background: white; border-bottom: 1px solid var(--gray-200);
    padding: 28px 0; margin-bottom: 32px;
}
.page-header h1 { font-size: 26px; font-weight: 800; color: var(--gray-900); }
.page-header p { font-size: 15px; color: var(--gray-500); margin-top: 6px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-500); margin-bottom: 10px; }
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--gray-300); }

/* ── Access denied banner ────────────────────────────────── */
.access-denied-banner {
    background: linear-gradient(135deg, #1a1a2e, #0d1117);
    border: 1px solid var(--gray-700);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 32px; text-align: center; margin-bottom: 20px;
}
.access-denied-banner .icon { font-size: 48px; margin-bottom: 12px; }
.access-denied-banner h3 { font-size: 18px; font-weight: 700; color: white; margin-bottom: 8px; }
.access-denied-banner p { font-size: 14px; color: var(--gray-400); }

/* ── Course Detail ───────────────────────────────────────── */
.course-layout { display: grid; grid-template-columns: 1fr 360px; gap: 32px; align-items: start; }
.course-sidebar { position: sticky; top: 88px; }
.course-sidebar-card {
    background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); overflow: hidden;
    border: 1px solid var(--gray-200);
}
.course-sidebar-img {
    width: 100%; height: 200px;
    background: linear-gradient(135deg, var(--nav-bg), #1a2940);
    display: flex; align-items: center; justify-content: center;
    font-size: 64px; color: var(--accent);
    position: relative;
}
.course-sidebar-img::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(to right, var(--primary), var(--accent), var(--success), var(--danger));
}
.course-sidebar-img img { width: 100%; height: 100%; object-fit: cover; }
.course-sidebar-body { padding: 24px; }
.course-enroll-btn { width: 100%; margin-bottom: 16px; }
.course-features { list-style: none; }
.course-features li {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; font-size: 14px; color: var(--gray-600);
    border-bottom: 1px solid var(--gray-100);
}
.course-features li:last-child { border-bottom: none; }
.course-features li .feat-icon { color: var(--primary); font-size: 16px; flex-shrink: 0; }

.modules-list { list-style: none; }
.module-item { margin-bottom: 10px; }
.module-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    background: var(--gray-50); border-radius: var(--radius-sm);
    cursor: pointer; font-weight: 600; color: var(--gray-800);
    border: 1px solid var(--gray-200); transition: var(--transition);
}
.module-header:hover { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.module-header.open { background: var(--nav-bg); color: white; border-color: var(--nav-bg); }
.module-header.open .module-count { color: var(--accent); }
.module-lessons { display: none; border: 1px solid var(--gray-200); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); overflow: hidden; }
.module-lessons.open { display: block; }
.lesson-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 18px; border-bottom: 1px solid var(--gray-100);
    font-size: 14px; color: var(--gray-700); transition: var(--transition);
    text-decoration: none;
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: var(--primary-light); color: var(--primary-dark); }
.lesson-item.locked { color: var(--gray-400); cursor: not-allowed; }
.lesson-item.completed .lesson-icon { color: var(--success); }
.lesson-icon { font-size: 18px; flex-shrink: 0; color: var(--gray-400); }
.lesson-duration { margin-left: auto; font-size: 12px; color: var(--gray-400); flex-shrink: 0; }

/* ── Video Player ────────────────────────────────────────── */
.video-layout {
    display: grid; grid-template-columns: 1fr 320px; gap: 0;
    height: calc(100vh - 72px); /* 72px = header height */
    overflow: hidden;
}
.video-main { background: #000; display: flex; flex-direction: column; overflow-y: auto; }
.video-player-wrap { position: relative; background: #000; flex-shrink: 0; }
.video-player-wrap video { width: 100%; max-height: 65vh; display: block; background: #000; }
.video-info { background: white; padding: 24px; border-top: 3px solid var(--primary); flex: 1; }
.video-title { font-size: 20px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.video-desc { font-size: 14px; color: var(--gray-500); line-height: 1.6; }

.video-sidebar { background: var(--nav-bg); height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.video-sidebar-header {
    padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
    font-weight: 700; color: white; font-size: 13px; flex-shrink: 0;
    border-left: 3px solid var(--accent);
    display: flex; align-items: center; justify-content: space-between;
}
.video-sidebar-close {
    background: none; border: none; color: var(--gray-500); font-size: 18px; cursor: pointer;
    padding: 4px; display: none; /* shown on mobile via JS */
}
.video-sidebar-close:hover { color: white; }
.video-lesson-list { flex: 1; overflow-y: auto; }
.video-lesson-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.04);
    cursor: pointer; transition: var(--transition);
    text-decoration: none; min-height: 52px;
}
.video-lesson-item:hover { background: rgba(26,159,212,.1); }
.video-lesson-item.active { background: rgba(26,159,212,.2); border-left: 3px solid var(--primary); }
.video-lesson-item.completed .vli-icon { color: var(--success); }
.vli-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; color: var(--gray-500); }
.vli-info { flex: 1; min-width: 0; }
.vli-title { font-size: 13px; font-weight: 500; color: var(--gray-200); line-height: 1.4; margin-bottom: 4px; word-break: break-word; }
.vli-meta { font-size: 12px; color: var(--gray-500); }
.vli-module { font-size: 11px; color: var(--gray-600); padding: 10px 20px 4px; text-transform: uppercase; letter-spacing: .5px; }

/* Collapsible module headers in lesson sidebar */
.vli-module-header {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; cursor: pointer;
    background: rgba(255,255,255,.05); border-bottom: 1px solid rgba(255,255,255,.06);
    transition: background .15s;
}
.vli-module-header:hover { background: rgba(255,255,255,.1); }
.vli-module-header.open { background: rgba(26,159,212,.15); border-left: 3px solid var(--primary); }
.vli-module-arrow { font-size: 10px; color: var(--gray-500); flex-shrink: 0; width: 12px; text-align: center; }
.vli-module-title { flex: 1; font-size: 12px; font-weight: 600; color: var(--gray-300); text-transform: uppercase; letter-spacing: .4px; line-height: 1.3; }
.vli-module-progress { font-size: 11px; color: var(--gray-500); flex-shrink: 0; }
.vli-module-lessons { display: none; }
.vli-module-lessons.open { display: block; }

/* Mobile sidebar toggle button (inside video-info) */
.video-sidebar-btn {
    display: none; /* shown on mobile */
    align-items: center; gap: 8px;
    background: var(--nav-bg); color: var(--gray-300);
    border: none; padding: 10px 16px; font-size: 13px; font-weight: 600;
    cursor: pointer; width: 100%; border-top: 1px solid var(--gray-200);
}
.video-sidebar-btn:hover { background: #1a2940; color: white; }

/* ── Test ────────────────────────────────────────────────── */
.test-wrap { max-width: 760px; margin: 0 auto; }
.test-header { margin-bottom: 32px; }
.test-progress-bar { height: 6px; background: var(--gray-200); border-radius: 100px; margin-top: 12px; }
.test-progress-fill { height: 100%; background: linear-gradient(to right, var(--primary), var(--accent)); border-radius: 100px; transition: width .3s; }
.question-card { background: white; border-radius: var(--radius-lg); padding: 28px; margin-bottom: 24px; box-shadow: var(--shadow); border: 1px solid var(--gray-200); }
.question-num { font-size: 12px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.question-text { font-size: 17px; font-weight: 600; color: var(--gray-900); line-height: 1.5; margin-bottom: 20px; }
.answers-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.answer-option { display: block; }
.answer-option input { display: none; }
.answer-label {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px; border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm); cursor: pointer;
    font-size: 15px; color: var(--gray-700); transition: var(--transition);
}
.answer-label:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.answer-option input:checked + .answer-label {
    border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 600;
}
.answer-option.correct .answer-label { border-color: var(--success); background: var(--success-light); color: var(--success); }
.answer-option.wrong input:checked + .answer-label { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }
.answer-circle {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--gray-300); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.answer-option input:checked + .answer-label .answer-circle {
    background: var(--primary); border-color: var(--primary); color: white;
}

/* ── Result ──────────────────────────────────────────────── */
.result-card {
    max-width: 560px; margin: 0 auto;
    background: white; border-radius: var(--radius-xl);
    padding: 48px 40px; box-shadow: var(--shadow-lg); text-align: center;
    border-top: 4px solid var(--primary);
}
.result-icon { font-size: 72px; margin-bottom: 20px; line-height: 1; }
.result-score {
    font-size: 64px; font-weight: 800; margin-bottom: 4px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.result-label { font-size: 18px; color: var(--gray-500); margin-bottom: 24px; }
.result-stats { display: flex; gap: 24px; justify-content: center; margin-bottom: 32px; }
.result-stat { text-align: center; }
.result-stat-num { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.result-stat-label { font-size: 13px; color: var(--gray-500); }
.result-passed { color: var(--success); }
.result-failed { color: var(--danger); }

/* ── Certificate ─────────────────────────────────────────── */
.cert-wrap { max-width: 700px; margin: 0 auto; text-align: center; }
.cert-preview {
    background: white; border-radius: var(--radius-lg);
    padding: 40px; box-shadow: var(--shadow-lg); margin-bottom: 24px;
    border: 2px solid var(--gray-200);
}
.cert-preview img { max-width: 100%; border-radius: var(--radius-sm); }
.cert-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Profile ─────────────────────────────────────────────── */
.profile-layout { display: grid; grid-template-columns: 280px 1fr; gap: 32px; align-items: start; }
.profile-card {
    background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow); padding: 32px 24px; text-align: center;
    border-top: 4px solid var(--primary);
}
.profile-avatar {
    width: 96px; height: 96px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; font-weight: 700; color: white;
    margin: 0 auto 16px;
    box-shadow: 0 4px 16px rgba(26,159,212,.3);
}
.profile-name { font-size: 20px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.profile-role { font-size: 13px; color: var(--gray-500); margin-bottom: 20px; }
.profile-stats { display: flex; gap: 16px; justify-content: center; margin-bottom: 24px; }
.profile-stat { text-align: center; }
.profile-stat-num { font-size: 22px; font-weight: 700; color: var(--primary); }
.profile-stat-label { font-size: 12px; color: var(--gray-500); }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: var(--gray-50); }
th { padding: 12px 16px; text-align: left; font-weight: 700; color: var(--gray-600); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--gray-200); }
td { padding: 14px 16px; color: var(--gray-700); border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:hover td { background: var(--gray-50); }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); margin-bottom: 28px; }
.tab-btn {
    padding: 10px 18px; border: none; background: none; cursor: pointer;
    font-size: 14px; font-weight: 500; color: var(--gray-500);
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: var(--transition); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn:hover { color: var(--primary); background: var(--primary-light); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
    width: 36px; height: 36px; border-radius: 50%;
    border: 3px solid var(--gray-200); border-top-color: var(--primary);
    animation: spin .7s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--gray-600); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ── Auth divider ────────────────────────────────────────── */
.auth-divider {
    text-align: center; color: var(--gray-400); font-size: 13px;
    margin: 20px 0; position: relative;
}
.auth-divider::before, .auth-divider::after {
    content: ''; position: absolute; top: 50%;
    width: calc(50% - 28px); height: 1px; background: var(--gray-200);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

/* ── Test sticky submit bar ──────────────────────────────── */
.test-submit-bar {
    position: sticky; bottom: 0; z-index: 10;
    background: var(--gray-50); border-top: 1px solid var(--gray-200);
    padding: 14px 0;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
}

/* ── Login page ──────────────────────────────────────────── */
.auth-wrap {
    min-height: calc(100vh - 72px);
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
    background: var(--nav-bg);
    position: relative; overflow: hidden;
}
.auth-wrap::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 50% 60% at 80% 20%, rgba(26,159,212,.15), transparent),
        radial-gradient(ellipse 40% 50% at 10% 80%, rgba(245,166,35,.08), transparent);
    pointer-events: none;
}
.auth-card {
    background: white; border-radius: var(--radius-xl);
    padding: 40px; width: 100%; max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative; border-top: 4px solid var(--primary);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo img { width: 64px; height: 64px; object-fit: contain; margin: 0 auto 14px; }
.auth-logo h1 { font-size: 22px; font-weight: 800; color: var(--gray-900); }
.auth-logo p { font-size: 13px; color: var(--gray-500); }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
    background: var(--nav-bg);
    padding: 28px 0; margin-top: auto;
    border-top: 3px solid var(--nav-border);
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-logo { width: 36px; height: 36px; object-fit: contain; }
.footer-title { font-size: 15px; font-weight: 700; color: white; }
.footer-sub { font-size: 11px; color: var(--gray-500); }
.footer-copy { font-size: 13px; color: var(--gray-500); }

/* ── Utilities ───────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--gray-500); font-size: 13px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }

/* ── Global mobile/touch fixes ───────────────────────────── */
* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }

/* Prevent iOS auto-zoom on form focus (needs 16px) */
@media (max-width: 768px) {
    .form-control { font-size: 16px; }
    select.form-control { font-size: 16px; }
}

/* Minimum tap target size for touch devices */
@media (pointer: coarse) {
    .btn { min-height: 44px; }
    .nav-link { min-height: 44px; display: flex; align-items: center; }
    .answer-label { min-height: 52px; }
    .lesson-item { min-height: 48px; }
    .video-lesson-item { min-height: 52px; }
    .module-header { min-height: 52px; }
    .tab-btn { min-height: 44px; }
}

/* ── Responsive — Desktop (≤1024px) ─────────────────────── */
@media (max-width: 1024px) {
    .course-layout { grid-template-columns: 1fr 300px; gap: 24px; }
    .video-layout  { grid-template-columns: 1fr 280px; }
}

/* ── Responsive — Tablet landscape (≤900px) ─────────────── */
@media (max-width: 900px) {
    .course-layout  { grid-template-columns: 1fr; }
    .course-sidebar { position: static; }
    .video-layout   { grid-template-columns: 1fr; height: auto; overflow: visible; }
    .video-main     { overflow-y: visible; }
    .video-sidebar  {
        height: 380px; min-height: 260px;
        border-top: 2px solid var(--primary);
        position: relative;
    }
    .video-sidebar-btn  { display: flex; }
    .video-sidebar-close { display: block; }
    .profile-layout { grid-template-columns: 1fr; }
    .form-row       { grid-template-columns: 1fr; }
}

/* ── Responsive — Tablet portrait (≤768px) ──────────────── */
@media (max-width: 768px) {
    .container { padding: 0 16px; }
    .site-main  { padding: 24px 0 48px; }

    .hero { padding: 48px 0 40px; margin-bottom: 28px; }
    .hero p { font-size: 15px; }
    .hero-stats { gap: 24px; }

    .courses-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }

    .section-title { font-size: 20px; }

    /* Scrollable tabs on tablets */
    .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
    .tab-btn { white-space: nowrap; flex-shrink: 0; }

    .result-stats { gap: 16px; }
    .page-header { padding: 20px 0; margin-bottom: 24px; }
    .page-header h1 { font-size: 22px; }
}

/* ── Responsive — Mobile (≤640px) ───────────────────────── */
@media (max-width: 640px) {
    /* Navigation */
    .site-nav {
        display: none; position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(13,17,23,.97);
        flex-direction: column; align-items: center; justify-content: center;
        gap: 8px; z-index: 200;
        padding: 80px 24px 24px;
        backdrop-filter: blur(8px);
    }
    .site-nav.open { display: flex; }
    .site-nav .nav-link {
        font-size: 18px; padding: 12px 24px; width: 100%; text-align: center;
        border-radius: var(--radius); border: 1px solid rgba(255,255,255,.06);
    }
    .site-nav .btn { width: 100%; justify-content: center; font-size: 16px; padding: 14px; }

    .nav-toggle { display: flex; position: relative; z-index: 201; }
    .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
    .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
    .nav-toggle span { transition: transform .25s, opacity .2s; }

    .logo-sub { display: none; }

    /* Header */
    .header-inner { height: 64px; }
    .logo-img-wrap { width: 40px; height: 40px; }
    .logo-img-wrap img { width: 40px; height: 40px; }
    .logo-title { font-size: 16px; }

    /* Hero */
    .hero { padding: 36px 0 32px; }
    .hero-eyebrow { font-size: 12px; padding: 5px 12px; }
    .hero-stats { gap: 16px; flex-wrap: wrap; }
    .hero-stat-num { font-size: 26px; }

    /* Courses */
    .courses-grid { grid-template-columns: 1fr; gap: 16px; }
    .course-card-img { height: 160px; }

    /* Section */
    .section-title { font-size: 18px; }

    /* Buttons */
    .btn-lg { padding: 12px 24px; font-size: 15px; }

    /* Result */
    .result-card { padding: 32px 20px; margin: 0; }
    .result-score { font-size: 52px; }
    .result-icon { font-size: 56px; }
    .result-stats { gap: 12px; }

    /* Auth */
    .auth-card { padding: 28px 20px; border-radius: var(--radius-lg); }
    .auth-logo h1 { font-size: 20px; }

    /* Test */
    .question-card { padding: 20px 16px; }
    .question-text { font-size: 15px; }
    .answer-label { padding: 12px 14px; font-size: 14px; gap: 10px; }

    /* Page header */
    .page-header h1 { font-size: 20px; }
    .breadcrumb { font-size: 12px; }

    /* Certificate */
    .cert-actions { flex-direction: column; }
    .cert-actions .btn { width: 100%; justify-content: center; }
    .cert-preview { padding: 24px 16px; }

    /* Footer */
    .footer-inner { flex-direction: column; text-align: center; gap: 12px; }

    /* Access denied banner */
    .access-denied-banner { padding: 24px 16px; }
    .access-denied-banner .icon { font-size: 40px; }

    /* Video */
    .video-info { padding: 14px 16px; }
    .video-title { font-size: 16px; }
    .video-sidebar { height: 300px; }
    .video-player-wrap video { max-height: 55vw; }

    /* Test sticky bar */
    .test-submit-bar { flex-wrap: wrap; gap: 8px; }
    .test-submit-bar .btn-ghost { order: 2; }
    .test-submit-bar > div { order: 1; flex: 1; justify-content: flex-end; }

    /* Course features list */
    .course-sidebar-body { padding: 18px 16px; }
}

/* ── Responsive — Small phone (≤480px) ──────────────────── */
@media (max-width: 480px) {
    .hero h1 { font-size: 26px; }
    .hero p  { font-size: 14px; margin-bottom: 22px; }
    .hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; flex-wrap: unset; }
    .hero-stat {
        border-left: none; border-top: 3px solid var(--primary);
        padding-left: 0; padding-top: 8px; text-align: center;
    }
    .hero-stat:nth-child(2) { border-color: var(--accent); }
    .hero-stat:nth-child(3) { border-color: var(--success); }
    .hero-stat-num { font-size: 22px; }

    .result-stats { flex-direction: column; gap: 10px; }
    .result-stat-num { font-size: 24px; }

    .course-card-footer { flex-direction: column; align-items: stretch; gap: 10px; }
    .course-card-footer .btn { width: 100%; justify-content: center; }

    .profile-stats { gap: 12px; }
    .profile-stat-num { font-size: 20px; }
    .profile-avatar { width: 80px; height: 80px; font-size: 30px; }
    .profile-name { font-size: 18px; }
}

/* ── Responsive — iPhone SE / very small (≤375px) ───────── */
@media (max-width: 375px) {
    .container { padding: 0 12px; }
    .header-inner { height: 58px; }
    .logo-img-wrap { width: 36px; height: 36px; }
    .logo-img-wrap img { width: 36px; height: 36px; }
    .logo-title { font-size: 15px; }
    .hero h1 { font-size: 24px; }
    .btn { font-size: 13px; }
    .btn-sm { font-size: 12px; padding: 6px 12px; }
    .auth-card { padding: 24px 16px; }
}

/* ── iOS safe area (notch, home bar) ─────────────────────── */
@supports (padding: max(0px)) {
    .site-header {
        padding-left:  max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    .site-nav {
        padding-left:  max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }
    .site-footer {
        padding-bottom: max(28px, calc(16px + env(safe-area-inset-bottom)));
    }
}
