/* ── Zahralicious Platform - Main Styles ─────────────────────────────────── */

:root {
    /* Primary: muted warm coral/terracotta */
    --royal-plum: #c96b52;
    --royal-plum-light: #ee9272;
    --royal-plum-dark: #8a4337;
    /* Secondary: muted dusty rose */
    --berry: #c43554;
    --berry-light: #e0506a;
    --berry-dark: #702030;
    /* Neutral warm backgrounds */
    --dust: #f0e0cc;
    --dust-light: #fffaf6;
    --dust-dark: #c0a998;
    /* Near-neutral dark (body text / dark mode base) */
    --indigo: #342b27;
    --indigo-light: #655650;
    --indigo-dark: #110d0b;
    /* Gold: unchanged */
    --gold: #FFD400;
    --gold-light: #ffee99;
    --gold-dark: #998000;
}

/* ── Base Resets ─────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.z-emoji-icon {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-size: 1.15rem;
    line-height: 1;
}

/* ── Scrollbar Styling ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--royal-plum); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--berry); }
.dark ::-webkit-scrollbar-thumb { background: var(--indigo-light); }

/* ── Transitions ─────────────────────────────────────────────────────────── */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
/* Width is driven by a CSS variable so #main-content can react cleanly. */
:root { --sidebar-w: 260px; --sidebar-w-collapsed: 76px; --bottom-nav-h: 64px; }

.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}

/* Desktop collapse */
@media (min-width: 768px) {
    body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
    body.sidebar-collapsed .sidebar-text { opacity: 0; pointer-events: none; max-width: 0; }
    body.sidebar-collapsed .sidebar a,
    body.sidebar-collapsed .sidebar .sidebar-user { justify-content: center; }
    body.sidebar-collapsed .sidebar .sidebar-user { gap: 0; flex: none; }
    body.sidebar-collapsed .sidebar nav a { padding-left: 0; padding-right: 0; gap: 0; justify-content: center; }
    body.sidebar-collapsed .sidebar .sidebar-user-section { justify-content: center; gap: 0; }
    body.sidebar-collapsed #main-content { margin-left: var(--sidebar-w-collapsed); }
    body.sidebar-collapsed .sidebar-collapse-toggle svg { transform: rotate(180deg); }

    /* Override Tailwind's md:ml-[260px] cleanly with our variable */
    #main-content { margin-left: var(--sidebar-w); transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
}

/* Hide-when-collapsed text spans; use max-width transition so elements
   fully collapse and stop occupying space, not just fade. */
.sidebar-text {
    transition: opacity 0.25s ease, max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Topbar page icon (no box; size comes from SVG in template) ─────────── */
.topbar-page-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
.topbar-page-icon svg {
    display: block;
    opacity: 0.5;
}

/* ── Topbar back button ──────────────────────────────────────────────────── */
.topbar-back-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b8907a;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
}
.topbar-back-btn:hover {
    background: rgba(201,107,82,0.1);
    color: var(--royal-plum);
}
.dark .topbar-back-btn { color: #c4957a; }
.dark .topbar-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f3a679;
}

/* Floating chevron toggle that lives on the right edge of the sidebar */
.sidebar-collapse-toggle {
    position: absolute;
    top: 72px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--royal-plum), var(--berry));
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(42, 18, 8, 0.14);
    cursor: pointer;
    border: 2px solid #f4e1c1;
    z-index: 60;
    transition: transform 0.2s ease, background 0.2s ease;
}
.sidebar-collapse-toggle:hover { transform: scale(1.1); }
.sidebar-collapse-toggle svg { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.dark .sidebar-collapse-toggle {
    border-color: #110d0b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
@media (min-width: 768px) { .sidebar-collapse-toggle { display: flex; } }

/* Mobile: true full-viewport drawer (menu / More) */
@media (max-width: 767px) {
    .sidebar {
        width: 100%;
        max-width: none;
        right: 0;
        transform: translateX(-100%);
        min-height: 100vh;
        min-height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .sidebar.mobile-open { transform: translateX(0); }
    /* Reserve room for the bottom nav on mobile so content isn't covered */
    #main-content > main {
        padding-bottom: calc(var(--bottom-nav-h) + 24px + env(safe-area-inset-bottom, 0px));
    }
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    transition: all 0.2s ease;
    color: rgba(62, 26, 16, 0.72);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 2px 8px;
}
.sidebar-link:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--royal-plum);
}
.sidebar-link.active {
    background: var(--royal-plum);
    color: #fff;
    box-shadow: 0 4px 12px rgba(201, 107, 82, 0.3);
}
.dark .sidebar-link {
    color: rgba(255, 255, 255, 0.65);
}
.dark .sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.z-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.z-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.06);
}
.dark .z-card {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.dark .z-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.06);
}

