/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    background-color: #0f0f0f;
    color: #f1f1f1;
    min-height: 100vh;
}

/* Top Navigation Bar */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: 56px;
    background-color: #0f0f0f;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid #2a2a2a;
}

/* Left Section */
.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 8px;
}

.hamburger {
    width: 24px;
    height: 2px;
    background-color: #f1f1f1;
    border-radius: 2px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.logo-icon {
    width: 32px;
    height: 24px;
    background: linear-gradient(135deg, #ff0000, #cc0000);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.logo-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Center Section */
.nav-center {
    flex: 1;
    max-width: 640px;
    display: flex;
    justify-content: center;
}

.search-container {
    display: flex;
    width: 100%;
    max-width: 580px;
}

.search-input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    background-color: #121212;
    border: 1px solid #303030;
    border-radius: 40px 0 0 40px;
    color: #f1f1f1;
    font-size: 16px;
}

.search-input:focus {
    outline: none;
    border-color: #3ea6ff;
}

.search-input::placeholder {
    color: #888;
}

.search-btn {
    width: 64px;
    height: 40px;
    background-color: #222;
    border: 1px solid #303030;
    border-left: none;
    border-radius: 0 40px 40px 0;
    cursor: pointer;
    font-size: 16px;
}

.search-btn:hover {
    background-color: #333;
}

/* Right Section */
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: #272727;
}

.btn-icon {
    font-size: 20px;
}

/* --- CREATE BUTTON STYLES (UPDATED) --- */
.create-btn {
    width: auto;
    padding: 0 12px;
    border-radius: 20px;
    gap: 8px;
    /* Always show a subtle "active" background to indicate it's interactive */
    background-color: #272727; 
    transition: all 0.2s ease;
}

/* Force Create Button Text and Icon to White */
.create-btn .btn-text,
.create-btn .btn-icon {
    color: #ffffff !important;
}

/* Special Hover Effect: Brighter background + slight scale up */
.create-btn:hover {
    background-color: #3a3a3a;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Active click effect */
.create-btn:active {
    transform: scale(0.98);
}

/* --------------------------------------- */

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background-color: #cc0000;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f0f0f;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3ea6ff, #0066cc);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

/* Dropdown Styles */
.dropdown {
    position: absolute;
    top: 56px;
    right: 0;
    background-color: #272727;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    min-width: 280px;
    display: none;
    z-index: 1001;
}

.dropdown.active {
    display: block;
}

/* ADD SPACING TO RIGHT-SIDE DROPDOWNS */
.create-dropdown {
    right: 8px;
    min-width: 240px;
}

.notification-dropdown {
    right: 8px;
    min-width: 360px;
}

/* PROFILE DROPDOWN - NO SCROLLING, ALL ITEMS VISIBLE */
.profile-dropdown {
    right: 8px;
    min-width: 320px;
    max-height: none !important;
    overflow-y: visible !important;
    padding: 8px 0;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #3a3a3a;
}

.header-text {
    font-size: 16px;
    font-weight: 500;
}

.settings-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 50%;
}

.settings-link:hover {
    background-color: #3a3a3a;
}

.dropdown-divider {
    height: 1px;
    background-color: #3a3a3a;
    margin: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #3a3a3a;
}

.item-icon {
    font-size: 18px;
    width: 24px;
}

.item-text {
    font-size: 14px;
}

/* Notification Items */
.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.notification-item:hover {
    background-color: #3a3a3a;
}

.channel-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-time {
    font-size: 12px;
    color: #aaa;
}

.notification-thumbnail {
    width: 120px;
    height: 68px;
    border-radius: 8px;
    background: linear-gradient(135deg, #333, #444);
    flex-shrink: 0;
    position: relative;
}

.notification-menu {
    position: absolute;
    top: 8px;
    right: 8px;
}

.menu-trigger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    color: #aaa;
}

.menu-trigger:hover {
    background-color: #3a3a3a;
}

.menu-options {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #272727;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    min-width: 200px;
    display: none;
    z-index: 1002;
}

.menu-options.active {
    display: block;
}

.menu-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
}

.menu-option:hover {
    background-color: #3a3a3a;
}

/* Sidebar Styles */
.sidebar {
    width: 240px;
    background-color: #0f0f0f;
    padding: 12px 0;
    transition: transform 0.3s ease;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 999;
}

