/* =====================================================================
   CyberShield Academy - stylesheet
   Dark "security operations" theme, RTL-first, no external deps.
   ===================================================================== */

:root {
    --bg:        #0a0e17;
    --bg-2:      #0f1524;
    --surface:   #131c2e;
    --surface-2: #1b2740;
    --border:    #263352;
    --text:      #e7eef7;
    --muted:     #93a2b8;
    --primary:   #00e0b8;
    --primary-d: #00b493;
    --accent:    #6c8cff;
    --danger:    #ff5c7c;
    --warn:      #ffcc66;
    --ok:        #43d17a;
    --radius:    14px;
    --shadow:    0 10px 30px -12px rgba(0, 0, 0, .6);
    --maxw:      1140px;
    --font:      'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    background: radial-gradient(1200px 600px at 90% -10%, rgba(108, 140, 255, .12), transparent 60%),
                radial-gradient(900px 500px at -10% 10%, rgba(0, 224, 184, .10), transparent 55%),
                var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.75;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: #fff; }

img { max-width: 100%; display: block; }

.container { max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }

.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 40px; }

.skip-link {
    position: absolute; right: -9999px; top: 0;
    background: var(--primary); color: #002; padding: 10px 16px; border-radius: 0 0 8px 8px;
}
.skip-link:focus { right: 20px; z-index: 1000; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
    font: inherit; font-weight: 700; cursor: pointer; transition: transform .12s, box-shadow .2s, background .2s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 16px; font-size: .9rem; }