.z-card-flat {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.dark .z-card-flat {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-card {
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.08;
}
.stat-card-plum::after { background: var(--royal-plum); }
.stat-card-berry::after { background: var(--berry); }
.stat-card-gold::after { background: var(--gold); }
.stat-card-indigo::after { background: var(--indigo); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.z-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
}
.z-btn-primary {
    background: var(--royal-plum);
    color: #fff;
}
.z-btn-primary:hover {
    background: var(--royal-plum-light);
    box-shadow: 0 4px 12px rgba(201, 107, 82, 0.3);
}
.z-btn-secondary {
    background: var(--dust-light);
    color: var(--indigo);
}
.dark .z-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #e0dce6;
}
.z-btn-secondary:hover {
    background: var(--dust);
}
.dark .z-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}
.z-btn-berry {
    background: var(--berry);
    color: #fff;
}
.z-btn-berry:hover {
    background: var(--berry-light);
    box-shadow: 0 4px 12px rgba(196, 53, 84, 0.3);
}
.z-btn-outline {
    background: transparent;
    color: var(--royal-plum);
    border: 1.5px solid var(--royal-plum);
}
.z-btn-outline:hover {
    background: var(--royal-plum);
    color: #fff;
}
.z-btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
}
.z-btn-icon {
    padding: 8px;
    border-radius: 10px;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.z-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.z-badge-active { background: rgba(16, 185, 129, 0.1); color: #059669; }
.z-badge-inactive { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.z-badge-pending { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.z-badge-premium { background: rgba(196, 53, 84, 0.1); color: var(--berry); }
.z-badge-annual { background: rgba(255, 212, 0, 0.15); color: var(--gold-dark); }
.z-badge-free { background: rgba(62, 26, 16, 0.1); color: var(--indigo); }

.dark .z-badge-active { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.dark .z-badge-inactive { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.dark .z-badge-pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.dark .z-badge-premium { background: rgba(196, 53, 84, 0.15); color: var(--berry-light); }
.dark .z-badge-annual { background: rgba(255, 212, 0, 0.15); color: var(--gold); }
.dark .z-badge-free { background: rgba(110, 52, 34, 0.2); color: #d8b08c; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.z-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.z-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.z-table td {
    padding: 14px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    vertical-align: middle;
}
.z-table tr { transition: background 0.15s ease; }
.z-table tbody tr:hover { background: rgba(239, 86, 72, 0.02); }
.dark .z-table th { border-color: rgba(255, 255, 255, 0.06); color: #6b7280; }
.dark .z-table td { border-color: rgba(255, 255, 255, 0.04); }
.dark .z-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

/* ── Avatars ─────────────────────────────────────────────────────────────── */
.z-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    flex-shrink: 0;
}
.z-avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.z-avatar-md { width: 40px; height: 40px; font-size: 0.875rem; }
.z-avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.z-avatar-xl { width: 72px; height: 72px; font-size: 1.5rem; }

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.z-progress {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 100px;
    overflow: hidden;
}
.dark .z-progress { background: rgba(255, 255, 255, 0.08); }
.z-progress-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(90deg, var(--royal-plum), var(--berry));
}
.z-progress-gold .z-progress-fill {
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
}

/* ── Input Fields ────────────────────────────────────────────────────────── */
.z-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 0.875rem;
    background: #fff;
    color: var(--indigo);
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}
.z-input:focus {
    border-color: var(--royal-plum);
    box-shadow: 0 0 0 3px rgba(201, 107, 82, 0.1);
}
.dark .z-input {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e0dce6;
}
.dark .z-input:focus {
    border-color: var(--berry);
    box-shadow: 0 0 0 3px rgba(196, 53, 84, 0.15);
}
.z-input::placeholder { color: #9ca3af; }
.dark .z-input::placeholder { color: #6b7280; }

.z-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 0.875rem;
    background: #fff;
    color: var(--indigo);
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}
.z-textarea:focus {
    border-color: var(--royal-plum);
    box-shadow: 0 0 0 3px rgba(201, 107, 82, 0.1);
}
.dark .z-textarea {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e0dce6;
}

/* ── Toggle Switch ───────────────────────────────────────────────────────── */
.z-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
}
.z-toggle.active { background: var(--royal-plum); }
.z-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.z-toggle.active::after { transform: translateX(20px); }
.dark .z-toggle { background: rgba(255, 255, 255, 0.12); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.z-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    overflow-x: auto;
}
.dark .z-tabs { border-color: rgba(255, 255, 255, 0.06); }
.z-tab {
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #9ca3af;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.z-tab:hover { color: var(--royal-plum); }
.z-tab.active {
    color: var(--royal-plum);
    border-bottom-color: var(--royal-plum);
}
.dark .z-tab:hover { color: var(--berry-light); }
.dark .z-tab.active {
    color: var(--berry-light);
    border-bottom-color: var(--berry-light);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.z-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.z-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.z-modal {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.z-modal-overlay.active .z-modal {
    transform: scale(1) translateY(0);
}
.dark .z-modal {
    background: #1e1714;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.z-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dark .z-modal-header { border-color: rgba(255, 255, 255, 0.06); }
.z-modal-body { padding: 24px; }
.z-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.dark .z-modal-footer { border-color: rgba(255, 255, 255, 0.06); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.z-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.z-toast {
    background: #fff;
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--royal-plum);
    min-width: 300px;
}
.z-toast.show { transform: translateX(0); }
.z-toast-success { border-left-color: #10b981; }
.z-toast-error { border-left-color: #e0506a; }
.z-toast-warning { border-left-color: #f59e0b; }
.dark .z-toast {
    background: #1e1714;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.is-loading {
    cursor: wait !important;
    opacity: 0.82;
}
.z-submit-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-right: 0.45rem;
    border-radius: 999px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    vertical-align: -0.18rem;
    animation: zahra-spin 0.75s linear infinite;
}
@keyframes zahra-spin {
    to { transform: rotate(360deg); }
}

/* ── Dropdown ────────────────────────────────────────────────────────────── */
.z-dropdown {
    position: relative;
    display: inline-block;
}
.z-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.06);
    min-width: 180px;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 30;
    overflow: hidden;
}
.z-dropdown-menu.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.dark .z-dropdown-menu {
    background: #1e1714;
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.z-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.875rem;
    color: var(--indigo);
    cursor: pointer;
    transition: background 0.15s ease;
}
.z-dropdown-item:hover { background: rgba(239, 86, 72, 0.04); }
.dark .z-dropdown-item { color: #e0dce6; }
.dark .z-dropdown-item:hover { background: rgba(255, 255, 255, 0.06); }

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
.z-tooltip {
    position: relative;
}
.z-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 6px 12px;
    background: var(--indigo);
    color: #fff;
    font-size: 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 40;
}
.z-tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Search Bar ──────────────────────────────────────────────────────────── */
.z-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    border: 1.5px solid transparent;
    transition: all 0.2s ease;
}
.z-search:focus-within {
    background: #fff;
    border-color: var(--royal-plum);
    box-shadow: 0 0 0 3px rgba(201, 107, 82, 0.08);
}
.dark .z-search { background: rgba(255, 255, 255, 0.06); }
.dark .z-search:focus-within {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--berry);
    box-shadow: 0 0 0 3px rgba(196, 53, 84, 0.12);
}
.z-search input {
    background: none;
    border: none;
    outline: none;
    font-size: 0.875rem;
    color: var(--indigo);
    width: 100%;
    font-family: inherit;
}
.dark .z-search input { color: #e0dce6; }
.z-search svg { color: #9ca3af; flex-shrink: 0; }

/* ── Mini Chart (CSS only) ───────────────────────────────────────────────── */
.z-mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 48px;
}
.z-mini-bar {
    width: 100%;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, var(--royal-plum), var(--berry));
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 8px;
}
.dark .z-mini-bar {
    background: linear-gradient(180deg, var(--berry), var(--berry-light));
}

/* ── Donut Chart (CSS) ───────────────────────────────────────────────────── */
.z-donut {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.z-donut-inner {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--indigo);
    z-index: 2;
}
.dark .z-donut-inner { background: #1a1410; color: #f0e0cc; }

/* ── Notification Dot ────────────────────────────────────────────────────── */
.z-notif-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--berry);
    border-radius: 50%;
    border: 2px solid #fff;
}
.dark .z-notif-dot { border-color: #110d0b; }

/* ── Calendar ────────────────────────────────────────────────────────────── */
.z-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.z-calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
}
.z-calendar-day:hover { background: rgba(239, 86, 72, 0.06); }
.dark .z-calendar-day:hover { background: rgba(255, 255, 255, 0.06); }
.z-calendar-day.today {
    background: var(--royal-plum);
    color: #fff;
    font-weight: 600;
}
.z-calendar-day.has-event::after {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--berry);
    position: absolute;
    bottom: 4px;
}

/* ── Activity Feed ───────────────────────────────────────────────────────── */
.z-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.dark .z-activity-item { border-color: rgba(255, 255, 255, 0.04); }
.z-activity-item:last-child { border-bottom: none; }
.z-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

/* ── Mobile Overlay ──────────────────────────────────────────────────────── */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.mobile-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .z-toast { min-width: auto; max-width: calc(100vw - 40px); }
    /* Smaller hero banner padding on phones */
    .z-welcome-banner { padding: 22px 20px; border-radius: 16px; }
    .z-welcome-banner::before { width: 220px; height: 220px; }
    .z-welcome-banner::after { width: 140px; height: 140px; }
    /* Modals fill the screen better on tiny devices */
    .z-modal { width: 96%; max-width: 520px; max-height: 92vh; border-radius: 16px; }
    .z-modal-header { padding: 16px 18px; }
    .z-modal-body { padding: 18px; }
    .z-modal-footer { padding: 14px 18px; }
}

/* Tighter calendar/heatmap on phones */
@media (max-width: 480px) {
    .z-tier-card { padding: 22px; border-radius: 16px; }
}

/* ── Sidebar Overlay Toggle ─────────────────────────────────────────────── */
#sidebar-overlay.active {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ── Mobile Bottom Navigation ────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: var(--bottom-nav-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.04);
}
.dark .bottom-nav {
    background: rgba(17, 13, 11, 0.92);
    border-top-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
}
@media (min-width: 768px) { .bottom-nav { display: none; } }

.bottom-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #6b7280;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 8px 4px;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    background: transparent;
    border: none;
}
.bottom-nav-item svg { width: 22px; height: 22px; transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.bottom-nav-item:active { transform: scale(0.94); }
.bottom-nav-item:hover { color: var(--royal-plum); }
.dark .bottom-nav-item { color: #b8907a; }
.dark .bottom-nav-item:hover { color: var(--berry-light); }

.bottom-nav-item.active { color: var(--royal-plum); }
.dark .bottom-nav-item.active { color: var(--berry-light); }
.bottom-nav-item.active svg { transform: translateY(-2px); }
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, var(--royal-plum), var(--berry));
}

.bottom-nav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 9999px;
    background: var(--berry);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92);
}
.dark .bottom-nav-badge { box-shadow: 0 0 0 2px rgba(17, 13, 11, 0.92); }