.sidebar.collapsed {
    transform: translateX(-240px);
}

.sidebar-content {
    padding: 0 12px;
}

.sidebar-section {
    margin-bottom: 12px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    color: #aaa;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-header:hover {
    background-color: #272727;
    border-radius: 8px;
}

.section-title {
    font-weight: 500;
}

.expand-icon {
    font-size: 12px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 12px;
    color: #f1f1f1;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s;
    font-size: 14px;
}

.sidebar-item:hover {
    background-color: #272727;
}

.sidebar-item.active {
    background-color: #272727;
    font-weight: 500;
}

.sidebar-item .item-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-item .channel-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.sidebar-divider {
    height: 1px;
    background-color: #2a2a2a;
    margin: 12px 0;
}

/* UPDATED: Default to BLOCK so menus are open by default */
.sidebar-submenu {
    display: block; 
    margin-top: 4px;
}

/* Class to hide if toggled closed */
.sidebar-submenu.hidden {
    display: none;
}

/* Main Content */
.main-content {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

.content-area {
    flex: 1;
    padding: 24px;
    background-color: #0f0f0f;
    margin-left: 240px;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .content-area {
    margin-left: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-center {
        display: none;
    }
    
    .create-btn .btn-text {
        display: none;
    }
    
    .create-btn {
        width: 40px;
        height: 40px;
        padding: 0;
    }
    
    .sidebar {
        transform: translateX(-240px);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .content-area {
        margin-left: 0;
    }
}
/* ===== Watch Later content area ===== */
.content-area {
    --wl-text: #f1f1f1;
    --wl-muted: #aaa;
    --wl-surface: #272727;
    --wl-surface-hover: #3f3f3f;
    --wl-border: #303030;
    --wl-accent: #3ea6ff;
    --wl-clock: #3ea6ff;
    --wl-danger: #ff4e45;
    --wl-progress: #f00;
    max-width: none;
    padding: 24px 24px 96px;
}

.wl-page {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    color: var(--wl-text);
}

.wl-page button,
.wl-page select,
.wl-page input {
    font: inherit;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Header */
.wl-header {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 20px;
    align-items: start;
    margin-bottom: 28px;
}

.wl-header-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #5eb3ff 0%, #3ea6ff 45%, #1a73e8 100%);
    box-shadow: 0 8px 24px rgba(62, 166, 255, 0.35);
}

.wl-title {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.wl-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--wl-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

.wl-dot { opacity: 0.6; }

.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--wl-surface);
    color: var(--wl-text);
    font-size: 12px;
    font-weight: 500;
    cursor: default;
}

.wl-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.wl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 16px;
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s, opacity 0.15s;
}

.wl-btn-primary {
    background: #fff;
    color: #0f0f0f;
}

.wl-btn-primary:hover { background: #e5e5e5; }

.wl-btn-secondary {
    background: var(--wl-surface);
    color: var(--wl-text);
}

.wl-btn-secondary:hover { background: var(--wl-surface-hover); }

.wl-btn-danger {
    background: var(--wl-danger);
    color: #fff;
}

.wl-btn-danger:hover { filter: brightness(1.08); }

.wl-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: var(--wl-surface);
}

.wl-btn-icon:hover:not(:disabled) { background: var(--wl-surface-hover); }

.wl-btn-icon:disabled,
.wl-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.wl-menu-wrap { position: relative; }

.wl-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    padding: 8px 0;
    border-radius: 12px;
    background: #282828;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.wl-dropdown[hidden] { display: none; }

.wl-dropdown button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    background: none;
    color: var(--wl-text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.wl-dropdown button:hover { background: var(--wl-surface-hover); }

.menu-hint {
    color: var(--wl-muted);
    font-size: 12px;
}

.wl-view-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    background: var(--wl-surface);
}

.view-toggle-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--wl-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.view-toggle-btn.active,
.view-toggle-btn[aria-pressed="true"] {
    background: var(--wl-surface-hover);
    color: var(--wl-text);
}

/* Controls */
.wl-controls {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--wl-border);
}

.sort-row,
.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}

.sort-row { margin-bottom: 12px; }

.sort-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--wl-muted);
    font-size: 14px;
}

.wl-select,
.wl-date {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--wl-border);
    border-radius: 8px;
    background: #121212;
    color: var(--wl-text);
    font-size: 13px;
}

