/* ============================================================
   Module 18/19/20 -- modern visual theme, user-facing area.
   Pure CSS on top of existing Bootstrap 5 markup -- no framework
   swap, no CSP change needed (bootstrap-icons font also served
   from cdnjs.cloudflare.com, already whitelisted in font-src).
   Module 20 pass: everything sized down -- previous hero/avatar/
   blob sizes read as oversized on real screens; also replaces the
   navbar search input+button with a single joined input-group so
   it can no longer visually "break" (mismatched heights/wrapping).
   ============================================================ */

:root {
    --brand: #4f46e5;      /* indigo -- primary accent */
    --brand-dark: #3730a3;
    --brand-light: #eef2ff;
    --ink: #1e2432;
    --muted: #6b7280;
    --bg: #f4f5f9;
    --card-radius: 12px;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-size: 0.94rem;
}

/* ---- Navbar ---- */
/* Module 21 -- real Netstager/Zoho-partner logo replaces the text+icon
   brand mark, so the bar goes light (a dark/gradient bar fought with the
   logo's own white background + colored Zoho glyph + blue badge). */
.app-navbar {
    background: #ffffff;
    border-bottom: 1px solid #e9ebf1;
    box-shadow: 0 1px 4px rgba(16, 24, 40, 0.05);
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

.app-navbar .navbar-brand {
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
}

.app-navbar .navbar-brand img {
    height: 40px;
    width: auto;
    display: block;
}

/* Search is a single joined pill (input + icon button) so it can
   never mismatch height or wrap onto its own line -- that mismatch
   was the earlier "broken" search button. */
.navbar-search {
    max-width: 380px;
}

.navbar-search .form-control {
    border: 1px solid #e5e7eb;
    background: #f4f5f9;
    border-radius: 999px 0 0 999px;
    font-size: 0.85rem;
    padding: 0.35rem 0.9rem;
    height: 34px;
    box-shadow: none;
}

.navbar-search .form-control:focus {
    background: #fff;
    border-color: var(--brand);
}

.navbar-search .btn-search {
    border-radius: 0 999px 999px 0;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    width: 38px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

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

.app-navbar .btn-logout {
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    color: var(--ink);
    background: #fff;
    font-size: 0.82rem;
    padding: 0.3rem 0.75rem;
    white-space: nowrap;
}

.app-navbar .btn-logout:hover {
    background: #f4f5f9;
    color: var(--ink);
    border-color: #d9dce3;
}

/* ---- Page shell ---- */
.page-header {
    margin-bottom: 1rem;
}

.page-header h1 {
    font-weight: 700;
    letter-spacing: -0.2px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--brand);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    margin-bottom: 0.6rem;
}

.back-link:hover {
    color: var(--brand-dark);
}

/* ---- Stat tiles (dashboard access summary) ---- */
.stat-tile {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
    border-left: 3px solid var(--brand);
    background: #fff;
}

.stat-tile .card-body {
    padding: 0.65rem 0.85rem;
}

.stat-tile .stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--brand-light);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.stat-tile .stat-label {
    color: var(--muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-tile .stat-value {
    font-weight: 700;
    font-size: 0.95rem;
}

.stat-tile.stat-warn {
    border-left-color: #f59e0b;
}

.stat-tile.stat-warn .stat-icon {
    background: #fef3c7;
    color: #b45309;
}

/* ---- Section titles ---- */
.section-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.section-title i {
    color: var(--brand);
}

/* ---- Category cards ---- */
.category-card {
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
    color: inherit;
    border: 1px solid #eceef3;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
    background: #fff;
    overflow: hidden;
}

.category-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(79, 70, 229, 0.15);
    transform: translateY(-2px);
    border-color: var(--brand);
}

.category-card .card-body {
    padding: 0.65rem 0.85rem;
}

.category-card .card-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ink);
}

.category-card .video-count-badge {
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--brand-dark);
    background: var(--brand-light);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    display: inline-block;
}

/* ---- Video cards ---- */
.video-card {
    border: 1px solid #eceef3;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.video-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(16, 24, 40, 0.12);
    transform: translateY(-2px);
}

.video-card .card-body {
    padding: 0.75rem;
}

.video-card .thumb-wrap {
    position: relative;
    overflow: hidden;
}

.video-card .video-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    /* Same gradient as .video-thumb-placeholder -- shows through if the
       URL 404s (deleted file / bad youtube id), instead of a flat gray
       box. color:transparent + font-size:0 hide the broken-image alt
       text label; the browser's own small broken-icon glyph can't be
       removed with CSS alone (no cross-browser "did this img fail to
       load" selector exists without JS), but this keeps everything
       around it looking intentional instead of blank/gray. */
    background: linear-gradient(135deg, #eef0f5, #dde3f0);
    color: transparent;
    font-size: 0;
    transition: transform 0.25s ease;
}

.video-card:hover .video-thumb {
    transform: scale(1.03);
}