/* Sidebar (mobile drawer) header tweaks */
.sidebar-mobile-close {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    color: rgba(62, 26, 16, 0.6);
    background: rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.sidebar-mobile-close:hover { background: rgba(0, 0, 0, 0.08); color: var(--royal-plum); }
.dark .sidebar-mobile-close {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.08);
}
.dark .sidebar-mobile-close:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
@media (max-width: 767px) { .sidebar-mobile-close { display: inline-flex; } }

/* Profile/user tile inside the sidebar - clickable, modern hover */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    flex: 1;
    min-width: 0;
    transition: background 0.2s ease;
}
.sidebar-user:hover { background: rgba(0, 0, 0, 0.04); }
.dark .sidebar-user:hover { background: rgba(255, 255, 255, 0.06); }

/* Reduce active-page glow on the topbar bell to avoid double-pulses */
@media (max-width: 767px) {
    /* Tighter topbar paddings on phones */
    header.app-topbar { padding-left: 12px; padding-right: 12px; }
}

/* ── Welcome Banner ──────────────────────────────────────────────────────── */
.z-welcome-banner {
    border-radius: 20px;
    padding: 28px 32px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--royal-plum) 0%, #d8785e 50%, var(--royal-plum-light) 100%);
    color: #fff;
}
.z-welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
}
.z-welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: 10%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
}