.wl-select:focus,
.wl-date:focus {
    outline: 2px solid var(--wl-accent);
    outline-offset: 1px;
}

.shorts-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    color: var(--wl-muted);
    font-size: 13px;
    cursor: pointer;
}

.clear-filters-pill {
    padding: 6px 12px;
    border: 0;
    border-radius: 16px;
    background: rgba(62, 166, 255, 0.18);
    color: var(--wl-accent);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.clear-filters-pill:hover { background: rgba(62, 166, 255, 0.28); }

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    padding: 6px 12px;
    border: 0;
    border-radius: 16px;
    background: var(--wl-surface);
    color: var(--wl-text);
    font-size: 13px;
    cursor: pointer;
}

.filter-chip:hover { background: var(--wl-surface-hover); }

.filter-chip.active {
    background: #fff;
    color: #0f0f0f;
}

.date-range {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.date-sep { color: var(--wl-muted); }

.filter-counter {
    margin: 12px 0 0;
    color: var(--wl-muted);
    font-size: 13px;
}

/* Shorts shelf */
.wl-shorts-shelf {
    margin-bottom: 28px;
}

.shorts-shelf-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 12px;
}

.shorts-shelf-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.shorts-shelf-sub {
    margin: 4px 0 0;
    color: var(--wl-muted);
    font-size: 13px;
}

.see-all-shorts {
    border: 0;
    background: none;
    color: var(--wl-accent);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.shorts-shelf-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
}

.shorts-shelf-track.expanded {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    overflow: visible;
}

.wl-short-card {
    flex: 0 0 120px;
    width: 120px;
    scroll-snap-align: start;
    position: relative;
}

.wl-short-card .short-thumb {
    position: relative;
    display: block;
    width: 120px;
    height: 213px;
    border-radius: 12px;
    overflow: hidden;
    background: #222;
}

.wl-short-card .short-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wl-short-card .short-meta {
    margin-top: 8px;
}

.wl-short-card .channel-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.wl-short-card .channel-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: #444;
}

.wl-short-card .short-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--wl-text);
    text-decoration: none;
}

.wl-short-card .short-stats {
    margin-top: 4px;
    color: var(--wl-muted);
    font-size: 12px;
}

.wl-short-card .unlike-short {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: var(--wl-accent);
    cursor: pointer;
    display: grid;
    place-items: center;
}

/* List / Grid */
.wl-list {
    display: flex;
    flex-direction: column;
}

.wl-video-row {
    display: grid;
    grid-template-columns: 28px 24px 24px 160px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 10px 8px;
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: background-color 0.15s, opacity 0.2s, transform 0.25s;
}

.wl-video-row:hover,
.wl-video-row:focus-within {
    background: rgba(255, 255, 255, 0.05);
}

.wl-video-row.recent-add {
    border-left-color: var(--wl-accent);
}

.wl-video-row.just-added {
    animation: wlPulse 1.2s ease;
}

@keyframes wlPulse {
    0% { background: rgba(62, 166, 255, 0.28); }
    100% { background: transparent; }
}

.wl-video-row.removing {
    opacity: 0;
    transform: translateX(40px);
}

.wl-video-row .row-index {
    color: var(--wl-muted);
    font-size: 13px;
    padding-top: 34px;
    text-align: center;
}

.wl-video-row .row-check {
    margin-top: 34px;
    opacity: 0;
    transition: opacity 0.15s;
}

.wl-video-row:hover .row-check,
.wl-page.selecting .row-check,
.wl-video-row .row-check:checked,
.wl-video-row .row-check:focus {
    opacity: 1;
}

.wl-video-row .row-check {
    width: 18px;
    height: 18px;
    accent-color: var(--wl-accent);
    cursor: pointer;
}

.row-thumb {
    position: relative;
    display: block;
    width: 160px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #222;
    text-decoration: none;
}

.row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.row-thumb .duration-badge {
    position: absolute;
    right: 4px;
    bottom: 4px;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
}

.row-thumb .watch-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.25);
}

.row-thumb .watch-progress::after {
    content: "";
    display: block;
    height: 100%;
    width: var(--progress, 0%);
    background: var(--wl-progress);
}

.row-thumb.unavailable {
    filter: grayscale(1);
    opacity: 0.65;
}

