/* :root MUST be set from the palette decision tree above. Example shown is the TECH/SAAS palette. Replace --bg/--surface/--primary/--accent with values matching your topic. */
:root {
    --bg: #09090f;
    --surface: #13131a;
    --surface2: #1a1a24;
    --surface3: #242430;
    --border: rgba(99, 102, 241, 0.12);
    --border-strong: rgba(99, 102, 241, 0.35);
    --text: #f8fafc;
    --text-bright: #fff;
    --muted: #64748b;
    --primary: #6366f1;
    --primary-rgb: 99, 102, 241;
    --accent: #a855f7;
    --accent-rgb: 168, 85, 247;
    --accent2: #c084fc;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(circle at 10% 0%, rgba(var(--primary-rgb), .06) 0%, transparent 50%), radial-gradient(circle at 90% 100%, rgba(var(--accent-rgb), .05) 0%, transparent 50%);
    background-attachment: fixed;
}
.layout { display: flex; min-height: 100vh; }
/* ═══ SIDEBAR — frosted glass with vibrant accents ═══ */
.sidebar {
    width: 264px;
    background: linear-gradient(180deg, rgba(var(--primary-rgb), .04) 0%, var(--surface) 30%);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    backdrop-filter: blur(20px);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 28px 24px 24px;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 22px;
    font-weight: 900;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}
.sidebar-logo svg { width: 28px; height: 28px; color: var(--primary); }
.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0 14px;
    gap: 4px;
    flex: 1;
}
.sidebar-section-title {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .18em;
    color: var(--muted);
    padding: 24px 14px 10px;
    opacity: .7;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    transition: all .2s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; transition: transform .2s, color .2s; }
.nav-item:hover { background: rgba(var(--primary-rgb), .08); color: var(--text-bright); }
.nav-item:hover svg { color: var(--primary); transform: scale(1.1); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(var(--primary-rgb), .18), rgba(var(--primary-rgb), .04));
    color: var(--text-bright);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--primary), 0 4px 20px rgba(var(--primary-rgb), .15);
}
.nav-item.active svg { color: var(--accent); }
.nav-item .badge-mini {
    margin-left: auto;
    background: var(--accent);
    color: #0a0a0a;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
}
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-footer .avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--accent); }
.sidebar-footer .user-info { flex: 1; min-width: 0; }
.sidebar-footer .user-name { font-size: 13px; font-weight: 700; color: var(--text-bright); }
.sidebar-footer .user-role { font-size: 11px; color: var(--muted); }
/* ═══ MAIN CONTENT ═══ */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px 40px;
    border-bottom: 1px solid var(--border);
    background: rgba(var(--primary-rgb), .02);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar .greeting { flex: 1; }
.topbar .greeting .eyebrow {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 4px;
    display: block;
}
.topbar .greeting h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-bright);
    margin: 0;
    letter-spacing: -0.02em;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.search-form {
    display: flex;
    align-items: center;
    background: rgba(var(--primary-rgb), .06);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 16px;
    gap: 10px;
    transition: .2s;
}
.search-form:focus-within { border-color: var(--primary); background: rgba(var(--primary-rgb), .1); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .1); }
.search-input {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    padding: 12px 0;
    width: 240px;
    font-family: inherit;
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(var(--primary-rgb), .06);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: .2s;
    position: relative;
}
.btn-icon:hover { background: rgba(var(--primary-rgb), .14); border-color: var(--primary); transform: translateY(-2px); }
.btn-icon .notif-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--surface), 0 0 12px var(--accent);
}
.btn-secondary {
    padding: 11px 22px;
    border-radius: 12px;
    background: rgba(var(--primary-rgb), .06);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
}
.btn-secondary:hover { background: rgba(var(--primary-rgb), .14); border-color: var(--primary); }
.btn-cta {
    padding: 12px 26px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #0a0a0a;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: .25s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3), 0 0 40px rgba(var(--accent-rgb), .2);
    letter-spacing: -0.01em;
}
.btn-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(0, 0, 0, .4), 0 0 60px rgba(var(--accent-rgb), .35); }
/* ═══ DASHBOARD HERO BANNER (replaces boring 'Mission Overview' centered title) ═══ */
.dash-hero {
    margin: 32px 40px 24px;
    padding: 40px 44px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), .18) 0%, rgba(var(--accent-rgb), .10) 100%), var(--surface);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}