/* ── Attendance Heatmap ──────────────────────────────────────────────────── */
.z-heatmap-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    transition: transform 0.15s ease;
}
.z-heatmap-cell:hover { transform: scale(1.3); }
.z-heatmap-attended { background: rgba(16, 185, 129, 0.6); }
.z-heatmap-missed { background: rgba(239, 68, 68, 0.4); }
.z-heatmap-empty { background: rgba(0, 0, 0, 0.04); }
.dark .z-heatmap-empty { background: rgba(255, 255, 255, 0.04); }

/* ── Subscription Card ───────────────────────────────────────────────────── */
.z-tier-card {
    border-radius: 20px;
    padding: 28px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease;
}
.z-tier-card:hover { transform: translateY(-4px); }
.z-tier-card.featured {
    border: 2px solid var(--berry);
    box-shadow: 0 8px 32px rgba(196, 53, 84, 0.12);
}
.dark .z-tier-card.featured {
    box-shadow: 0 8px 32px rgba(196, 53, 84, 0.2);
}

/* ── Notification Item ───────────────────────────────────────────────────── */
.z-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    transition: background 0.15s ease;
}
.z-notif-item.unread {
    background: rgba(201, 107, 82, 0.03);
}
.dark .z-notif-item.unread {
    background: rgba(196, 53, 84, 0.06);
}
.z-notif-item:hover {
    background: rgba(201, 107, 82, 0.05);
}
.dark .z-notif-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* ── Chapter Player ──────────────────────────────────────────────────────── */
#course-video {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    background: #05030a;
    border-radius: 0;
    opacity: 1;
    z-index: 2;
    transition: opacity 0.3s ease;
    /* Remove any browser-injected media controls padding */
    -webkit-media-controls: none;
}
.video-loading #course-video {
    opacity: 0;
}

/* Prevent browser from showing extra shadow controls on iOS Safari */
#course-video::-webkit-media-controls { display: none !important; }
#course-video::-webkit-media-controls-enclosure { display: none !important; }

/* Video area vs control bar (#video-controls-bar is sibling inside fullscreen root) */
.z-video-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    flex: 0 0 auto;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 18% 15%, rgba(255, 213, 188, 0.18), transparent 28%),
        linear-gradient(135deg, #08050b 0%, #170f18 52%, #07050a 100%);
}
.z-video-poster {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-image:
        linear-gradient(135deg, rgba(10, 6, 11, 0.58), rgba(18, 11, 20, 0.42)),
        var(--z-video-poster);
    background-position: center;
    background-size: cover;
    filter: blur(15px) saturate(1.08) brightness(0.88);
    transform: scale(1.08);
    transition: opacity 0.35s ease;
}
.z-video-poster::after {
    content: "";
    position: absolute;
    inset: -20%;
    background: linear-gradient(105deg, transparent 18%, rgba(255, 255, 255, 0.16) 45%, transparent 72%);
    transform: translateX(-55%);
    animation: z-video-poster-shine 2.8s ease-in-out infinite;
}
.video-ready .z-video-poster {
    opacity: 0;
    pointer-events: none;
}
.z-video-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    background:
        radial-gradient(circle at center, rgba(201, 107, 82, 0.18), transparent 34%),
        linear-gradient(180deg, rgba(5, 3, 8, 0.12), rgba(5, 3, 8, 0.3));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}