.row-thumb .unavailable-stamp {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.row-body { min-width: 0; }

.row-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 6px;
    color: var(--wl-text);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    text-decoration: none;
}

.row-title:hover { color: #fff; }

.row-channel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    color: var(--wl-muted);
    font-size: 13px;
    text-decoration: none;
}

.row-channel:hover { color: var(--wl-text); }

.row-channel img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: #444;
}

.verified-badge {
    display: inline-grid;
    place-items: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--wl-muted);
    color: #0f0f0f;
    font-size: 9px;
    font-weight: 700;
}

.row-meta,
.row-liked {
    margin: 0;
    color: var(--wl-muted);
    font-size: 13px;
}

.row-liked { margin-top: 2px; }

.row-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.wl-video-row:hover .row-actions,
.wl-video-row:focus-within .row-actions {
    opacity: 1;
}

.row-action-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--wl-text);
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
}

.row-action-btn:hover { background: var(--wl-surface); }

.row-action-btn.unlike-btn { color: var(--wl-accent); }

.row-more-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    padding: 8px 0;
    border-radius: 12px;
    background: #282828;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    z-index: 30;
}

.row-more-menu[hidden] { display: none; }

.row-more-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    background: none;
    color: var(--wl-text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.row-more-menu button:hover { background: var(--wl-surface-hover); }

/* Grid cards */
.wl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px 12px;
}

.wl-grid-card {
    position: relative;
    border-radius: 8px;
}

.wl-grid-card .card-thumb-wrap {
    position: relative;
    margin-bottom: 10px;
}

.wl-grid-card .card-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #222;
}

.wl-grid-card .card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wl-grid-card .wl-saved-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: var(--wl-accent);
    display: grid;
    place-items: center;
}

.wl-grid-card .card-body {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    align-items: start;
}

.wl-grid-card .card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #444;
}

.wl-grid-card .card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 4px;
    color: var(--wl-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.wl-grid-card .card-channel,
.wl-grid-card .card-meta {
    margin: 0;
    color: var(--wl-muted);
    font-size: 13px;
}

.wl-grid-card .card-channel {
    text-decoration: none;
}

.wl-grid-card .card-channel:hover { color: var(--wl-text); }

/* Loading / empty */
.skeleton-row {
    height: 94px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: linear-gradient(90deg, #1a1a1a 25%, #242424 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.load-more-error,
.end-of-list {
    text-align: center;
    color: var(--wl-muted);
    font-size: 14px;
    padding: 24px 0;
}

.load-more-error button {
    border: 0;
    background: none;
    color: var(--wl-accent);
    cursor: pointer;
    font-weight: 500;
}

.wl-empty {
    text-align: center;
    padding: 64px 24px;
}

.wl-empty .empty-icon {
    color: var(--wl-muted);
    opacity: 0.5;
    margin-bottom: 20px;
}

.wl-empty h2 {
    margin: 0 0 8px;
    font-size: 22px;
}

.wl-empty p {
    margin: 0 auto 20px;
    max-width: 420px;
    color: var(--wl-muted);
    font-size: 14px;
    line-height: 1.5;
}

.empty-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Selection bar */
.selection-bar {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #282828;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    z-index: 50;
}

.selection-bar[hidden] { display: none; }

.selection-bar #selectionCount {
    font-size: 14px;
    font-weight: 500;
    min-width: 90px;
}

/* Modals */
.wl-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.65);
    padding: 24px;
}

.wl-modal[hidden] { display: none; }

.wl-modal-card {
    width: min(440px, 100%);
    padding: 24px;
    border-radius: 16px;
    background: #212121;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.wl-modal-wide { width: min(640px, 100%); }

.wl-modal-card h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.wl-modal-card p,
.modal-desc {
    margin: 0 0 20px;
    color: var(--wl-muted);
    font-size: 14px;
    line-height: 1.45;
}

.modal-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--wl-text);
    font-size: 22px;
    cursor: pointer;
}

