/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --black: #111111;
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e8e8e8;
    --gray-400: #aaaaaa;
    --gray-600: #666666;
    --gray-800: #333333;
    --radius: 6px;
    --shadow: 0 2px 12px rgba(0,0,0,.08);
    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset / Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--black); background: var(--white); line-height: 1.6; }
a { color: var(--black); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; }

/* ── Typography ────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5 { line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p { color: var(--gray-600); margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.text-muted { color: var(--gray-400); }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 1rem; }
.w-100 { width: 100%; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 11px 28px; border-radius: var(--radius); font-size: 15px;
    font-weight: 600; cursor: pointer; border: 2px solid transparent;
    transition: all .18s ease; text-decoration: none !important; gap: 8px;
    white-space: nowrap;
}
.btn-primary { background: var(--black); color: var(--white); border-color: var(--black); }
.btn-primary:hover { background: var(--gray-800); border-color: var(--gray-800); color: var(--white); }
.btn-outline { background: transparent; color: var(--black); border-color: var(--black); }
.btn-outline:hover { background: var(--black); color: var(--white); }
.btn-lg { padding: 14px 36px; font-size: 17px; }
.btn-sm { padding: 7px 18px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Form ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--gray-800); }
.form-control {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-200);
    border-radius: var(--radius); font-size: 15px; background: var(--white);
    transition: border-color .18s; color: var(--black);
}
.form-control:focus { outline: none; border-color: var(--black); }
.form-control::placeholder { color: var(--gray-400); }
.form-control:read-only { background: var(--gray-100); color: var(--gray-600); }
.form-error { font-size: 13px; color: #c00; margin-top: 5px; display: block; }
.form-hint { font-size: 13px; color: var(--gray-400); margin-top: 4px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 28px; }
.card-sm { padding: 16px 20px; }

/* ── Alerts / Toasts ───────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 1rem; border: 1px solid; }
.alert-success { background: #f0faf0; border-color: #a3d9a5; color: #1a6b1a; }
.alert-error   { background: #fff0f0; border-color: #f5b5b5; color: #b00; }
.alert-info    { background: var(--gray-100); border-color: var(--gray-200); color: var(--gray-800); }

/* ── Toast notification ────────────────────────────────────────────────────── */
#toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    padding: 14px 22px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
    max-width: 340px; box-shadow: 0 4px 20px rgba(0,0,0,.15); opacity: 0;
    transform: translateY(10px); transition: all .25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#toast.toast-success { background: var(--black); color: var(--white); }
#toast.toast-error   { background: #c00; color: var(--white); }

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: spin .6s linear infinite; }
.spinner-dark { border-color: rgba(0,0,0,.2); border-top-color: var(--black); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── NAVIGATION ────────────────────────────────────────────────────────────── */
.site-nav {
    position: sticky; top: 0; z-index: 100; background: var(--white);
    border-bottom: 1px solid var(--gray-200); padding: 0 20px;
}
.site-nav .nav-inner {
    max-width: 1160px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}
.nav-logo { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; color: var(--black); }
.nav-logo:hover { text-decoration: none; color: var(--black); }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { font-size: 15px; font-weight: 500; color: var(--gray-600); }
.nav-links a:hover { color: var(--black); text-decoration: none; }

/* ── HERO ──────────────────────────────────────────────────────────────────── */
.hero {
    background: var(--black); color: var(--white);
    padding: 80px 20px; text-align: center;
}
.hero h1 { color: var(--white); margin-bottom: 16px; }
.hero p { color: rgba(255,255,255,.7); font-size: 18px; max-width: 560px; margin: 0 auto 32px; }
.hero-price { font-size: 28px; font-weight: 800; color: var(--white); margin-bottom: 28px; }
.hero-price small { font-size: 14px; font-weight: 400; opacity: .7; display: block; margin-top: 4px; }

/* ── FEATURES / SECTIONS ───────────────────────────────────────────────────── */
.section { padding: 64px 20px; }
.section-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 40px; text-align: center; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; max-width: 1160px; margin: 0 auto; }
.feature-item { padding: 24px; border: 1px solid var(--gray-200); border-radius: var(--radius); }
.feature-item h4 { font-size: 16px; margin-bottom: 8px; }