.video-loading .z-video-loading-overlay {
    opacity: 1;
}
.video-ready .z-video-loading-overlay {
    opacity: 0;
}
.z-video-loader {
    position: relative;
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
}
.z-video-loader-ring {
    position: absolute;
}
.z-video-loader-ring {
    inset: 11px;
    border-radius: 999px;
    background: conic-gradient(from 0deg, rgba(255, 255, 255, 0), #ffd5bc, #e0506a, rgba(255, 255, 255, 0));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    animation: z-video-loader-spin 1s linear infinite;
}

/* ── Centre play/pause overlay ──────────────────────────────────────────── */
.z-video-centre-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: white;
    border: none;
    cursor: pointer;
    transition: opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}
.z-video-centre-play.visible {
    opacity: 1;
    pointer-events: auto;
}
/* When video is paused show it, hide when playing */
#video-wrapper:not(.playing) .z-video-centre-play {
    opacity: 0.9;
    pointer-events: auto;
}

/* ── Custom control bar ─────────────────────────────────────────────────── */
.z-video-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 14px;
    background: var(--color-white, #fff);
    border-top: 1px solid rgba(0,0,0,0.06);
    user-select: none;
    flex-shrink: 0;
    transition: opacity 0.38s ease;
}
/* Hide OS pointer with chrome (YouTube-like); ends when .z-video-controls-idle is removed */
#video-wrapper.z-video-controls-idle:fullscreen,
#video-wrapper.z-video-controls-idle:-webkit-full-screen {
    cursor: none;
}
#video-wrapper.z-video-controls-idle:fullscreen *,
#video-wrapper.z-video-controls-idle:-webkit-full-screen * {
    cursor: none !important;
}
#video-wrapper.z-video-controls-idle:fullscreen .z-video-controls,
#video-wrapper.z-video-controls-idle:-webkit-full-screen .z-video-controls {
    opacity: 0;
    pointer-events: none;
}
.dark .z-video-controls {
    background: rgb(30 23 20); /* near-neutral warm dark */
    border-top-color: rgba(255,255,255,0.06);
}

/* Seek row */
.z-video-seek-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Time display */
.z-video-time {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: #8b8fa8;
    flex-shrink: 0;
    min-width: 36px;
    white-space: nowrap;
}
.dark .z-video-time { color: #6b7280; }
.z-video-time-right { text-align: right; }

/* Seek bar */
.z-video-seek {
    flex: 1;
    cursor: pointer;
    padding: 6px 0;
    position: relative;
    touch-action: none;
}
.z-video-seek-track {
    position: relative;
    height: 4px;
    background: #e2e4ed;
    border-radius: 999px;
    overflow: visible;
}
.dark .z-video-seek-track { background: rgba(255,255,255,0.12); }

.z-video-buffer-ranges {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
}
.z-video-buffer-ranges span {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: inherit;
    background: rgba(108, 113, 138, 0.16);
}
.dark .z-video-buffer-ranges span {
    background: rgba(255, 255, 255, 0.14);
}

.z-video-seek-fill {
    position: relative;
    z-index: 1;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--royal-plum, #c96b52), var(--berry, #c43554));
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}

.z-video-seek-thumb {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 0%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--royal-plum, #c96b52);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.1s ease;
    pointer-events: none;
}
.z-video-seek:hover .z-video-seek-thumb,
.z-video-seek.dragging .z-video-seek-thumb {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
}

/* Button row */
.z-video-btn-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.z-video-btn-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Individual buttons */
.z-video-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #4b4e6d;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
    flex-shrink: 0;
}
.dark .z-video-btn { color: #9ca3c8; }

.z-video-btn:hover {
    background: rgba(0,0,0,0.06);
    color: #2d2f4e;
}
.dark .z-video-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #e0e3f4;
}
.z-video-btn:active { transform: scale(0.92); }

/* Play/Pause — circular chip so coral icon reads on light + dark bars */
.z-video-btn-play {
    width: 40px;
    height: 40px;
    background: rgba(201, 107, 82, 0.14);
    border: none;
    border-image: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    color: var(--royal-plum, #c96b52);
    border-radius: 50px;
    box-sizing: content-box;
}
.z-video-btn-play .z-video-icon {
    width: 25px;
    height: 25px;
}
#video-play-icon {
    padding-left: 3px;
}
.z-video-btn-play:hover {
    background: rgba(201, 107, 82, 0.22);
    color: var(--royal-plum, #c96b52);
}
.dark .z-video-btn-play {
    background: rgba(201, 107, 82, 0.22);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    color: #ee9272;
}
.dark .z-video-btn-play:hover {
    background: rgba(201, 107, 82, 0.32);
    color: #f5b89e;
}
/* Explicit: devtools / preview target */
#video-play-btn {
    border: none;
    border-width: 0;
    border-style: none;
    border-color: transparent;
    border-image: none;
}