.modal-close:hover { background: var(--wl-surface); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.duplicates-list {
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dup-group {
    padding: 12px;
    border-radius: 10px;
    background: #181818;
}

.dup-group h3 {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--wl-muted);
    font-weight: 500;
}

.dup-item {
    display: grid;
    grid-template-columns: auto 80px 1fr;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
}

.dup-item + .dup-item { border-top: 1px solid var(--wl-border); }

.dup-item img {
    width: 80px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
    background: #333;
}

.dup-item strong {
    display: block;
    font-size: 13px;
    font-weight: 500;
}

.dup-item span {
    color: var(--wl-muted);
    font-size: 12px;
}

.export-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 16px;
    border: 3px solid var(--wl-border);
    border-top-color: var(--wl-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.export-spinner[hidden] { display: none; }

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

/* Toast */
.wl-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 280px;
    max-width: min(520px, calc(100vw - 32px));
    padding: 14px 18px;
    border-radius: 8px;
    background: #323232;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1300;
}

.wl-toast[hidden] { display: none; }

.wl-toast .toast-undo {
    border: 0;
    background: none;
    color: var(--wl-accent);
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.02em;
}

@media (prefers-reduced-motion: reduce) {
    .wl-video-row.removing {
        transform: none;
        transition: opacity 0.01s;
    }
    .wl-video-row.just-added { animation: none; }
    .skeleton-row { animation: none; }
}

/* Responsive */
@media (max-width: 1024px) {
    .wl-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .wl-header {
        grid-template-columns: 64px 1fr;
    }

    .wl-header-icon {
        width: 64px;
        height: 64px;
    }

    .wl-header-icon svg {
        width: 36px;
        height: 36px;
    }

    .wl-view-toggle {
        grid-column: 1 / -1;
        justify-self: end;
    }

    .wl-video-row {
        grid-template-columns: 22px 20px 20px 140px minmax(0, 1fr);
    }

    .row-actions {
        grid-column: 3 / -1;
        justify-content: flex-end;
        opacity: 1;
    }

    .wl-video-row .row-index { padding-top: 28px; }
    .wl-video-row .row-check { margin-top: 28px; }
}

@media (max-width: 640px) {
    .content-area { padding: 16px 12px 96px; }

    .wl-header {
        grid-template-columns: 56px 1fr;
        gap: 12px;
    }

    .wl-title { font-size: 22px; }

    .wl-video-row {
        grid-template-columns: 18px 1fr;
        gap: 8px;
    }

    .wl-video-row .row-index,
    .wl-video-row .row-check { display: none; }

    .row-thumb {
        width: 100%;
        max-width: none;
        grid-column: 1 / -1;
    }

    .row-body { grid-column: 1 / -1; }

    .row-actions {
        grid-column: 1 / -1;
        opacity: 1;
    }

    .wl-grid {
        grid-template-columns: 1fr;
    }

    .shorts-toggle { margin-left: 0; width: 100%; }

    .selection-bar {
        left: 12px;
        right: 12px;
        transform: none;
        flex-wrap: wrap;
    }
}

/* ===== Watch Later–specific additions ===== */
.wl-capacity-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(62, 166, 255, 0.12);
    border: 1px solid rgba(62, 166, 255, 0.35);
    color: var(--wl-text);
    font-size: 13px;
}
.wl-capacity-banner[hidden] { display: none; }

.wl-return-manual {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 0;
    border-radius: 16px;
    background: rgba(62, 166, 255, 0.18);
    color: var(--wl-accent);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.wl-return-manual:hover { background: rgba(62, 166, 255, 0.28); }
.wl-return-manual[hidden] { display: none; }

.wl-auto-remove-tip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
    padding: 4px 10px;
    border: 0;
    border-radius: 14px;
    background: var(--wl-surface);
    color: var(--wl-muted);
    font-size: 12px;
    cursor: pointer;
}
.wl-auto-remove-tip:hover { background: var(--wl-surface-hover); color: var(--wl-text); }
.wl-auto-remove-tip[aria-pressed="true"] {
    color: var(--wl-accent);
    background: rgba(62, 166, 255, 0.15);
}

.row-drag {
    opacity: 0;
    margin-top: 34px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--wl-muted);
    cursor: grab;
    display: grid;
    place-items: center;
    transition: opacity 0.15s;
    padding: 0;
}
.wl-video-row:hover .row-drag,
.wl-video-row:focus-within .row-drag,
.row-drag:focus {
    opacity: 1;
}
.wl-page.non-manual .row-drag { display: none; }
.row-drag:active { cursor: grabbing; }
.wl-video-row.dragging {
    opacity: 0.45;
}
.wl-drop-indicator {
    height: 3px;
    margin: 0 8px;
    border-radius: 2px;
    background: var(--wl-accent);
    box-shadow: 0 0 0 1px rgba(62, 166, 255, 0.35);
}
.wl-drop-indicator[hidden] { display: none; }