.dash-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(var(--accent-rgb), .18) 0%, transparent 70%);
    pointer-events: none;
    border-radius: 50%;
}
.dash-hero-text { position: relative; z-index: 1; max-width: 560px; }
.dash-hero .eyebrow {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 13px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 12px;
    display: block;
}
.dash-hero h1 {
    font-size: clamp(28px, 3.5vw, 44px);
    font-weight: 900;
    line-height: 1.1;
    margin: 0 0 14px;
    color: var(--text-bright);
    letter-spacing: -0.02em;
}
.dash-hero h1 em {
    font-family: 'Fraunces', serif;
    font-style: italic;
    background: linear-gradient(135deg, var(--accent), #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
}
.dash-hero p { font-size: 15px; color: var(--muted); line-height: 1.6; margin: 0 0 24px; }
.dash-hero-actions { display: flex; gap: 12px; position: relative; z-index: 1; }
/* ═══ STAT CARDS — vibrant gradients, glow, sparklines, trend arrows ═══ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    padding: 8px 40px 32px;
}
.stat-card {
    position: relative;
    background: linear-gradient(135deg, var(--surface2) 0%, var(--surface) 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    overflow: hidden;
    transition: all .3s ease;
    cursor: pointer;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    opacity: .7;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), .10) 0%, transparent 70%);
    pointer-events: none;
}
.stat-card:hover { transform: translateY(-6px); border-color: var(--primary); box-shadow: 0 24px 60px rgba(0, 0, 0, .4), 0 0 80px rgba(var(--primary-rgb), .18); }
.stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; position: relative; z-index: 1; }
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), .20), rgba(var(--accent-rgb), .20));
    border: 1px solid rgba(var(--primary-rgb), .30);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), .18);
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    background: rgba(34, 197, 94, .15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, .3);
}
.stat-trend.down { background: rgba(239, 68, 68, .15); color: #f87171; border-color: rgba(239, 68, 68, .3); }
.stat-value {
    font-size: 42px;
    font-weight: 900;
    color: var(--text-bright);
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
    font-feature-settings: 'tnum';
    position: relative;
    z-index: 1;
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 18px; position: relative; z-index: 1; }
.stat-spark {
    height: 36px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    position: relative;
    z-index: 1;
}
.stat-spark .bar {
    flex: 1;
    background: linear-gradient(to top, rgba(var(--primary-rgb), .7), rgba(var(--accent-rgb), .4));
    border-radius: 2px 2px 0 0;
    min-height: 4px;
    transition: .3s;
}
.stat-card:hover .bar { background: linear-gradient(to top, var(--primary), var(--accent)); }
/* ═══ CONTENT CARDS & SECTIONS ═══ */
.section { padding: 8px 40px 32px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-bright);
    margin: 0;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--accent), var(--primary));
    border-radius: 2px;
}
.section-link {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: .2s;
}
.section-link:hover { gap: 10px; }
.card {
    background: linear-gradient(180deg, var(--surface2), var(--surface));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 20px;
    transition: all .3s;
    position: relative;
    overflow: hidden;
}
.card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 20px 50px rgba(0, 0, 0, .35), 0 0 60px rgba(var(--primary-rgb), .12); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
/* ═══ TABLES — premium dark with hover rows ═══ */
.table-wrap { background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: rgba(var(--primary-rgb), .05); border-bottom: 1px solid var(--border); }
.data-table th { padding: 18px 24px; text-align: left; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.data-table td { padding: 18px 24px; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.data-table tbody tr { transition: .2s; }
.data-table tbody tr:hover { background: rgba(var(--primary-rgb), .05); }
.data-table tbody tr:last-child td { border-bottom: none; }
/* ═══ BADGES, AVATARS, FORMS, MODALS, TOASTS, EMPTY STATE ═══ */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--border); }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.badge-success { background: rgba(34, 197, 94, .18); color: #4ade80; border: 1px solid rgba(34, 197, 94, .4); }
.badge-warning { background: rgba(251, 191, 36, .18); color: #fbbf24; border: 1px solid rgba(251, 191, 36, .4); }
.badge-danger { background: rgba(239, 68, 68, .18); color: #f87171; border: 1px solid rgba(239, 68, 68, .4); }
.badge-info { background: rgba(var(--primary-rgb), .18); color: var(--primary); border: 1px solid rgba(var(--primary-rgb), .4); }
.form-input {
    width: 100%;
    background: rgba(var(--primary-rgb), .05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: .2s;
}
.form-input:focus { border-color: var(--primary); background: rgba(var(--primary-rgb), .10); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .10); }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 20px;
    text-align: center;
    color: var(--muted);
    gap: 16px;
}
.empty-state svg { width: 64px; height: 64px; color: var(--primary); opacity: .4; }
.empty-state h3 { font-size: 20px; font-weight: 800; color: var(--text-bright); margin: 0; }
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn .25s;
}
.modal {
    background: linear-gradient(180deg, var(--surface2), var(--surface));
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    max-width: 560px;
    width: 90%;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .6), 0 0 80px rgba(var(--primary-rgb), .15);
}
#toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}
.toast {
    padding: 16px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transform: translateX(20px);
    transition: .3s;
    background: var(--surface2);
    border: 1px solid var(--border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .4), 0 0 60px rgba(var(--primary-rgb), .15);
}
.toast.show { opacity: 1; transform: none; }
.toast-success { background: rgba(34, 197, 94, .15); border-color: rgba(34, 197, 94, .4); color: #4ade80; }
.toast-error { background: rgba(239, 68, 68, .15); border-color: rgba(239, 68, 68, .4); color: #f87171; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .5s ease both; }
.fade-in-delay-1 { animation: fadeIn .5s ease .08s both; }
.fade-in-delay-2 { animation: fadeIn .5s ease .16s both; }
.fade-in-delay-3 { animation: fadeIn .5s ease .24s both; }
.hide-mobile { display: block; }
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .sidebar { position: fixed; left: -280px; top: 0; height: 100vh; width: 280px; z-index: 200; transition: left .3s ease; }
    .sidebar.open { left: 0; }
    .mobile-menu-btn { display: flex; }
    .topbar { padding: 16px 20px; }
    .dash-hero { margin: 20px; padding: 28px 24px; flex-direction: column; align-items: flex-start; }
    .stats-grid { padding: 8px 20px 24px; grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 20px; }
    .stat-value { font-size: 30px; }
    .section { padding: 8px 20px 24px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
.mobile-header { display: none; }
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; color: inherit; padding: 8px; border-radius: 8px; }

/* YouTube Clone Specific Styles */
.app-container { display: flex; }
.main-content-area { flex-grow: 1; overflow-y: auto; }
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 64px;
}
.header .logo {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 24px;
    font-weight: 900;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.header .search-bar {
    flex-grow: 1;
    max-width: 600px;
    margin: 0 20px;
    display: flex;
    align-items: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 16px;
    gap: 10px;
}
.header .search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    flex-grow: 1;
    font-family: inherit;
}
.header .search-bar svg { color: var(--muted); }
.header .user-actions { display: flex; align-items: center; gap: 16px; }
.header .user-actions .upload-btn {
    padding: 8px 16px;
    border: 1px solid var(--primary);
    border-radius: 20px;
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
}
.header .user-actions .upload-btn:hover { background: rgba(var(--primary-rgb), .1); }
.header .user-actions .theme-toggle { background: none; border: none; cursor: pointer; color: var(--muted); }
.header .user-actions .theme-toggle svg { width: 20px; height: 20px; }

/* Homepage Video Feed */
.video-feed {
    padding: 20px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.video-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}
.video-card:hover { transform: translateY(-5px); box-shadow: 0 12px 30px rgba(0,0,0,.3); }
.video-card .thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: var(--surface2); /* Placeholder color */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 14px;
    position: relative;
}
.video-card .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.video-card .thumbnail .play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s ease;
}
.video-card:hover .thumbnail .play-overlay { opacity: 1; }
.video-card .thumbnail .play-overlay svg { width: 36px; height: 36px; color: #fff; }
.video-card .video-info { padding: 12px; flex-grow: 1; display: flex; flex-direction: column; }
.video-card .video-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.video-card .video-meta { font-size: 12px; color: var(--muted); }
.video-card .video-meta span { margin-right: 12px; }

/* Video Player Page */
.video-player-page { padding: 20px 20px; display: flex; gap: 30px; }
.video-player-main { flex: 3; }
.video-player-main .video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background-color: #000;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
}
.video-player-main .video-container iframe,
.video-player-main .video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.video-details h1 { font-size: 28px; font-weight: 700; color: var(--text-bright); margin-bottom: 8px; }
.video-details .meta { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.video-details .description { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 24px; }
.video-actions { display: flex; gap: 16px; margin-bottom: 24px; }
.like-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: .2s;
}
.like-button.liked { color: var(--accent); border-color: var(--accent); }
.like-button svg { width: 18px; height: 18px; }
.comment-section { margin-top: 30px; }
.comment-section h3 { font-size: 20px; font-weight: 700; color: var(--text-bright); margin-bottom: 16px; }
.comment-form { display: flex; gap: 12px; margin-bottom: 24px; }
.comment-form input {
    flex-grow: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}