/* Unified icon size — all control bar SVGs use this class */
.z-video-icon {
    width: 27px;
    height: 27px;
    display: block;
    flex-shrink: 0;
}
#video-fs-enter {
    width: 20px;
    height: 20px;
}

/* Volume area */
.z-video-vol-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.z-video-vol-slider-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 36px;
    flex-shrink: 0;
    overflow: visible;
}

.z-video-vol-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    max-width: 64px;
    height: 3px;
    margin: 0;
    padding: 0;
    border-radius: 999px;
    background: #e2e4ed;
    cursor: pointer;
    outline: none;
    vertical-align: middle;
}
.dark .z-video-vol-slider { background: rgba(255,255,255,0.15); }

.z-video-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--royal-plum, #c96b52);
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(201,107,82,0.15);
}
.z-video-vol-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--royal-plum, #c96b52);
    cursor: pointer;
    border: none;
}

/* Fullscreen: video fills stage; custom bar overlays bottom (like YouTube) */
#video-wrapper:fullscreen .z-video-stage,
#video-wrapper:-webkit-full-screen .z-video-stage {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#video-wrapper:fullscreen .z-video-controls,
#video-wrapper:-webkit-full-screen .z-video-controls {
    position: absolute;
    z-index: 5;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.45) 45%, transparent 100%);
    border-top: none;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    flex-shrink: 0;
}
#video-wrapper:fullscreen #course-video,
#video-wrapper:-webkit-full-screen #course-video {
    max-height: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#video-wrapper:fullscreen,
#video-wrapper:-webkit-full-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #000;
}
/* Readable controls over dark gradient (applies to both light + dark themes) */
#video-wrapper:fullscreen .z-video-time,
#video-wrapper:-webkit-full-screen .z-video-time {
    color: rgba(255,255,255,0.88);
}
#video-wrapper:fullscreen .z-video-seek-track,
#video-wrapper:-webkit-full-screen .z-video-seek-track {
    background: rgba(255,255,255,0.28);
}
#video-wrapper:fullscreen .z-video-btn,
#video-wrapper:-webkit-full-screen .z-video-btn {
    color: rgba(255,255,255,0.95);
}
#video-wrapper:fullscreen .z-video-btn:hover,
#video-wrapper:-webkit-full-screen .z-video-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
#video-wrapper:fullscreen .z-video-btn-play,
#video-wrapper:-webkit-full-screen .z-video-btn-play {
    color: #f5eeff;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-image: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
#video-wrapper:fullscreen .z-video-btn-play:hover,
#video-wrapper:-webkit-full-screen .z-video-btn-play:hover {
    color: #fff;
    background: rgba(243, 166, 121, 0.32);
}
#video-wrapper:fullscreen #video-play-btn,
#video-wrapper:-webkit-full-screen #video-play-btn {
    border: none;
    border-width: 0;
    border-style: none;
    border-color: transparent;
    border-image: none;
}
#video-wrapper:fullscreen .z-video-vol-slider,
#video-wrapper:-webkit-full-screen .z-video-vol-slider {
    background: rgba(255,255,255,0.28);
}
#video-wrapper:fullscreen .z-video-vol-slider::-webkit-slider-thumb,
#video-wrapper:-webkit-full-screen .z-video-vol-slider::-webkit-slider-thumb {
    background: #ffd5bc;
}
#video-wrapper:fullscreen .z-video-vol-slider::-moz-range-thumb,
#video-wrapper:-webkit-full-screen .z-video-vol-slider::-moz-range-thumb {
    background: #ffd5bc;
}

/* Mobile: slightly tighter layout */
@media (max-width: 480px) {
    .z-video-loader { width: 78px; height: 78px; }
    .z-video-loader-ring { inset: 9px; }
    .z-video-controls { padding: 10px 12px 12px; gap: 8px; }
    .z-video-btn { width: 34px; height: 34px; }
    .z-video-btn-play { width: 38px; height: 38px; }
    .z-video-icon { width: 22px; height: 22px; }
    .z-video-btn-play .z-video-icon { width: 22px; height: 22px; }
    .z-video-vol-slider-wrap { width: 52px; height: 34px; }
    .z-video-vol-slider { max-width: 52px; }
}