.video-card .video-thumb-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #eef0f5, #dde3f0);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
    justify-content: center;
    color: #9aa0ab;
    font-size: 0.78rem;
}

.video-card .video-thumb-placeholder i {
    font-size: 1.3rem;
    color: #aab2c5;
}

.video-card .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 20, 30, 0);
    transition: background 0.18s ease;
    pointer-events: none;
}

.video-card:hover .play-overlay {
    background: rgba(17, 20, 30, 0.22);
}

.video-card .play-overlay i {
    font-size: 1.9rem;
    color: #fff;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.18s ease, transform 0.18s ease;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}

.video-card:hover .play-overlay i {
    opacity: 1;
    transform: scale(1);
}

.video-card .source-pill {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
}

.video-card .source-pill.pill-youtube {
    background: #dc2626;
}

.video-card .card-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--ink);
}

.video-card .btn-watch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.2px;
    padding: 0.45rem 1rem;
    color: #fff;
    background: linear-gradient(135deg, var(--brand) 0%, #06b6d4 100%);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.video-card .btn-watch:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.4);
    filter: brightness(1.06);
}

.video-card .btn-watch:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.35);
}

.video-card .btn-watch .watch-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.video-card .btn-watch:hover .watch-icon {
    transform: scale(1.12);
}

/* ---- Empty states ---- */
.empty-state {
    text-align: center;
    padding: 2rem 1.25rem;
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px dashed #d9dce3;
    color: var(--muted);
    font-size: 0.85rem;
}

.empty-state i {
    font-size: 1.5rem;
    color: #c2c6d1;
    display: block;
    margin-bottom: 0.4rem;
}

/* ---- Login card (shared entry point) ---- */
.login-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(30, 27, 75, 0.3);
}

.login-card .login-logo {
    height: 36px;
    width: auto;
    display: block;
    margin: 0 auto 1rem;
}

.login-card .btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    border-radius: 999px;
    font-weight: 600;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

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

/* ============================================================
   "Live feel" accents -- kept, but toned way down in scale:
   smaller hero, smaller/softer blobs, no oversized glow rings.
   Everything below is CSS gradients/blur/keyframes only -- no
   external images, so CSP img-src/connect-src stay untouched.
   ============================================================ */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes blobDrift {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(12px, -18px) scale(1.05); }
    66%  { transform: translate(-10px, 10px) scale(0.97); }
    100% { transform: translate(0, 0) scale(1); }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease both;
}

/* ---- Hero banner (dashboard / category / search headers) ---- */
.hero-banner {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(120deg, var(--brand-dark) 0%, var(--brand) 55%, #06b6d4 100%);
    color: #fff;
    isolation: isolate;
}

.hero-banner .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.35;
    z-index: -1;
    animation: blobDrift 15s ease-in-out infinite;
}

.hero-banner .blob-a { width: 120px; height: 120px; background: #22d3ee; top: -40px; right: -20px; }
.hero-banner .blob-b { width: 90px;  height: 90px;  background: #a78bfa; bottom: -35px; left: 12%; animation-delay: 3s; }
.hero-banner .blob-c { width: 70px;  height: 70px;  background: #f472b6; bottom: -25px; right: 22%; animation-delay: 6s; }

.hero-banner h1 {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.2px;
    margin-bottom: 0.2rem !important;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

.hero-banner .hero-pill {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Stat tiles sitting inside the hero, glass style */
.stat-tile.glass {
    background: rgba(255, 255, 255, 0.14);
    border-left: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    color: #fff;
}

.stat-tile.glass .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.stat-tile.glass .stat-label {
    color: rgba(255, 255, 255, 0.75);
}

.stat-tile.glass.stat-warn {
    border-color: rgba(255, 255, 255, 0.4);
}

.stat-tile.glass.stat-warn .stat-icon {
    background: #fbbf24;
    color: #78350f;
}

/* ---- Category card cover art (deterministic gradient, per category) ---- */
.category-card .cat-cover {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.category-card .cat-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.3), transparent 55%);
}

.category-card .cat-cover i {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.95);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.15));
}

/* ---- Login: soft animated blobs + glass card ---- */
.login-shell {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    background: linear-gradient(120deg, var(--brand-dark) 0%, var(--brand) 50%, #06b6d4 100%);
}

.login-shell .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(35px);
    opacity: 0.4;
    animation: blobDrift 17s ease-in-out infinite;
}

.login-shell .blob-a { width: 220px; height: 220px; background: #22d3ee; top: -60px; left: -50px; }
.login-shell .blob-b { width: 170px; height: 170px; background: #a78bfa; bottom: -55px; right: -30px; animation-delay: 4s; }
.login-shell .blob-c { width: 130px; height: 130px; background: #f472b6; bottom: 18%; left: 58%; animation-delay: 8s; }

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .hero-banner {
        padding: 0.9rem 1rem;
    }

    .navbar-search {
        max-width: 100%;
    }
}