.comment-form button {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: var(--text-bright);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
}
.comment-form button:hover { background: var(--accent); }
.comment-list .comment {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.comment-list .comment:last-child { border-bottom: none; }
.comment-list .comment .avatar { width: 36px; height: 36px; }
.comment-list .comment-content { flex-grow: 1; }
.comment-content .author { font-size: 14px; font-weight: 600; color: var(--text-bright); margin-bottom: 4px; }
.comment-content .text { font-size: 14px; color: var(--muted); line-height: 1.5; }

/* Upload Page */
.upload-page { padding: 30px 20px; max-width: 700px; margin: 40px auto; background: var(--surface); border-radius: 16px; border: 1px solid var(--border); }
.upload-page h1 { font-size: 28px; font-weight: 700; color: var(--text-bright); text-align: center; margin-bottom: 24px; }
.upload-form .form-group { margin-bottom: 20px; }
.upload-form label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.upload-form input[type="text"],
.upload-form input[type="url"],
.upload-form textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}
.upload-form textarea { resize: vertical; min-height: 100px; }
.upload-form button {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: var(--text-bright);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
}
.upload-form button:hover { background: var(--accent); }

/* Responsive Adjustments */
@media (max-width: 900px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
    .sidebar-logo { padding: 16px 20px; font-size: 20px; }
    .sidebar-nav { padding: 0 10px; }
    .sidebar-footer { padding: 12px; }
    .main-content-area { overflow-y: visible; }
    .header { padding: 10px 16px; height: 56px; }
    .header .logo { font-size: 20px; }
    .header .search-bar { margin: 0 10px; max-width: 300px; }
    .header .search-bar input { font-size: 13px; }
    .header .user-actions .upload-btn { font-size: 12px; padding: 6px 12px; }
    .video-feed { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); padding: 16px; }
    .video-card .thumbnail { height: 160px; }
    .video-player-page { flex-direction: column; }
    .video-player-main .video-container { padding-bottom: 56.25%; }
    .video-details h1 { font-size: 24px; }
    .comment-form { flex-direction: column; }
    .comment-form button { width: 100%; }
    .upload-page { margin: 20px 10px; padding: 20px; }
}
@media (max-width: 480px) {
    .header .search-bar { display: none; } /* Hide search on very small screens */
    .video-feed { padding: 16px; }
    .video-card .thumbnail { height: 140px; }
    .video-card .video-title { font-size: 14px; }
    .video-card .video-meta { font-size: 11px; }
    .video-player-main .video-container { padding-bottom: 60%; } /* Slightly taller for mobile */
    .video-details h1 { font-size: 22px; }
    .comment-section h3 { font-size: 18px; }
    .upload-page h1 { font-size: 24px; }
}