@keyframes z-video-loader-spin {
    to { transform: rotate(360deg); }
}
@keyframes z-video-poster-shine {
    0% { transform: translateX(-60%); opacity: 0; }
    28% { opacity: 0.62; }
    64%, 100% { transform: translateX(60%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .z-video-loader-ring,
    .z-video-poster::after {
        animation: none;
    }
}

/* ── Quiz Options ────────────────────────────────────────────────────────── */
.quiz-option {
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.quiz-option:focus {
    outline: 2px solid var(--royal-plum);
    outline-offset: 2px;
}
.quiz-option[disabled],
.quiz-question[data-answered] .quiz-option {
    cursor: default;
    pointer-events: none;
}
.quiz-explanation {
    animation: fadeInDown 0.25s ease both;
}

/* ── Chapter content prose ───────────────────────────────────────────────── */
.chapter-content h1,
.chapter-content h2,
.chapter-content h3 {
    font-weight: 800;
    color: var(--text-heading);
    margin-top: 1.25em;
    margin-bottom: 0.5em;
}
.chapter-content p { margin-bottom: 0.9em; }
.chapter-content ul,
.chapter-content ol {
    padding-left: 1.5em;
    margin-bottom: 0.9em;
}
.chapter-content li { margin-bottom: 0.4em; }
.chapter-content strong { font-weight: 700; color: var(--text-heading); }
.chapter-content blockquote {
    border-left: 3px solid var(--royal-plum);
    padding-left: 1em;
    color: var(--text-muted);
    font-style: italic;
    margin: 1em 0;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Notification bottom-sheet (mobile) ─────────────────────────────────── */
@keyframes notifSheetIn {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes notifSheetOut {
    from { transform: translateY(0);    opacity: 1; }
    to   { transform: translateY(100%); opacity: 0; }
}
.notif-sheet-in  { animation: notifSheetIn  0.32s cubic-bezier(0.32, 0.72, 0, 1) both; }
.notif-sheet-out { animation: notifSheetOut 0.22s cubic-bezier(0.4,  0,    1, 1) both; }

#nav-notif-scroll {
    -webkit-overflow-scrolling: touch;
}

/* "View all" in notification sheet: loading state */
.nav-notif-view-all--loading {
    pointer-events: none;
    opacity: 0.92;
}
.nav-notif-view-all--loading .nav-notif-view-all-label {
    visibility: hidden;
}
.nav-notif-view-all--loading .nav-notif-view-all-spin {
    display: flex !important;
}

@media (max-width: 767px) {
    #nav-notif-panel #nav-notif-close {
        display: none !important;
    }
    #nav-notif-panel .notif-drag-handle {
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
        cursor: grab;
    }
    #nav-notif-panel .notif-drag-handle:active {
        cursor: grabbing;
    }
}

/* Backdrop fade for notification panel */
#nav-notif-backdrop {
    transition: opacity 0.22s ease;
}

/* Drag handle: mobile-only; close X: desktop-only (Tailwind + backup vs utility order) */
@media (min-width: 768px) {
    #nav-notif-panel .notif-drag-handle {
        display: none !important;
    }
    #nav-notif-panel #nav-notif-close {
        display: flex !important;
    }
}

/* Signup: profile photo drop zone hover while dragging files */
.signup-avatar-dz.signup-avatar-dz--active {
    border-style: solid !important;
    border-color: #c96b52;
    background-color: rgba(254, 247, 244, 0.92);
    transform: scale(1.02);
    box-shadow: 0 14px 32px -14px rgba(201, 107, 82, 0.22);
}
.dark .signup-avatar-dz.signup-avatar-dz--active {
    border-color: #ee9272;
    background-color: rgba(138, 67, 55, 0.22);
    box-shadow: 0 14px 32px -14px rgba(238, 146, 114, 0.18);
}

/* Signup avatar crop overlay */
.signup-crop-viewport {
    cursor: grab;
}

.signup-crop-viewport .signup-crop-source-img {
    user-select: none;
    -webkit-user-drag: none;
}

.signup-crop-viewport--grabbing {
    cursor: grabbing;
}

.signup-crop-viewport:active {
    cursor: grabbing;
}

.signup-crop-zoom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    background: #c96b52;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(42, 18, 8, 0.2);
}

.signup-crop-zoom-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    background: #c96b52;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(42, 18, 8, 0.2);
}

.dark .signup-crop-zoom-range::-webkit-slider-thumb {
    background: #ee9272;
    border-color: #1e1714;
}

.dark .signup-crop-zoom-range::-moz-range-thumb {
    background: #ee9272;
    border-color: #1e1714;
}

/* ── Webinar live room ─────────────────────────────────────────────────── */
.z-choice-pill {
    display: flex;
    min-height: 42px;
    cursor: pointer;
    align-items: center;
    gap: 0.6rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(216, 207, 201, 0.9);
    background: rgba(255, 255, 255, 0.78);
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 800;
    color: #4e423c;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.z-choice-pill:hover {
    transform: translateY(-1px);
    border-color: rgba(201, 107, 82, 0.55);
    box-shadow: 0 12px 28px rgba(61, 26, 20, 0.08);
}

.z-choice-pill input {
    accent-color: #c96b52;
}

.z-choice-pill:has(input:checked) {
    border-color: rgba(201, 107, 82, 0.75);
    background: linear-gradient(135deg, rgba(254, 247, 244, 0.98), rgba(253, 229, 232, 0.92));
    color: #6e352c;
    box-shadow: 0 12px 28px rgba(201, 107, 82, 0.14);
}

