/* ===== Brainspark Theme ===== */
:root {
    --bg: #0f0f12;
    --bg-elevated: #18181f;
    --bg-card: #1e1e28;
    --bg-hover: #2a2a38;
    --border: #2e2e3a;
    --text: #f0f0f5;
    --text-muted: #9a9aab;
    --radius: 12px;
    --radius-sm: 0.2rem;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --sidebar-width: 260px;
    --header-height: 64px;
    --theme-color: #6366f1;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--theme-color); text-decoration: none; }
a:hover { color: var(--theme-color-dark, #818cf8); }

/* ===== App Layout ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text) !important;
}

.logo.logo-only {
    height: 30px;
    overflow: hidden;
    overflow: hidden;
    flex-shrink: 0;
}

.logo.logo-only > img {
    height: 100%;
}

.logo i {
    color: var(--theme-color);
    font-size: 1.75rem;
}

.logo-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
}

.sidebar-brand {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-brand-name {
    display: block;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    color: var(--text) !important;
    text-align: left;
}

.sidebar-brand-name:hover {
    color: var(--theme-color) !important;
}

.btn-close-sidebar {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.nav-label-row .nav-label { margin-bottom: 0; }

.nav-add {
    color: var(--text-muted);
    font-size: 1rem;
    padding: 0.2rem;
}
.nav-add:hover { color: var(--theme-color); }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted) !important;
    font-weight: 500;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text) !important;
}

.nav-item.active {
    background: var(--theme-color-soft, rgba(99,102,241,0.15));
    color: var(--theme-color) !important;
}

.nav-item i { font-size: 1.15rem; width: 1.25rem; text-align: center; }

.nav-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    height: var(--header-height);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr minmax(200px, 480px) 1fr;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.btn-menu {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    justify-self: start;
}

.header-center {
    display: flex;
    justify-content: center;
    width: 100%;
}

.search-bar {
    width: 100%;
    max-width: 480px;
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}

.search-bar input:focus {
    border-color: var(--theme-color);
}

.search-bar input::placeholder { color: var(--text-muted); }

.header-actions {
    justify-self: end;
    display: flex;
    align-items: center;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.user-btn:hover { background: var(--bg-hover); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
}

.user-name { font-weight: 500; font-size: 0.9rem; }

.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.5rem;
    min-width: 180px;
}

.dropdown-item {
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover, .dropdown-item:focus {
    background: var(--bg-hover);
    color: var(--text);
}

.dropdown-divider { border-color: var(--border); }

.page-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ===== Alerts ===== */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Login Page ===== */
.login-page {
    min-height: calc(100vh - var(--header-height) - 3rem);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0 auto;
}

.login-card .form-label {
    text-align: left;
    display: block;
    width: 100%;
}

.login-card form {
    text-align: left;
}

.login-card .btn {
    text-align: center;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-card .logo-lg {
    font-size: 2.5rem;
    color: var(--theme-color);
    margin-bottom: 0.5rem;
}

.login-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

.form-control {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.7rem 1rem;
}

.form-control:focus {
    background: var(--bg);
    border-color: var(--theme-color);
    color: var(--text);
    box-shadow: 0 0 0 3px var(--theme-color-soft, rgba(99,102,241,0.2));
}

.form-control::placeholder { color: var(--text-muted); }

.btn-primary {
    background: var(--theme-color);
    border-color: var(--theme-color);
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.25rem 0.5rem;
}

.btn-primary:hover {
    background: var(--theme-color-dark, #4f46e5);
    border-color: var(--theme-color-dark, #4f46e5);
}

.btn-outline-light {
    border-color: var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
}

.btn-outline-light:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text);
}

/* ===== Video Grid ===== */
.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.video-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.video-card:hover .video-thumb img {
    transform: scale(1.05);
}

.video-thumb .play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.video-card:hover .play-overlay { opacity: 1; }

.play-overlay i {
    font-size: 3rem;
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.video-info {
    padding: 0.9rem 1rem 1rem;
}

.video-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.35;
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
}

.video-channel {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.video-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.btn-sm-custom {
    font-size: 0.78rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.btn-add {
    background: var(--theme-color);
    color: #fff;
    border: none;
}
.btn-add:hover { background: var(--theme-color-dark, #4f46e5); color: #fff; }

.btn-saved {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: default;
}

.btn-danger-soft {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
}
.btn-danger-soft:hover { background: #ef4444; color: #fff; }

/* ===== Player Page ===== */
.player-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
}

@media (max-width: 992px) {
    .player-layout { grid-template-columns: 1fr; }
}

.player-main { min-width: 0; }

.video-player-wrap {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-player-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.player-meta {
    margin-top: 1rem;
}

.player-meta h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.player-meta .channel {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.player-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.channel-videos-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.channel-video-item {
    display: flex;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: background 0.15s;
}

.channel-video-item:hover { background: var(--bg-hover); }

.channel-video-item img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    flex-shrink: 0;
}

.channel-video-item .info {
    padding: 0.5rem 0.5rem 0.5rem 0;
    min-width: 0;
}

.channel-video-item .info .title {
    font-size: 0.85rem;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
}

/* ===== Search pages ===== */
.search-form-large {
    margin-bottom: 1.5rem;
}

.search-form-large .input-group {
    max-width: 560px;
}

.search-form-large .form-control {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.search-form-large .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: transform 0.2s;
}

.channel-card:hover { transform: translateY(-2px); }

.channel-card img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
}

.channel-card .info h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.channel-card .info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Favorites ===== */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.folder-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.folder-card:hover {
    transform: translateY(-2px);
    border-color: var(--theme-color);
}

.folder-card i {
    color: var(--theme-color);
    margin-bottom: 0.75rem;
}

.folder-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.folder-card .count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.create-folder-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.create-folder-form input {
    flex: 1;
    min-width: 180px;
}

/* ===== Profile ===== */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 480px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
}

.theme-swatches {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.theme-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s;
}

.theme-swatch:hover { transform: scale(1.1); }
.theme-swatch.active { border-color: #fff; }

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 0.5rem;
}

/* ===== Mobile ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.open {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .top-header {
        grid-template-columns: auto 1fr auto;
    }
    .page-content {
        padding: 1rem;
    }
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.85rem;
    }
    .video-info { padding: 0.65rem; }
    .video-title { font-size: 0.85rem; }
}

/* Fullscreen player support */
.video-player-wrap:fullscreen,
.video-player-wrap:-webkit-full-screen {
    border-radius: 0;
    aspect-ratio: auto;
}


.btn-fav {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-fav:hover {
    border-color: #ec4899;
    color: #ec4899;
}
.btn-fav.is-fav {
    border-color: #ec4899;
    color: #ec4899;
}

/* ===== Pagination ===== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
    padding: 1rem 0;
    flex-wrap: wrap;
}

.pagination-bar .page-indicator {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 6rem;
    text-align: center;
}

.pagination-bar .btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ===== Profile picture ===== */
.user-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-pic-wrap {
    display: flex;
    justify-content: flex-start;
}

.profile-pic {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}

.badge-admin {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--theme-color-soft, rgba(99,102,241,0.2));
    color: var(--theme-color);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 0.35rem;
}

.account-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
}

.account-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.account-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.account-avatar-fallback {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.account-name {
    font-weight: 600;
}

/* ===== Favorite modal ===== */
.fav-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
}

.fav-modal-content .modal-header {
    border-bottom-color: var(--border);
}

.fav-modal-content .modal-footer {
    border-top-color: var(--border);
}

.fav-modal-content .modal-title {
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fav-modal-content .modal-title i {
    color: #ec4899;
}

.fav-modal-video-title {
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fav-folder-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: min(50vh, 360px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.fav-folder-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.fav-folder-item:hover {
    background: var(--bg-hover);
    border-color: var(--theme-color);
}

.fav-folder-item.is-in-folder {
    border-color: #ec4899;
    background: color-mix(in srgb, #ec4899 12%, transparent);
}

.fav-folder-icon {
    color: var(--text-muted);
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.fav-folder-item.is-in-folder .fav-folder-icon {
    color: #ec4899;
}

.fav-folder-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fav-folder-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.fav-folder-item.is-in-folder .fav-folder-status {
    color: #ec4899;
}

/* ===== Profile stats ===== */
.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    color: var(--text) !important;
    transition: border-color 0.15s, background 0.15s;
}

.profile-stat:hover {
    border-color: var(--theme-color);
    background: var(--bg-hover);
}

.profile-stat i {
    color: var(--theme-color);
    font-size: 1.15rem;
}

.profile-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.profile-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== History table ===== */
.history-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.history-table {
    margin: 0;
    color: var(--text);
}

.history-table thead th {
    background: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.history-table td {
    border-color: var(--border);
    vertical-align: middle;
    font-size: 0.9rem;
}

.history-table a {
    color: var(--theme-color);
    font-weight: 500;
}

/* ===== Screen time settings ===== */
.screen-time-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-width: 560px;
}

.screen-time-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
}

.screen-time-day {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 600;
    min-width: 140px;
    cursor: pointer;
    margin: 0;
}

.screen-time-hours {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.screen-time-hours input[type="time"] {
    width: 8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

/* ===== Screen time blocked ===== */
.screen-time-blocked {
    min-height: calc(100vh - var(--header-height) - 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.screen-time-blocked-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow);
}

.blocked-icon {
    font-size: 3rem;
    color: var(--theme-color);
    margin-bottom: 0.75rem;
}

.screen-time-blocked-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.screen-time-blocked-card .lead {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.allowed-window {
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.allowed-window .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.allowed-window .times {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-color);
}

/* ===== Favorite folder row with edit ===== */
.nav-item-row {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    padding-right: 0.35rem;
}

.nav-item-row .nav-item {
    flex: 1;
    min-width: 0;
}

.nav-item-row .nav-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-edit {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.nav-item-row:hover .nav-edit,
.nav-edit:focus {
    opacity: 1;
}

.nav-edit:hover {
    color: var(--theme-color);
    background: var(--bg-hover);
}

.nav-edit i {
    font-size: 0.85rem;
}


/* ===== Light mode ===== */
html[data-bs-theme="light"] {
    color-scheme: light;
    --bg: #f4f4f7;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #ececf2;
    --border: #e0e0e8;
    --text: #1a1a22;
    --text-muted: #6b6b7a;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

html[data-bs-theme="light"] body {
    background: var(--bg);
    color: var(--text);
}

html[data-bs-theme="light"] .form-control {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

html[data-bs-theme="light"] .form-control:focus {
    background: #fff;
    color: var(--text);
}

html[data-bs-theme="light"] .dropdown-menu {
    background: var(--bg-elevated);
    border-color: var(--border);
}

html[data-bs-theme="light"] .dropdown-item {
    color: var(--text);
}

html[data-bs-theme="light"] .dropdown-item:hover,
html[data-bs-theme="light"] .dropdown-item:focus {
    background: var(--bg-hover);
    color: var(--text);
}

html[data-bs-theme="light"] .btn-outline-light {
    color: var(--text);
    border-color: var(--border);
}

html[data-bs-theme="light"] .btn-outline-light:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border);
}

html[data-bs-theme="light"] .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(0);
}

html[data-bs-theme="light"] .history-table thead th {
    background: var(--bg-hover);
}

html[data-bs-theme="light"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
}

/* Theme mode toggle on profile */
.theme-mode-toggle {
    display: inline-flex;
    gap: 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.theme-mode-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.15s, color 0.15s;
}

.theme-mode-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.theme-mode-btn.active {
    background: var(--theme-color);
    color: #fff;
}