/* ── FOOTER ────────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--black); color: rgba(255,255,255,.6);
    padding: 40px 20px; font-size: 14px; text-align: center;
}
.site-footer a { color: rgba(255,255,255,.7); margin: 0 10px; }
.site-footer a:hover { color: var(--white); text-decoration: none; }
.footer-links { margin-bottom: 16px; }

/* ── AUTH PAGES ────────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-50); padding: 20px; }
.auth-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: 10px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-card .auth-sub { color: var(--gray-400); font-size: 14px; margin-bottom: 28px; }
.auth-footer { text-align: center; font-size: 14px; color: var(--gray-600); margin-top: 20px; }
.otp-input { font-size: 26px; letter-spacing: 12px; text-align: center; font-weight: 700; }

/* ── CHECKOUT ──────────────────────────────────────────────────────────────── */
.checkout-layout { display: grid; grid-template-columns: 1fr 340px; gap: 32px; max-width: 900px; margin: 48px auto; padding: 0 20px; }
.checkout-summary { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 24px; position: sticky; top: 80px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 15px; }
.summary-row.total { font-weight: 700; font-size: 17px; border-top: 1px solid var(--gray-200); margin-top: 8px; padding-top: 16px; }
.summary-divider { height: 1px; background: var(--gray-200); margin: 12px 0; }

/* ── MY COURSES ────────────────────────────────────────────────────────────── */
.courses-page { max-width: 900px; margin: 48px auto; padding: 0 20px; }
.course-card { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.course-card-info h3 { font-size: 18px; margin-bottom: 4px; }
.course-card-info p { font-size: 14px; color: var(--gray-400); margin: 0; }
.empty-state { text-align: center; padding: 80px 20px; }
.empty-state h3 { font-size: 20px; margin-bottom: 8px; }
.empty-state p { color: var(--gray-400); margin-bottom: 24px; }

/* ── VIDEO PLAYER ──────────────────────────────────────────────────────────── */
.watch-page { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.video-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
.video-player-wrap video { width: 100%; border-radius: var(--radius); background: #000; display: block; }
.video-player-wrap h2 { font-size: 1.2rem; margin-top: 14px; }
.playlist { border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.playlist-header { background: var(--black); color: var(--white); padding: 12px 16px; font-weight: 600; font-size: 14px; }
.playlist-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--gray-200); font-size: 14px; transition: background .15s; }
.playlist-item:hover { background: var(--gray-50); }
.playlist-item.active { background: var(--gray-100); font-weight: 600; }
.playlist-item:last-child { border-bottom: none; }
.playlist-num { color: var(--gray-400); font-size: 12px; min-width: 20px; }

/* ── SUCCESS / FAILED ──────────────────────────────────────────────────────── */
.status-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; }
.status-icon { font-size: 64px; margin-bottom: 16px; }
.status-page h2 { font-size: 1.8rem; margin-bottom: 10px; }
.status-page p { color: var(--gray-600); max-width: 400px; margin: 0 auto 24px; }

/* ── ADMIN LAYOUT ──────────────────────────────────────────────────────────── */
.admin-wrap { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--black); color: var(--white); padding: 0; display: flex; flex-direction: column; }
.sidebar-brand { padding: 20px 24px; font-size: 16px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.1); letter-spacing: -.3px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px; padding: 11px 24px;
    font-size: 14px; color: rgba(255,255,255,.65); font-weight: 500;
    transition: all .15s; text-decoration: none !important;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.1); color: var(--white); }
.sidebar-nav a svg { opacity: .7; flex-shrink: 0; }
.sidebar-nav a.active svg, .sidebar-nav a:hover svg { opacity: 1; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,.1); }
.admin-main { background: var(--gray-50); }
.admin-topbar { background: var(--white); border-bottom: 1px solid var(--gray-200); padding: 0 32px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.admin-topbar h1 { font-size: 18px; font-weight: 700; }
.admin-content { padding: 32px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 24px; }
.stat-card .stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-400); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--black); }
.data-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--gray-200); }
.data-table thead { background: var(--black); color: var(--white); }
.data-table th { padding: 12px 16px; font-size: 12px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.data-table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-paid { background: #e6fae6; color: #1a6b1a; }
.badge-pending { background: #fff8e6; color: #8a5c00; }
.admin-login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--black); }
.admin-login-card { background: var(--white); border-radius: 10px; padding: 44px; width: 100%; max-width: 380px; }
.admin-login-card h2 { font-size: 1.4rem; margin-bottom: 4px; }
.admin-login-card p { font-size: 14px; color: var(--gray-400); margin-bottom: 28px; }

/* ── Policy Page ───────────────────────────────────────────────────────────── */
.policy-page { max-width: 760px; margin: 60px auto; padding: 0 20px 80px; }
.policy-page h1 { margin-bottom: 8px; }
.policy-page .updated { font-size: 13px; color: var(--gray-400); margin-bottom: 40px; }
.policy-page h2 { font-size: 1.15rem; margin: 32px 0 12px; }
.policy-page p, .policy-page li { color: var(--gray-600); font-size: 15px; line-height: 1.75; }
.policy-page ul { padding-left: 20px; margin-bottom: 1rem; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .checkout-layout { grid-template-columns: 1fr; }
    .checkout-summary { position: static; }
    .video-layout { grid-template-columns: 1fr; }
    .admin-wrap { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .course-card { flex-direction: column; align-items: flex-start; gap: 16px; }
}