.btn-lg { padding: 15px 32px; font-size: 1.05rem; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-d)); color: #04211c; }
.btn-primary:hover { box-shadow: 0 8px 26px -8px rgba(0, 224, 184, .6); color: #04211c; }
.btn-outline { border-color: var(--border); color: var(--text); background: transparent; }
.btn-outline:hover { border-color: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { color: #fff; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.inline-form { display: inline; }

/* ---------- Header / nav ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(10, 14, 23, .82); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: #fff; }
.brand-mark { font-size: 1.4rem; filter: drop-shadow(0 0 8px rgba(0, 224, 184, .5)); }
.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a { color: var(--muted); font-weight: 600; }
.main-nav a:hover { color: #fff; }
.main-nav .nav-admin { color: var(--accent); }
.nav-user { color: var(--muted); font-size: .9rem; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; width: 40px; height: 40px; }
.nav-toggle span { display: block; height: 2px; background: var(--text); margin: 6px auto; width: 24px; }

/* ---------- Alerts ---------- */
.alert {
    border-radius: 12px; padding: 14px 18px; margin: 18px 0; border: 1px solid var(--border);
    background: var(--surface); font-weight: 600;
}
.alert-error   { border-color: rgba(255, 92, 124, .5); background: rgba(255, 92, 124, .10); color: #ffd9e1; }
.alert-success { border-color: rgba(67, 209, 122, .5); background: rgba(67, 209, 122, .10); color: #d6ffe6; }
.alert-info    { border-color: rgba(108, 140, 255, .5); background: rgba(108, 140, 255, .10); color: #dfe6ff; }

/* ---------- Hero ---------- */
.hero { padding: 90px 0 70px; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 50px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.25; color: #fff; font-weight: 800; }
.hero h1 .grad {
    background: linear-gradient(120deg, var(--primary), var(--accent));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 1.15rem; color: var(--muted); margin-top: 18px; max-width: 46ch; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 30px; }
.hero-stats { display: flex; gap: 30px; margin-top: 40px; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 1.7rem; color: #fff; }
.hero-stats span { color: var(--muted); font-size: .9rem; }

.terminal {
    background: #0b1120; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; font-family: 'Consolas', ui-monospace, monospace;
}
.terminal-bar { display: flex; gap: 7px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: #0e1626; }
.terminal-bar i { width: 11px; height: 11px; border-radius: 50%; background: #33405c; display: block; }
.terminal-bar i:nth-child(1) { background: #ff5f57; }
.terminal-bar i:nth-child(2) { background: #febc2e; }
.terminal-bar i:nth-child(3) { background: #28c840; }
.terminal-body { padding: 18px; direction: ltr; text-align: left; font-size: .9rem; line-height: 1.9; color: #9fb3d1; }
.terminal-body .c-green { color: #43d17a; }
.terminal-body .c-cyan { color: var(--primary); }
.terminal-body .c-purple { color: var(--accent); }

/* ---------- Sections ---------- */
.section { padding: 70px 0; }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 44px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); color: #fff; font-weight: 800; }
.section-head p { color: var(--muted); margin-top: 12px; }
.eyebrow { color: var(--primary); font-weight: 700; letter-spacing: .08em; font-size: .8rem; text-transform: uppercase; }

/* ---------- Feature cards ---------- */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.feature {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 26px; transition: transform .18s, border-color .18s;
}
.feature:hover { transform: translateY(-4px); border-color: rgba(0, 224, 184, .45); }
.feature .ico {
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
    background: rgba(0, 224, 184, .12); color: var(--primary); font-size: 1.3rem; margin-bottom: 14px;
}
.feature h3 { color: #fff; font-size: 1.1rem; }
.feature p { color: var(--muted); margin-top: 8px; font-size: .95rem; }

/* ---------- Course cards ---------- */
.course-toolbar {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
    margin-bottom: 26px;
}
.course-toolbar form { display: flex; flex-wrap: wrap; gap: 10px; }
.course-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

.course-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column; transition: transform .18s, border-color .18s;
}
.course-card:hover { transform: translateY(-4px); border-color: rgba(0, 224, 184, .45); }
.course-thumb {
    aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--surface-2), #0c1322);
    display: grid; place-items: center; position: relative; overflow: hidden;
}
.course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-thumb .ph { font-size: 2.6rem; opacity: .35; }
.course-badge {
    position: absolute; top: 12px; inset-inline-start: 12px; background: rgba(10, 14, 23, .8);
    border: 1px solid var(--border); color: var(--primary); font-size: .72rem; font-weight: 700;
    padding: 4px 10px; border-radius: 999px;
}
.course-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.course-body h3 { color: #fff; font-size: 1.08rem; line-height: 1.5; }
.course-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: .82rem; }
.course-desc { color: var(--muted); font-size: .9rem; flex: 1; }
.course-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.price { font-weight: 800; color: #fff; font-size: 1.05rem; }
.price.free { color: var(--ok); }

.tag {
    display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
    border: 1px solid var(--border); color: var(--muted); font-size: .78rem;
    padding: 4px 10px; border-radius: 999px;
}

/* ---------- Forms ---------- */
.auth-wrap { max-width: 460px; margin: 60px auto; }
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 30px; box-shadow: var(--shadow);
}
.card-lg { padding: 38px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 7px; font-size: .92rem; }
.field .hint { color: var(--muted); font-size: .8rem; margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=search], select, textarea {
    width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text); padding: 12px 14px; font: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 224, 184, .15);
}
textarea { min-height: 120px; resize: vertical; }
.field-error { color: var(--danger); font-size: .82rem; margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.auth-alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: .92rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 640px; }
table.data th, table.data td { padding: 13px 16px; text-align: right; border-bottom: 1px solid var(--border); }
table.data th { background: var(--surface-2); color: var(--muted); font-weight: 700; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(255, 255, 255, .02); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.badge-ok { background: rgba(67, 209, 122, .15); color: var(--ok); }
.badge-pending { background: rgba(255, 204, 102, .15); color: var(--warn); }
.badge-off { background: rgba(147, 162, 184, .15); color: var(--muted); }
.badge-danger { background: rgba(255, 92, 124, .15); color: var(--danger); }

/* ---------- Course detail ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 36px; align-items: start; }
.detail-hero h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); color: #fff; }
.lesson-list { list-style: none; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lesson-list li { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.lesson-list li:last-child { border-bottom: 0; }
.lesson-list .lock { color: var(--muted); }
.lesson-list .open { color: var(--primary); }
.buy-box { position: sticky; top: 90px; }
.buy-box .price-big { font-size: 2rem; font-weight: 800; color: #fff; }

/* ---------- Admin ---------- */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-side { background: var(--bg-2); border-inline-start: 1px solid var(--border); padding: 24px 16px; }
.admin-side .brand { font-size: 1rem; margin-bottom: 24px; }
.admin-side nav { display: flex; flex-direction: column; gap: 4px; }
.admin-side nav a { color: var(--muted); padding: 11px 14px; border-radius: 10px; font-weight: 600; }
.admin-side nav a:hover { background: var(--surface); color: #fff; }
.admin-side nav a.active { background: rgba(0, 224, 184, .12); color: var(--primary); }
.admin-main { padding: 30px 34px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.admin-topbar h1 { font-size: 1.5rem; color: #fff; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 30px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat b { font-size: 1.8rem; color: #fff; display: block; }
.stat span { color: var(--muted); font-size: .85rem; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); font-weight: 600;
}
.pagination .current { background: var(--primary); color: #042; border-color: var(--primary); }

.checkbox-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.checkbox-row input { width: auto; }

hr.sep { border: 0; border-top: 1px solid var(--border); margin: 26px 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); margin-top: 80px; padding: 50px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; }
.footer-grid h4 { color: #fff; margin-bottom: 12px; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--muted); }
.brand-footer { margin-bottom: 12px; }
.footer-bottom { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; text-align: center; }

/* ---------- Protected video player ---------- */
.vplayer {
    position: relative; margin-top: 16px; border-radius: 12px; overflow: hidden;
    background: #000; aspect-ratio: 16 / 9; user-select: none;
}
.vplayer video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }

/* single email watermark, moved every frame by player.js, always on top */
.vplayer .vwm {
    position: absolute; left: 10%; top: 12%; z-index: 2147483000;
    pointer-events: none; user-select: none; white-space: nowrap; direction: ltr;
    font-family: Consolas, ui-monospace, monospace;
    font-size: clamp(13px, 1.9vw, 22px); font-weight: 700; letter-spacing: .04em;
    color: rgba(255, 255, 255, .34);
    text-shadow: 0 0 3px rgba(0,0,0,.6), 0 1px 2px rgba(0,0,0,.8);
    will-change: left, top;
}
.vplayer .vguard {
    position: absolute; inset: 0; z-index: 2147483001; background: #000;
    display: flex; align-items: center; justify-content: center; text-align: center;
    color: var(--muted); font-weight: 700; padding: 20px; cursor: pointer;
}
.vplayer .vguard[hidden] { display: none; }
.vplayer.is-guarded video { visibility: hidden; }
.vplayer .vfs {
    position: absolute; z-index: 2147483002; inset-inline-end: 10px; top: 10px;
    width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
    background: rgba(10,14,23,.6); color: #fff; cursor: pointer; font-size: 15px;
}
.vplayer .vfs:hover { border-color: var(--primary); }

/* fullscreen: blow the container up so the watermark still tracks the whole screen */
.vplayer:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
.vplayer:fullscreen video { width: 100%; height: 100%; }
.vplayer:-webkit-full-screen { width: 100vw; height: 100vh; border-radius: 0; }
.vplayer:-webkit-full-screen video { width: 100%; height: 100%; }
.vplayer:fullscreen .vwm { font-size: clamp(18px, 2.2vw, 34px); }

/* ---------- Chunked uploader ---------- */
.up-progress { height: 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 12px 0 6px; }
.up-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--primary-d)); transition: width .3s; }
.up-pct { font-size: .82rem; color: var(--muted); margin-bottom: 6px; direction: ltr; text-align: right; }
.up-msg { font-size: .85rem; margin: 6px 0; min-height: 1.2em; }
.up-msg.up-ok { color: var(--ok); }
.up-msg.up-err { color: var(--danger); }
.up-msg.up-warn { color: var(--warn); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .hero-grid, .detail-grid { grid-template-columns: 1fr; }
    .grid-3, .grid-4, .course-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .admin-shell { grid-template-columns: 1fr; }
    .admin-side { border: 0; border-bottom: 1px solid var(--border); }
    .admin-side nav { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 680px) {
    .nav-toggle { display: block; }
    .main-nav {
        position: absolute; inset-inline: 0; top: 68px; flex-direction: column; align-items: stretch;
        background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 16px 20px; gap: 12px;
        display: none;
    }
    .main-nav.open { display: flex; }
    .grid-3, .grid-4, .course-grid, .grid-2, .footer-grid, .form-row { grid-template-columns: 1fr; }
    .section { padding: 48px 0; }
}