.row-action-btn.remove-btn { color: var(--wl-muted); }
.row-action-btn.remove-btn:hover { color: var(--wl-danger); }
.row-action-btn.watched-btn[aria-pressed="true"] { color: var(--wl-accent); }

.wl-grid-card .card-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    display: grid;
    place-items: center;
    z-index: 2;
    font-size: 18px;
    line-height: 1;
}
.wl-grid-card:hover .card-remove,
.wl-grid-card:focus-within .card-remove { opacity: 1; }

.row-saved { margin: 0; color: var(--wl-muted); font-size: 13px; margin-top: 2px; }

.wl-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
}

@media (prefers-reduced-motion: reduce) {
    .wl-video-row.just-added { animation: none; }
}

.wl-modal-card.wl-sheet-card {
    width: min(480px, 100%);
    max-width: min(480px, 100%);
    max-height: min(88vh, 720px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.wl-sheet-card {
    width: min(480px, 100%);
    max-height: min(88vh, 720px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(62, 166, 255, 0.16), transparent 44%),
        radial-gradient(90% 70% at 100% 0%, rgba(255, 193, 7, 0.08), transparent 40%),
        #1c1c1c;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: wl-sheet-in .22s cubic-bezier(.2, .8, .2, 1);
}

@keyframes wl-sheet-in {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.wl-sheet-card .sheet-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 14px;
}

.wl-sheet-card .sheet-card-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.wl-sheet-card .sheet-card-icon {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    color: #ffe082;
    background: linear-gradient(160deg, rgba(255, 193, 7, 0.28), rgba(255, 193, 7, 0.08));
    border: 1px solid rgba(255, 193, 7, 0.28);
    font-size: 20px;
    font-weight: 700;
}

.wl-sheet-card .sheet-card-title h2 {
    margin: 0 0 4px;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.wl-sheet-card .sheet-card-title p,
.wl-sheet-card .modal-desc {
    margin: 0;
    color: var(--wl-muted);
    font-size: 13px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.wl-sheet-card .sheet-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    color: inherit;
    background: rgba(255, 255, 255, 0.04);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.wl-sheet-card .sheet-close:hover { background: rgba(255, 255, 255, 0.1); }

.wl-sheet-card .sheet-card-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0 20px 12px;
    scrollbar-width: thin;
}

.wl-sheet-card .sheet-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.22));
}

.wl-sheet-card .sheet-footer-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.wl-save-playlist-list {
    display: grid;
    gap: 8px;
    max-height: min(38vh, 280px);
    overflow: auto;
    margin: 0 0 12px;
    scrollbar-width: thin;
}

.wl-save-option {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.025);
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.wl-save-option:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

.wl-save-option:has(input:checked) {
    border-color: rgba(62, 166, 255, 0.5);
    background: linear-gradient(135deg, rgba(62, 166, 255, 0.14), rgba(62, 166, 255, 0.05));
}

.wl-save-option input {
    width: 18px;
    height: 18px;
    accent-color: #3ea6ff;
}

.wl-save-option strong { display: block; font-size: 14px; }
.wl-save-option small { color: var(--wl-muted); font-size: 12px; }

.create-playlist-inline {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 14px;
    border: 1px solid rgba(62, 166, 255, 0.22);
    border-radius: 14px;
    background:
        linear-gradient(160deg, rgba(62, 166, 255, 0.1), transparent 50%),
        rgba(255, 255, 255, 0.03);
}

.create-playlist-inline-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #cfe8ff;
}

.create-playlist-inline .create-playlist-field {
    display: grid;
    gap: 7px;
}

.create-playlist-inline .create-playlist-field > span {
    font-size: 12px;
    color: var(--wl-muted);
    font-weight: 600;
}

.create-playlist-inline input,
.create-playlist-inline select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.28);
    color: inherit;
    font: inherit;
}

.create-playlist-inline input:focus,
.create-playlist-inline select:focus {
    outline: none;
    border-color: rgba(62, 166, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(62, 166, 255, 0.18);
}

.create-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