/* ===== AgentR Dark Theme — Auto-Injected ===== */
:root{--bg:#0f0f0f;--surface:#111111;--surface2:#181818;--border:rgba(255,255,255,0.07);--text:#e8e8e8;--muted:#888;--primary:#6366f1;--primary-light:rgba(99,102,241,0.15)}
body{background:var(--bg);color:var(--text);margin:0;padding:0;min-height:100vh;font-family:'Inter','Plus Jakarta Sans',system-ui,sans-serif}

/* Layout */
.layout{display:flex;min-height:100vh}

/* Sidebar */
.sidebar{width:240px;background:var(--surface);border-right:1px solid var(--border);padding:0;flex-shrink:0;display:flex;flex-direction:column;position:sticky;top:0;height:100vh;overflow-y:auto;scrollbar-width:none}
.sidebar::-webkit-scrollbar{display:none}
.sidebar-logo{display:flex;align-items:center;gap:10px;padding:20px 20px 16px;font-size:18px;font-weight:800;letter-spacing:-0.5px;color:#fff;border-bottom:1px solid var(--border);margin-bottom:8px}
.sidebar-logo .logo-icon{color:var(--primary);flex-shrink:0}
.sidebar-nav{display:flex;flex-direction:column;padding:8px 12px;gap:2px;flex:1}
.nav-item{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;font-size:14px;font-weight:500;color:var(--muted);transition:background .15s,color .15s;text-decoration:none}
.nav-item:hover{background:rgba(255,255,255,0.07);color:#fff}
.nav-item.active{background:var(--primary-light);color:#a5b4fc;font-weight:600}
.nav-item svg{flex-shrink:0;opacity:.8;display:block;min-width:20px}
.nav-item.active svg{opacity:1}
.sidebar-section-title{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#444;padding:16px 12px 6px}

/* Main Content */
.main-content{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--bg);overflow-y:auto}

/* Top Navbar (mobile-header used as sticky topbar on all viewports) */
.mobile-header{display:flex;align-items:center;gap:12px;padding:0 24px;height:60px;background:rgba(15,15,15,0.95);border-bottom:1px solid rgba(255,255,255,0.07);position:sticky;top:0;z-index:100;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
.mobile-header .sidebar-logo{padding:0;border:none;margin:0;font-size:16px}
.header-actions{display:flex;align-items:center;gap:10px;margin-left:auto}
.mobile-menu-btn{display:none;background:none;border:none;color:var(--muted);cursor:pointer;padding:6px;border-radius:8px;flex-shrink:0;transition:color .15s}
.mobile-menu-btn:hover{color:#fff}

/* Search */
.search-form{display:flex;align-items:center;background:rgba(255,255,255,0.06);border:1px solid rgba(255,255,255,0.1);border-radius:24px;overflow:hidden;transition:border-color .2s}
.search-form:focus-within{border-color:rgba(99,102,241,0.5)}
.search-input{background:none;border:none;outline:none;color:var(--text);font-size:14px;padding:8px 16px;width:220px;box-shadow:none!important}
.search-input::placeholder{color:#555}
.search-form .btn-icon{width:40px;height:36px;border-radius:0;background:rgba(99,102,241,.7);border:none;color:#fff;border-left:1px solid rgba(99,102,241,.3);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.search-form .btn-icon:hover{background:rgba(99,102,241,.9)}

/* Buttons */
.btn-icon{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,0.06);border:1px solid rgba(255,255,255,0.08);color:var(--muted);cursor:pointer;transition:background .15s,color .15s;flex-shrink:0;padding:0}
.btn-icon:hover{background:rgba(255,255,255,0.12);color:#fff}
.btn-secondary{padding:7px 18px;border-radius:20px;background:transparent;border:1px solid rgba(255,255,255,0.18);color:var(--text);font-size:13px;font-weight:600;cursor:pointer;transition:background .15s,border-color .15s;white-space:nowrap}
.btn-secondary:hover{background:rgba(255,255,255,0.08);border-color:rgba(255,255,255,0.3)}

/* Avatar */
.avatar{border-radius:50%;object-fit:cover;flex-shrink:0}
.avatar-link{display:flex;align-items:center}
.avatar-link .avatar{width:32px;height:32px}
.avatar-sm{width:36px;height:36px}

/* Cards */
.card{background:var(--surface2);border:1px solid var(--border);border-radius:16px;padding:24px;margin-bottom:20px;transition:transform .2s,box-shadow .2s,border-color .2s}
.card:hover{transform:translateY(-3px);box-shadow:0 12px 40px rgba(0,0,0,0.4);border-color:rgba(99,102,241,0.25)}

/* Page content */
.page-header{padding:28px 28px 8px}
.page-header h1{font-size:22px;font-weight:700;letter-spacing:-.3px;margin:0;color:#fff}
.section{padding:8px 28px 28px}
.section-title{font-size:16px;font-weight:700;color:var(--text);margin:0 0 16px;letter-spacing:-.2px}

/* Content grid */
.grid-auto{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:20px}

/* Video / content cards */
.video-card{background:var(--surface2);border-radius:14px;overflow:hidden;border:1px solid var(--border);transition:transform .2s,box-shadow .2s,border-color .2s;cursor:pointer}
.video-card:hover{transform:translateY(-3px);box-shadow:0 12px 40px rgba(0,0,0,0.5);border-color:rgba(99,102,241,0.25)}
.video-thumbnail-link{display:block;position:relative;aspect-ratio:16/9;overflow:hidden;background:#252525}
.video-thumbnail{width:100%;height:100%;object-fit:cover;transition:transform .3s;display:block}
.video-card:hover .video-thumbnail{transform:scale(1.04)}
.video-info{display:flex;gap:10px;padding:12px}
.video-details{display:flex;flex-direction:column;gap:3px;min-width:0}
.video-title{font-size:14px;font-weight:600;color:var(--text);line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;transition:color .15s}
.video-title:hover{color:#a5b4fc}
.channel-name{font-size:12px;color:var(--muted);transition:color .15s;font-weight:500}
.channel-name:hover{color:#bbb}
.video-meta{font-size:12px;color:#555}

/* Empty state */
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:60px 20px;text-align:center;color:#555;gap:12px}
.empty-state h3{font-size:18px;font-weight:700;color:#888;margin:0}
.empty-state p{font-size:14px;margin:0;color:#555}
.empty-state .btn-primary{margin-top:8px;width:auto;padding:10px 24px}

/* Toast */
#toast-container{position:fixed;bottom:24px;right:24px;display:flex;flex-direction:column;gap:10px;z-index:9999}
.toast{padding:12px 20px;border-radius:12px;font-size:14px;font-weight:600;color:#fff;opacity:0;transform:translateY(10px);transition:opacity .25s,transform .25s;background:#1e1e2e;border:1px solid rgba(255,255,255,0.1)}
.toast.show{opacity:1;transform:none}
.toast-success{background:rgba(16,185,129,0.15);border-color:rgba(16,185,129,0.35);color:#34d399}
.toast-error{background:rgba(239,68,68,0.15);border-color:rgba(239,68,68,0.35);color:#f87171}

/* Badges */
.badge{display:inline-flex;align-items:center;padding:4px 12px;border-radius:20px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em}
.badge-success{background:rgba(16,185,129,.15);color:#34d399;border:1px solid rgba(16,185,129,.3)}
.badge-warning{background:rgba(245,158,11,.15);color:#fbbf24;border:1px solid rgba(245,158,11,.3)}
.badge-danger{background:rgba(239,68,68,.15);color:#f87171;border:1px solid rgba(239,68,68,.3)}
.badge-info{background:rgba(99,102,241,.15);color:#a5b4fc;border:1px solid rgba(99,102,241,.3)}

/* Animations */
@keyframes fadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
.fade-in{animation:fadeIn .4s ease both}
.fade-in-delay-1{animation:fadeIn .4s ease .08s both}
.fade-in-delay-2{animation:fadeIn .4s ease .16s both}
.fade-in-delay-3{animation:fadeIn .4s ease .24s both}

/* Utilities */
.mt-4{margin-top:16px}.hide-mobile{display:block}
@media(max-width:768px){.hide-mobile{display:none!important}}

/* Responsive */
@media(max-width:900px){.sidebar{width:200px}.grid-auto{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:14px}}
@media(max-width:768px){
  .sidebar{position:fixed;left:-260px;top:0;height:100vh;width:260px;z-index:200;transition:left .25s ease;box-shadow:4px 0 30px rgba(0,0,0,0.5)}
  .sidebar.open{left:0}
  .mobile-menu-btn{display:flex}
  .page-header{padding:16px 16px 8px}
  .section{padding:8px 16px 20px}
  .grid-auto{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px}
  .search-input{width:140px}
}
@media(max-width:480px){.grid-auto{grid-template-columns:1fr 1fr;gap:10px}.video-info{padding:8px;gap:8px}.mobile-header{padding:0 14px}}

/* Stats/Metrics grid — always 4 columns on desktop, responsive below */
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:20px}
.stat-card{background:var(--surface2);border:1px solid var(--border);border-radius:16px;padding:20px 24px;display:flex;flex-direction:column;gap:6px;transition:transform .2s,box-shadow .2s}
.stat-card:hover{transform:translateY(-3px);box-shadow:0 12px 40px rgba(0,0,0,0.4)}
.stat-card .stat-icon{width:40px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center;background:var(--primary-light);color:var(--primary);margin-bottom:4px}
.stat-card .stat-value{font-size:28px;font-weight:800;color:#fff;letter-spacing:-1px;line-height:1}
.stat-card .stat-label{font-size:13px;color:var(--muted);font-weight:500}
@media(max-width:900px){.stats-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:480px){.stats-grid{grid-template-columns:1fr 1fr;gap:12px}.stat-card{padding:16px}}

/* User dropdown in header — proper positioned menu, not inline text */
.user-menu{position:relative;display:flex;align-items:center;gap:8px;cursor:pointer}
.user-menu .avatar{width:34px;height:34px;border-radius:50%;object-fit:cover;border:2px solid var(--border)}
.user-menu-toggle{display:flex;align-items:center;gap:8px;background:none;border:none;cursor:pointer;color:var(--text);font-size:14px;font-weight:600;padding:6px 10px;border-radius:10px;transition:background .15s}
.user-menu-toggle:hover{background:rgba(255,255,255,0.06)}
.user-dropdown{position:absolute;right:0;top:calc(100% + 8px);min-width:160px;background:var(--surface2);border:1px solid var(--border);border-radius:12px;padding:6px;z-index:500;box-shadow:0 8px 32px rgba(0,0,0,0.5);display:none}
.user-dropdown.show{display:block}
.user-dropdown a,.user-dropdown button{display:flex;align-items:center;gap:10px;width:100%;padding:9px 12px;border-radius:8px;font-size:14px;font-weight:500;color:var(--text);background:none;border:none;cursor:pointer;text-decoration:none;transition:background .12s,color .12s}
.user-dropdown a:hover,.user-dropdown button:hover{background:rgba(255,255,255,0.07);color:#fff}
.user-dropdown .dropdown-divider{height:1px;background:var(--border);margin:4px 0}
.user-dropdown .logout-item,.user-dropdown a[href*="logout"]{color:#f87171}
.user-dropdown .logout-item:hover,.user-dropdown a[href*="logout"]:hover{background:rgba(239,68,68,0.1)}

/* ===== AgentR Universal Fixes (prevents common AI generation bugs) ===== */
/* FIX 1: Remove browser-default underline on ALL links — prevents underlines on nav links and buttons */
a{text-decoration:none}
a:hover{text-decoration:none}

/* FIX 2: Universal navbar layout fallback — prevents stacked/unstyled nav when AI CSS is missing */
/* Applies to any element that looks like a navbar */
nav,header,.navbar,.nav-bar,.topbar,.top-bar,.site-header,.page-header-nav,.header-nav,.main-header,.app-header{display:flex;align-items:center}
/* Nav link lists should always be horizontal */
nav ul,.navbar ul,.nav-links,.nav-items,.nav-menu,.header-links,.header-nav-links,.menu-links{display:flex;align-items:center;list-style:none;margin:0;padding:0;gap:0}
nav ul li,.navbar ul li,.nav-links li,.nav-items li,.nav-menu li{list-style:none;margin:0;padding:0}
/* All links inside navbars/headers should never be underlined and inherit color */
nav a,header a,.navbar a,.nav-bar a,.topbar a,.top-bar a,.site-header a,.header a,.nav-links a,.nav-menu a,.nav-items a{text-decoration:none;color:inherit}
/* Buttons/CTAs that are <a> tags should never have underlines */
a.btn,a.button,a.btn-primary,a.btn-secondary,a.cta-btn,a.cta-button,a.nav-btn,a.header-btn,a.get-started,.btn>a,.button>a{text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
/* ===== End AgentR Dark Theme ===== */