.dark .z-choice-pill {
    border-color: rgba(101, 86, 80, 0.75);
    background: rgba(30, 23, 20, 0.72);
    color: #ece7e3;
}

.dark .z-choice-pill:has(input:checked) {
    border-color: rgba(238, 146, 114, 0.65);
    background: linear-gradient(135deg, rgba(110, 53, 44, 0.42), rgba(112, 28, 48, 0.35));
    color: #fff3ea;
}

.z-live-shell {
    display: grid;
    gap: 1rem;
}

.z-live-hero {
    position: relative;
    overflow: hidden;
    border-radius: 1.35rem;
    background:
        radial-gradient(circle at 88% 16%, rgba(255, 212, 0, 0.26), transparent 25%),
        radial-gradient(circle at 12% 18%, rgba(240, 116, 134, 0.32), transparent 30%),
        linear-gradient(135deg, #8a4337, #c96b52 52%, #a32844);
    padding: clamp(1.1rem, 3vw, 1.8rem);
    box-shadow: 0 22px 50px rgba(61, 26, 20, 0.18);
}

.z-live-orbit {
    position: absolute;
    inset: auto 1.2rem 1rem auto;
    width: 6rem;
    height: 6rem;
    opacity: 0.88;
}

.z-live-orbit span {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    animation: live-orbit 3.2s linear infinite;
}

.z-live-orbit span:nth-child(2) {
    inset: 1.15rem;
    animation-duration: 2.4s;
    animation-direction: reverse;
}

.z-live-orbit span:nth-child(3) {
    inset: 2.25rem;
    background: rgba(255, 255, 255, 0.22);
    border: 0;
    animation: live-pulse 1.6s ease-in-out infinite;
}

.z-live-stage-card {
    position: relative;
    min-height: min(72vh, 680px);
    overflow: hidden;
    border-radius: 1.25rem;
    border: 1px solid rgba(216, 207, 201, 0.78);
    background: #110d0b;
    box-shadow: 0 22px 48px rgba(17, 13, 11, 0.22);
}

.z-live-stage-card rtk-meeting {
    display: block;
    height: min(72vh, 680px);
    min-height: 520px;
}

.z-live-loader,
.z-live-empty {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.8rem;
    padding: 1.5rem;
    text-align: center;
    background:
        radial-gradient(circle at 50% 38%, rgba(238, 146, 114, 0.34), transparent 19%),
        radial-gradient(circle at 38% 62%, rgba(255, 212, 0, 0.14), transparent 18%),
        rgba(17, 13, 11, 0.86);
    color: #fffaf6;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.z-live-empty {
    position: relative;
    min-height: 300px;
    border-radius: 1.25rem;
    border: 1px solid rgba(216, 207, 201, 0.78);
    background:
        radial-gradient(circle at 50% 35%, rgba(238, 146, 114, 0.24), transparent 25%),
        linear-gradient(135deg, #1e1714, #342b27);
}

.z-live-empty h2 {
    font-size: 1rem;
    font-weight: 900;
}

.z-live-empty p {
    max-width: 32rem;
    color: rgba(255, 250, 246, 0.7);
    font-size: 0.9rem;
    line-height: 1.5;
}

.z-live-loader.is-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.z-live-spinner {
    width: 4.6rem;
    height: 4.6rem;
    border-radius: 9999px;
    border: 4px solid rgba(255, 255, 255, 0.18);
    border-top-color: #f7a3af;
    border-right-color: #ffd400;
    animation: live-spin 0.9s linear infinite;
    box-shadow: 0 0 40px rgba(240, 116, 134, 0.35);
}

.z-live-loader p {
    font-size: 0.85rem;
    font-weight: 900;
    color: rgba(255, 250, 246, 0.78);
}

.z-live-record-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(216, 207, 201, 0.9);
    background: rgba(255, 255, 255, 0.78);
    padding: 0.7rem 1rem;
    font-size: 0.84rem;
    font-weight: 900;
    color: #4e423c;
    transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.z-live-record-btn:hover {
    transform: translateY(-1px);
    background: #fffaf6;
}

.z-live-record-btn.is-recording {
    border-color: rgba(196, 53, 84, 0.55);
    background: rgba(254, 244, 245, 0.94);
    color: #a32844;
}

.z-live-record-btn:disabled {
    cursor: wait;
    opacity: 0.62;
    transform: none;
}

.dark .z-live-record-btn {
    border-color: rgba(101, 86, 80, 0.75);
    background: rgba(30, 23, 20, 0.72);
    color: #fff3ea;
}

@keyframes live-spin {
    to { transform: rotate(360deg); }
}

@keyframes live-pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.4; }
    50% { transform: scale(1.12); opacity: 1; }
}

@keyframes live-orbit {
    to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    .z-live-stage-card {
        min-height: 72vh;
        border-radius: 1rem;
    }

    .z-live-stage-card rtk-meeting {
        height: 72vh;
        min-height: 520px;
    }

    .z-live-orbit {
        width: 4.5rem;
        height: 4.5rem;
        opacity: 0.55;
    }
}
