/* Whistler Design System */
:root {
    /* Base Colors - Deep Premium Dark */
    --bg-app: #050507;
    --bg-sidebar: #0f0f12;
    --bg-card: #141418;
    --bg-hover: #1f1f25;
    --bg-overlay: rgba(0, 0, 0, 0.4);
    /* Less opaque for glass effect */

    /* Text Colors */
    --text-primary: #ededef;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;

    /* Accents */
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.5);
    --accent-dim: rgba(99, 102, 241, 0.1);

    --border: #27272a;
    --border-light: #3f3f46;
    --glass-border: rgba(255, 255, 255, 0.08);

    /* Metrics */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --header-height: 64px;

    /* Animation */
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

#app {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Utilities */
.hidden {
    display: none !important;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font-family: inherit;
    transition: all 0.2s var(--ease-out);
}

/* --- Sidebar --- */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 24px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.brand-name {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.5px;
}

.project-context {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-hover));
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.3s var(--ease-out);
}

.project-switcher {
    margin-bottom: 24px;
    padding: 0 8px;
}

.context-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.project-select {
    width: 100%;
    appearance: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    padding-right: 32px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

/* Custom Dropdown v2 */
.custom-select {
    position: relative;
    font-size: 14px;
    font-weight: 500;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.custom-select-trigger:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.custom-select-trigger i {
    color: var(--text-muted);
    font-size: 14px;
    margin-left: 8px;
}

.custom-select-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
    max-height: 300px;
    overflow-y: auto;
}

.custom-select-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-secondary);
}

.custom-select-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.custom-select-item.selected {
    background: var(--accent-dim);
    color: var(--accent);
}

.custom-select-item.separator {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
    padding: 0;
    pointer-events: none;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    width: 100%;
    position: relative;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    cursor: pointer;
    /* overflow: hidden; Removed to fix animation cutoff */
}

.nav-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    transform: translateX(2px);
}

.nav-item.active {
    background-color: color-mix(in srgb, var(--item-color, var(--accent)) 10%, transparent);
    color: var(--item-color, var(--accent));
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 3px;
    background: var(--item-color, var(--accent));
    border-radius: 0 2px 2px 0;
    box-shadow: 2px 0 10px var(--item-color, var(--accent));
}

.nav-item i {
    font-size: 20px;
    transition: color 0.2s;
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 20px 0;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 12px;
    padding: 0 8px;
    letter-spacing: 0.05em;
}

.icon-btn-small {
    padding: 6px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: 0.2s;
}

.icon-btn-small:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.collections-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spacer {
    flex: 1;
}

/* PiP Sidebar */
.pip-container {
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s var(--ease-out);
    animation: slideUpFade 0.4s var(--ease-out);
}

.pip-container:hover {
    transform: translateY(-4px);
    border-color: var(--border-light);
}

.pip-header {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-hover);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pip-video-stage {
    aspect-ratio: 16/9;
    background: #000;
    position: relative;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.pip-video-stage video,
.pip-video-stage iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pip-controls {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px;
    background: var(--bg-card);
}

.pip-ctrl {
    font-size: 18px;
    color: var(--text-primary);
    opacity: 0.7;
    transition: 0.2s;
}

.pip-ctrl:hover {
    opacity: 1;
    transform: scale(1.2);
    color: var(--accent);
}

/* --- Main View --- */
/* Main Player Content Wrapper */
.player-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--bg-app);
}

.player-content:fullscreen {
    background: #000;
    width: 100vw;
    height: 100vh;
}

/* Fix sidebar color in fullscreen */
.player-content:fullscreen .player-sidebar {
    background: var(--bg-card);
    border-left: 1px solid var(--border);
}

.player-stage {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Prevent flex blowout */
    background: #000;
}

.main-view {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: radial-gradient(circle at top right, #131318 0%, var(--bg-app) 50%);
}

.view-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    height: 100%;
    animation: fadeIn 0.4s ease-out;
}

/* ========== PiP Container Styles ========== */
.pip-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 12px;
    display: flex;
    flex-direction: column;
}

.pip-video-stage {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
}

.pip-video-stage .video-wrapper,
.pip-video-stage video,
.pip-video-stage iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pip-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
    background: var(--bg-card);
}

.pip-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.pip-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pip-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
}

.pip-ctrl {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pip-ctrl:hover {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.view-header {
    height: 80px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(5, 5, 7, 0.6);
    backdrop-filter: blur(16px);
    flex-shrink: 0;
    z-index: 10;
}

.view-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 0%, #a1a1aa 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 16px;
}

.time-display {
    font-size: 13px;
    font-family: monospace;
    color: var(--text-secondary);
    min-width: 80px;
    text-align: right;
    cursor: pointer;
    user-select: none;
}

.time-display:hover {
    color: var(--text-primary);
}

.btn-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: 0.2s;
}

.btn-text:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #4338ca 100%);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 15px var(--accent-glow);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.quick-add-bar {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    gap: 10px;
    transition: 0.2s;
}

.quick-add-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.type-select {
    background: var(--bg-hover);
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 0 12px;
    cursor: pointer;
    transition: 0.2s;
}

.type-select:hover {
    color: var(--text-primary);
    background: #2a2a35;
}

.url-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 280px;
    padding: 0 8px;
}

.url-input::placeholder {
    color: var(--text-muted);
}

/* Add Menu Dropdown */
.add-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
}

.add-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.2s var(--ease-out);
}

.add-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.add-menu-item i {
    font-size: 16px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.add-menu-item:hover i {
    color: var(--accent);
}

.grid-layout {
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 32px;
    overflow-y: auto;
    padding-bottom: 100px;
}

/* Storage Grid - 2 Column List View */
#storage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 32px 40px;
    padding-bottom: 80px;
}

/* When space is limited, go to single column */
@media (max-width: 900px) {
    #storage-grid {
        grid-template-columns: 1fr;
    }
}

#storage-grid .card {
    aspect-ratio: unset;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: 16px 20px;
    gap: 16px;
    border-radius: var(--radius-lg);
    height: 80px;
    min-height: 80px;
    overflow: visible;
    transition: transform 0.3s var(--ease-out), z-index 0s;
    min-width: 0;
}

#storage-grid .card:hover {
    transform: translateY(-2px);
    z-index: 20;
}

#storage-grid .card-icon {
    font-size: 24px;
    flex-shrink: 0;
}

#storage-grid .card-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    justify-content: center;
    gap: 2px;
    align-items: flex-start;
}

#storage-grid .card-title {
    text-align: left;
    font-size: 14px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0;
}

#storage-grid .card-description {
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#storage-grid .card-meta {
    flex-shrink: 0;
}

/* Card Actions Tooltip */
/* Card Actions Tooltip */
.card-actions {
    position: absolute;
    left: 50%;
    bottom: -52px;
    transform: translateX(-50%) translateY(10px);
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s var(--ease-out);
    z-index: 100;
}

#storage-grid .card:hover .card-actions {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Drag and Drop Styling */
.card.dragging {
    opacity: 0.4;
    background: var(--bg-hover);
    /* Use box-shadow to prevent layout shift from border width change */
    box-shadow: 0 0 0 2px var(--accent) inset;
    border-color: transparent;
    transform: scale(0.98);
    cursor: grabbing;
    transition: none;
    /* Instant feedback */
}

.card.drag-over-folder {
    transform: scale(1.02);
    box-shadow: 0 0 0 2px var(--accent), 0 10px 20px rgba(0, 0, 0, 0.3);
    z-index: 50;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

/* Folder Card Styling */
.card-folder {
    border-left: 3px solid var(--card-accent, var(--accent));
}

.card-folder .card-thumb-icon {
    color: var(--card-accent, var(--accent));
}

.card-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-hover);
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.card-action-btn:hover {
    background: var(--accent);
    color: #fff;
    transform: scale(1.1);
}

.card-action-btn.card-action-danger:hover {
    background: #ef4444;
}

/* Card Thumbnail */
.card-thumbnail {
    width: 80px;
    height: 45px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.card-thumb-icon {
    font-size: 24px;
    color: var(--text-muted);
    transition: all 0.3s var(--ease-out);
}

.card:hover .card-thumb-icon {
    color: var(--card-accent, var(--accent));
}

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

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    aspect-ratio: 1.1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    transition: all 0.3s var(--ease-out);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover {
    transform: translateY(-6px);
    border-color: var(--border-light);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card:hover::before {
    opacity: 1;
}

.card-icon {
    font-size: 42px;
    color: var(--text-muted);
    transition: all 0.3s var(--ease-elastic);
}

.card:hover .card-icon {
    color: var(--card-accent, var(--accent));
    transform: scale(1.1);
    /* filter: drop-shadow(0 0 15px var(--accent-glow)); - Can't easily dynamic var this in CSS without calc or JS? */
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.1));
}

/* Custom Color Border Effect */
.card.has-color {
    border-color: color-mix(in srgb, var(--card-accent) 30%, var(--border));
}

.card.has-color:hover {
    border-color: var(--card-accent);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--card-accent);
}

.card-title {
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    color: var(--text-primary);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}

.card-type-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-meta-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.card-type-chip {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--bg-hover);
    padding: 4px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    display: inline-block;
}



.card-meta {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 4px 10px;
    border-radius: 12px;
}

/* PiP Controls Overlay */
.pip-controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    /* Let clicks pass through when hidden */
    z-index: 10;
    /* Ensure on top of video */
}

/* --- Player Overlay --- */
.player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 7, 0.95);
    backdrop-filter: blur(20px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.player-top-bar {
    height: 40px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(15, 15, 18, 0.8);
    flex-shrink: 0;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 13px;
}

.player-link {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 13px;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: color 0.2s;
}

.player-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.player-info i:not(.edit-icon) {
    color: var(--accent);
}

.player-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ghost {
    padding: 8px;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: 0.2s;
}

.btn-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    filter: grayscale(1);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon-large {
    padding: 10px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 20px;
    transition: 0.2s;
}

.btn-icon-large:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    transform: rotate(90deg);
}

.player-description {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.player-description:hover {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-style: dotted;
}

.editable-group {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    min-width: 0;
    /* Enable truncation for children */
}

.editable-group:hover {
    color: var(--text-primary);
}

#player-filename {
    color: #e2e8f0;
    /* Brighter grey/white */
}

.editable-group:hover #player-filename {
    color: #fff;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.edit-icon {
    font-size: 12px;
    color: #a1a1aa;
    /* Explicit grey (Zinc-400) */
    opacity: 1;
    transition: color 0.2s;
}

.editable-group:hover .edit-icon {
    color: var(--accent);
    /* Accent on hover */
}

#group-description {
    flex: 1;
    /* Allow description group to take remaining space */
}

/* Trash button specific hover */
#player-btn-delete:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

.divider-vertical {
    width: 1px;
    height: 20px;
    /* Condensed height */
    background: var(--border);
    margin: 0 12px;
    flex-shrink: 0;
}

.player-content {
    flex: 1;
    display: flex;
    flex-direction: row;
    /* Explicit row */
    overflow: hidden;
    position: relative;
}

.player-stage {
    flex: 1;
    display: flex;
    /* Flex column for video + bar */
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: black;
    min-width: 0;
    /* Critical for flex shrinking */
}



.video-wrapper {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 0;
    /* Prevent flex overflow */
    overflow: hidden;
}

.main-video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    /* Ensure video fits without pushing */
}

/* Fullscreen Overrides */
/* Fullscreen Overrides */
/* Note: We now fullscreen .player-content, so .player-stage:fullscreen no longer matches */
.player-content:fullscreen .player-stage,
.player-content:-webkit-full-screen .player-stage {
    width: 100%;
    height: 100%;
    /* Flex handled by parent */
}

.player-content:fullscreen .video-wrapper,
.player-content:-webkit-full-screen .video-wrapper {
    height: 100%;
}

/* Immersive Mode (Sidebar Closed in Fullscreen) */
.player-content.sidebar-closed:fullscreen .player-bottom-bar {
    background: transparent;
    border-top: none;
    padding-bottom: 20px;
}

/* Add shadows to text/icons in immersive mode since bar is transparent */
.player-content.sidebar-closed:fullscreen .player-bottom-bar i,
.player-content.sidebar-closed:fullscreen .player-bottom-bar span,
.player-content.sidebar-closed:fullscreen .time-display {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

.player-content:fullscreen .player-bottom-bar,
.player-content:-webkit-full-screen .player-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    /* Default Fullscreen Gradient (when sidebar open) */
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    border-top: none;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    padding-bottom: 30px;
    z-index: 50;
}

/* Hovering the bottom 25% of the screen triggers controls */
.player-content:fullscreen .player-stage::after,
.player-content:-webkit-full-screen .player-stage::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25%;
    z-index: 10;
}

.player-content:fullscreen .player-stage:hover .player-bottom-bar,
.player-content:-webkit-full-screen .player-stage:hover .player-bottom-bar,
.player-content:fullscreen .player-bottom-bar:hover,
.player-content:-webkit-full-screen .player-bottom-bar:hover {
    transform: translateY(0);
    opacity: 1;
}

.player-bottom-bar {
    background: linear-gradient(0deg, var(--bg-card) 0%, rgba(20, 20, 24, 0.9) 100%);
    padding: 16px 30px 24px 30px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
    z-index: 20;
    position: relative;
    /* transition: none; default */
}

.seek-container {
    height: 24px;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

/* Seek Preview Tooltip */
.seek-preview {
    position: absolute;
    bottom: 100%;
    left: 0;
    transform: translateX(-50%);
    margin-bottom: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 3000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.desc-tooltip {
    position: fixed;
    background: rgba(15, 15, 18, 0.98);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    z-index: 2000;
    max-width: 400px;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    white-space: pre-wrap;
    /* Preserve newlines */
}

/* Scrollbar */
.seek-container:hover .seek-preview {
    display: flex;
}

.seek-preview canvas {
    border-radius: 4px;
    background: #000;
}

.seek-preview span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.seek-track {
    flex: 1;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    position: relative;
    overflow: visible;
    transition: height 0.2s;
}

.seek-container:hover .seek-track {
    height: 8px;
}

.seek-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    position: relative;
    box-shadow: 0 0 15px var(--accent-glow);
}

.seek-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    transition: transform 0.2s var(--ease-elastic);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.seek-container:hover .seek-thumb {
    transform: translateY(-50%) scale(1);
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ctrl-btn {
    font-size: 24px;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.ctrl-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
    transform: scale(1.1);
}

.time-display {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text-secondary);
}

/* PDF Styles */
.pdf-stage {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #333;
    overflow: auto;
    position: relative;
    width: 100%;
    height: 100%;
    padding: 20px;
}

#pdf-page-container {
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    background: white;
    /* Avoid transparency issues */
}

#pdf-render {
    display: block;
    pointer-events: none;
}

.textLayer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0.5;
    /* Keeping a bit of opacity helps debug if alignment is off, usually 0.2 */
    line-height: 1.0;
    z-index: 2;
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
    /* Ensure it captures clicks */
}

.textLayer>span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}

.textLayer ::selection {
    background: rgba(var(--accent-rgb), 0.4);
    background: rgba(100, 100, 255, 0.4);
    /* Fallback */
}

.pdf-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(30, 30, 35, 0.95);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 8px 16px;
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* PDF Page Container Animations */
#pdf-page-container {
    transition: opacity 0.15s ease-out, transform 0.2s ease-out;
    transform-origin: top center;
}

#pdf-page-container.pdf-transitioning {
    opacity: 0;
    transform: scale(0.98);
}

#pdf-page-container.pdf-zooming {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Highlighted text pulse animation */
.highlighted-text {
    animation: highlightPulse 0.5s ease-out;
}

@keyframes highlightPulse {
    0% {
        background-color: rgba(255, 255, 0, 0.6);
    }

    100% {
        background-color: rgba(255, 255, 0, 0.3);
    }
}

/* Image Mode Controls - reusing PDF controls but hiding irrelevant items */
#pdf-controls.image-mode .pdf-nav-group:first-of-type,
#pdf-controls.image-mode #btn-pdf-save-highlight {
    display: none !important;
}

.timestamp-text-preview {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
    font-style: italic;
    margin-bottom: 16px;
}

.ctrl-btn-filled:disabled,
.ctrl-btn-filled.inactive {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.05);
    /* Dim background */
    color: var(--text-muted);
}

.pdf-controls.hidden {
    display: none;
}

.pdf-nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Removed border and padding for even spacing */
}

/* Hide bottom bar completely in PDF mode */
.player-bottom-bar.pdf-slim-bar {
    display: none !important;
}

#pdf-zoom-controls {
    display: none;
}

#pdf-zoom-controls.hidden {
    display: none;
}

.ctrl-btn-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: 6px;
    transition: 0.2s;
}

.ctrl-btn-text:hover {
    color: var(--text-primary);
    background: var(--border-light);
}

.player-sidebar {
    width: 320px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s var(--ease-out), padding 0.3s, border 0.3s;
    overflow: hidden;
}

.player-sidebar.collapsed {
    width: 0;
    border-left: none;
}

.seek-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.seek-marker {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 1px;
    opacity: 0.6;
    z-index: 5;
    transition: opacity 0.2s;
}

.seek-marker:hover {
    opacity: 1;
    z-index: 10;
}

/* Control Buttons (Filled Style like Speed) */
.ctrl-btn-filled {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: 6px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ctrl-btn-filled:hover {
    color: var(--text-primary);
    background: var(--border-light);
}

.sidebar-header {
    height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}

.sidebar-header h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.btn-small-primary {
    font-size: 12px;
    padding: 6px 12px;
    background: var(--accent);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    transition: 0.2s;
}

.btn-small-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px var(--accent-glow);
}



.btn-small-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 2px 10px var(--accent-glow);
}



.timestamps-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timestamp-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.timestamp-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.timestamp-item:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateX(2px);
}

.timestamp-item:hover::after {
    opacity: 1;
}

/* Volume Control */
.volume-container {
    display: flex;
    align-items: center;
    position: relative;
    margin-left: 4px;
    padding-right: 8px;
}

.volume-container:hover .volume-slider {
    width: 60px;
    opacity: 1;
    margin-left: 8px;
}

.volume-slider {
    width: 0;
    opacity: 0;
    transition: all 0.2s ease;
    height: 4px;
    border-radius: 2px;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    margin-left: 0;
}

.volume-slider:hover {
    height: 6px;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: transform 0.1s;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.ts-time {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
    display: block;
    font-family: monospace;
}

.ts-note {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal {
    background: #18181b;
    /* Solid dark specifically for modal to pop */
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 440px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    animation: slideUpFade 0.4s var(--ease-elastic);
    position: relative;
}

.modal-title {
    margin-bottom: 24px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Forms & Inputs (Classic Style) */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.form-input,
.modal-input,
.modal-textarea {
    width: 100%;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus,
.modal-input:focus,
.modal-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
    background: var(--bg-hover);
}

.modal-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Form Row (Two Columns) */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.form-col {
    flex: 1;
}

/* Input Groups (Input + Button) */
.input-group {
    display: flex;
    gap: 8px;
}

.input-group .form-input {
    flex: 1;
}

.input-group-btn {
    padding: 0 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: 0.2s;
}

.input-group-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Color Picker Custom */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-app);
}

input[type="color"] {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
    border: 2px solid var(--border);
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-trigger {
    width: 100%;
    background: var(--bg-app);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
}

.dropdown-trigger:hover,
.dropdown-trigger.active {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 4px;
    z-index: 50;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-height: 200px;
    overflow-y: auto;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-item {
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item.selected {
    background: var(--accent-dim);
    color: var(--accent);
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 100;
    animation: fadeIn 0.2s;
    border: 1px solid var(--border);
}

/* Tooltip Left Variant for Sidebar */
[data-tooltip-pos="left"]:hover::after {
    bottom: auto;
    left: auto;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-bottom: 0;
    margin-right: 8px;
}

/* Tooltips for top bar should be below */
.player-top-bar [data-tooltip] {
    position: relative;
}

.player-top-bar [data-tooltip]:hover::after {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 6px;
}

/* Timestamp Item Enhancements */
.timestamp-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    /* For collection color */
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    /* overflow: hidden; Removed to allow tooltips */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.timestamp-item:hover {
    background: var(--bg-hover);
    transform: translateX(2px);
}

.ts-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.ts-meta-group {
    display: flex;
    align-items: baseline;
    gap: 8px;
    overflow: hidden;
}

.ts-time {
    font-size: 11px;
    font-weight: 700;
    font-family: monospace;
    background: var(--bg-app);
    padding: 3px 6px;
    /* Slightly more vertical padding */
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
    /* Reset line height */
}

.ts-collection {
    font-size: 11px;
    /* Match time size */
    font-weight: 700;
    /* Match time weight */
    text-transform: uppercase;
    /* Styled look */
    letter-spacing: 0.5px;
    /* Color applied inline */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
    opacity: 1;
    /* Full opacity for color pop */
    line-height: 1;
    /* Match time line height */
}

.ts-note {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ts-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: 0.2s;
}

/* Action buttons - height matches ts-time pill (17px = 11px font + 6px padding) */
.ts-action-btn {
    width: 17px;
    height: 17px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 14px;
    transition: 0.15s;
}

.ts-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ts-action-btn.btn-delete-ts:hover {
    color: #ef4444;
}

.timestamp-item:hover .ts-actions {
    opacity: 1;
}

.btn-ts-action {
    padding: 4px;
    border-radius: 4px;
    color: var(--text-muted);
}

.btn-ts-action:hover {
    background: var(--bg-app);
    color: var(--text-primary);
}

.btn-ts-action.delete:hover {
    color: #ef4444;
}

/* Video Loader */
.video-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 6px;
    z-index: 20;
    pointer-events: none;
}

.wave-bar {
    width: 6px;
    height: 30px;
    background: var(--accent);
    border-radius: 3px;
    animation: wavePulse 1.2s infinite ease-in-out;
    box-shadow: 0 0 10px var(--accent-glow);
}

.wave-bar:nth-child(1) {
    animation-delay: -1.1s;
}

.wave-bar:nth-child(2) {
    animation-delay: -1.0s;
}

.wave-bar:nth-child(3) {
    animation-delay: -0.9s;
}

.wave-bar:nth-child(4) {
    animation-delay: -0.8s;
}

.wave-bar:nth-child(5) {
    animation-delay: -0.7s;
}

@keyframes wavePulse {

    0%,
    40%,
    100% {
        transform: scaleY(0.4);
        opacity: 0.5;
    }

    20% {
        transform: scaleY(1.2);
        opacity: 1;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Speed Menu */
.speed-menu {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 320px;
    background: #191919;
    /* Solid dark background matching UI */
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 100;
    animation: slideUpFade 0.2s ease-out;
    display: flex;
    flex-direction: column;
}

.speed-header {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 24px;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.speed-slider-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.speed-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.speed-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.btn-icon-small {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    /* Match other player buttons */
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: 0.2s;
    font-size: 16px;
}

.btn-icon-small:hover {
    background: var(--border-light);
    color: var(--text-primary);
    transform: scale(1.1);
}

.speed-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.speed-preset {
    padding: 6px 0;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 6px;
    /* Compact radius */
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.speed-preset:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.speed-preset.active {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Breadcrumbs */
.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.breadcrumb-item {
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: color 0.2s;
    border-radius: 4px;
    padding: 4px 6px;
}

.breadcrumb-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    cursor: default;
}

.breadcrumb-separator {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 4px;
}

/* --- Header Actions (Pill & Bars) --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    /* Push to right */
    position: relative;
    z-index: 50;
}

/* Connected Pill */
.header-action-group {
    display: flex;
    align-items: center;
    background: var(--accent);
    border-radius: 30px;
    padding: 2px;
    box-shadow: 0 4px 12px var(--accent-glow);
    height: 40px;
}

.btn-action-segment {
    width: 38px;
    height: 36px;
    border: none;
    background: transparent;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* Circle hover */
    transition: background 0.2s;
}

.btn-action-segment:hover {
    background: rgba(255, 255, 255, 0.2);
}

.action-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 2px;
}

/* Premium Search Bar */
.search-bar-container {
    display: flex;
    align-items: center;
    background: #0f0f11;
    /* Dark premium bg */
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0 14px;
    height: 40px;
    width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideInLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.search-bar-container.hidden {
    display: none;
}

.search-icon-input {
    color: var(--accent);
    font-size: 16px;
    margin-right: 10px;
}

#search-input,
#collection-search-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    width: 100%;
    outline: none;
}

#search-input::placeholder,
#collection-search-input::placeholder {
    color: var(--text-muted);
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: 6px;
    z-index: 100;
}

.search-results.hidden {
    display: none;
}

/* Quick Add Bar (Refined) */
/* Quick Add Bar (Refined) */
.quick-add-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #0f0f11;
    /* Force neutral border */
    border: 1px solid #27272a !important;
    border-radius: 20px;
    padding: 0 14px;
    height: 40px;
    min-width: 340px;
    /* Neutral shadow only */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
    animation: slideInLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none !important;
}

.quick-add-bar:focus-within {
    border-color: #3f3f46 !important;
    /* Slightly lighter grey on focus, NOT purple */
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.5) !important;
}

.quick-add-bar.hidden {
    display: none;
}

#input-add-url {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    height: 100%;
    flex: 1;
    /* Fill available space */
    min-width: 0;
}

#input-add-url::placeholder {
    color: var(--text-muted);
}

.vr {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 4px;
}

/* Override custom select for dark bar */
.quick-add-bar .custom-select-trigger {
    background: transparent;
    border: none;
    padding: 6px 10px;
    /* More clickable area */
    color: #a1a1aa;
    /* Zinc-400 */
    font-size: 13px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.quick-add-bar .custom-select-trigger:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Add Button in Quick Bar */
#btn-add-media {
    height: 26px;
    /* Compact */
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 13px;
    /* Pill */
    white-space: nowrap;
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
    border: none;
    transition: 0.2s;
    letter-spacing: 0.02em;
    box-shadow: none;
}

#btn-add-media:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Add Folder Button */
#btn-add-folder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: 0.2s;
    cursor: pointer;
}

#btn-add-folder:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Search Result Polish */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-primary);
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.search-result-item i {
    color: var(--accent);
    font-size: 18px;
}

.search-result-path {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}



@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Drag Utils */
.drag-preview {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    font-size: 13px;
    font-weight: 600;
}

/* Folder Selection Modal List */
.folder-select-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0f0f11;
    margin: 16px 0;
    display: flex;
    flex-direction: column;
}

.folder-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    color: var(--text-secondary);
}

.folder-select-item:last-child {
    border-bottom: none;
}

.folder-select-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.folder-select-item i {
    color: var(--accent);
    font-size: 18px;
}

.folder-select-item.current-folder {
    opacity: 0.5;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.02);
}

.folder-select-item .folder-path-context {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
}

.breadcrumb-item.drag-over {
    background: var(--bg-hover);
    color: var(--accent);
    outline: 2px dashed var(--accent);
}

/* PDF Support & Layout Fixes */
.player-content {
    display: flex;
    /* Ensure side-by-side */
    flex: 1;
    overflow: hidden;
    /* Contain scrolls */
}

.player-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: black;
}

/* PDF-Specific Slim Bar */
.player-bottom-bar.pdf-slim-bar {
    padding: 12px 24px;
    gap: 0;
    justify-content: center;
    min-height: 64px;
    /* Ensure visual weight */
    display: flex;
    flex-direction: row;
    /* Force row direction for the bar itself */
    align-items: center;
}

.player-bottom-bar.pdf-slim-bar .controls-row {
    justify-content: center;
    position: relative;
    width: 100%;
    margin: 0;
}

.player-bottom-bar.pdf-slim-bar .controls-right {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.pdf-stage {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    background: #0a0a0c;
    overflow: auto;
    padding: 40px;
    position: relative;
}

#pdf-page-container {
    position: relative;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.5);
    align-self: flex-start;
    /* Allow scrolling if tall */
    margin: auto;
    /* Center in scroll view */
}

.textLayer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    line-height: 1;
    text-size-adjust: none;
    pointer-events: auto;
}

.textLayer span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}

.textLayer ::selection {
    background: rgba(99, 102, 241, 0.3);
}

.pdf-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    background: #27272a;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.pdf-popover {
    position: absolute;
    z-index: 1000;
    background: var(--bg-card);
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    animation: scaleIn 0.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary-small {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary-small:hover {
    filter: brightness(1.1);
}

/* =========================
   Collection Timestamp Mode
   ========================= */

/* Info Sidebar Content */
.info-sidebar .info-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-time-range {
    font-size: 28px;
    font-weight: 700;
    font-family: monospace;
    padding: 16px 20px;
    background: var(--bg-app);
    border-radius: 12px;
    text-align: center;
    color: var(--collection-color, var(--accent));
    border: 1px solid var(--border);
}

.info-note {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border-left: 4px solid var(--collection-color, var(--accent));
    white-space: pre-wrap;
}

/* Video Info Card */
.info-file-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-hover);
    border-radius: 8px;
    overflow: hidden;
}

.info-file {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    /* Background and radius handled by card container now */
}

.info-file-desc {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    line-height: 1.5;
}

.info-file i {
    color: var(--collection-color, var(--accent));
}

/* Info sidebar header layout + "View original" button */
.info-sidebar .sidebar-header {
    height: auto;
    padding: 20px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-view-original {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--collection-color, var(--accent));
    color: var(--collection-color, var(--accent));
    background: color-mix(in srgb, var(--collection-color, var(--accent)) 10%, transparent);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-view-original i {
    font-size: 12px;
}

.btn-view-original:hover {
    background: color-mix(in srgb, var(--collection-color, var(--accent)) 20%, transparent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--collection-color, var(--accent)) 30%, transparent);
}

/* Collection Mode UI Switching */
/* Collection Mode UI Switching */
.player-overlay.collection-mode .player-top-bar {
    display: none !important;
}

.player-overlay.collection-mode #player-sidebar {
    display: none !important;
}

/* Ensure sidebar is on top of top bar for full vertical height */
.player-overlay.collection-mode #info-sidebar {
    display: flex !important;
    flex-direction: column;
    z-index: 2001;
    /* Higher than top bar */
    overflow-y: auto;
    overflow-x: hidden;
}

/* Collection Color Theming */
.player-overlay.collection-mode .seek-fill {
    background: var(--collection-color, var(--accent));
    box-shadow: 0 0 15px color-mix(in srgb, var(--collection-color, var(--accent)) 50%, transparent);
}

/* Disable Title/Description Editing in Collection Mode */
.player-overlay.collection-mode .editable-group {
    pointer-events: none;
    cursor: default;
}

.player-overlay.collection-mode .editable-group .edit-icon {
    display: none;
}

.player-overlay.collection-mode .editable-group:hover span {
    text-decoration: none;
    /* If there was any hover effect */
}

/* Allow Title and Description to take full available width */
.player-overlay.collection-mode .player-info {
    flex: 1;
    min-width: 0;
    /* Enable flex child shrinking */
    padding-right: 16px;
    display: flex;
    /* Ensure flex context */
    align-items: center;
    /* Vertical align */
}

.player-overlay.collection-mode .editable-group {
    max-width: none !important;
    /* Allow growth */
    flex: 0 1 auto;
}

.player-overlay.collection-mode #group-description {
    flex: 1;
    /* Description takes remaining space */
    min-width: 0;
    display: flex;
    /* Ensure it behaves as flex container for child */
    overflow: hidden;
    /* Help container intercept overflow */
}

.player-overlay.collection-mode #player-description {
    max-width: none !important;
    /* Remove span text limit */
    width: 100%;
    display: block !important;
    /* Required for text-overflow to work properly on span */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-overlay.collection-mode .sidebar-header h3 {
    color: var(--collection-color, var(--accent));
}

/* Collection Mode Only Actions in Top Bar */
.collection-only-action {
    display: none !important;
}

.player-overlay.collection-mode button.collection-only-action {
    display: flex !important;
}

.player-overlay.collection-mode div.collection-only-action {
    display: block !important;
}

/* Custom View Original Button in Sidebar */
.info-action-btn.view-original-btn {
    width: 100%;
    margin-bottom: 0;
    /* Handled by group gap */
    gap: 10px !important;
    height: 28px !important;
    /* Match height of action buttons - use !important to override */
    letter-spacing: 0.5px;
    font-size: 14px;
    /* Larger text */
    font-weight: 500;
    flex: none;
    /* Override flex: 1 from .info-action-btn */
}

.view-original-btn i {
    font-size: 18px !important;
    /* Larger icon */
}

.info-actions-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Consistent spacing */
    width: 100%;
}

/* Info Sidebar Action Buttons Row */
.info-actions-row {
    display: flex;
    gap: 8px;
}

.info-action-btn {
    flex: 1;
    height: 28px;
    /* Compact height */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--bg-hover);
    border: 1px solid transparent;
    /* Cleaner border */
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
}

.info-action-btn i {
    font-size: 14px;
    /* Scaled down icon */
    transition: 0.2s;
}

.info-action-btn:hover {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.info-action-btn.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Custom Color Picker */
.cp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.cp-tabs {
    display: flex;
    background: var(--bg-hover);
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.cp-tab {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
}

.cp-tab:hover {
    color: var(--text-primary);
}

.cp-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cp-panel.hidden {
    display: none;
}

.cp-panel {
    animation: fadeIn 0.2s ease-out;
}

/* Basic Grid */
.cp-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.cp-preset {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    box-sizing: border-box;
    /* Fix potential sizing issues */
}

.cp-preset:hover {
    transform: scale(1.1);
}

.cp-preset.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent);
}

/* Advanced Picker */
.cp-saturation {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    cursor: crosshair;
    margin-bottom: 16px;
    background: red;
    /* Initial fallback */
}

.cp-saturation-white {
    background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
    position: absolute;
    inset: 0;
}

.cp-saturation-black {
    background: linear-gradient(to top, #000, rgba(0, 0, 0, 0));
    position: absolute;
    inset: 0;
}

.cp-cursor {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.cp-controls-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.cp-hue-rail {
    flex: 1;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 66%, magenta 83%, red 100%);
    position: relative;
    cursor: pointer;
}

.cp-hue-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.cp-preview {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: #fff;
}

.cp-inputs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.cp-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cp-input-group label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.cp-input-group input {
    width: 100%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 6px 8px;
    font-family: monospace;
    font-size: 13px;
}

.cp-input-group input:focus {
    border-color: var(--accent);
}

/* Resizable Player Sidebar */
.player-content {
    display: flex;
    overflow: hidden;
}

.player-stage {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    /* transition: margin 0.3s var(--ease-out); */
}

.resize-handle {
    width: 14px;
    /* Wider target area */
    height: 100%;
    cursor: col-resize;
    background: transparent;
    transition: background 0.2s, width 0.3s var(--ease-out), opacity 0.3s;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border);
}

/* Grip visual using pseudo-element */
.resize-handle::after {
    content: "";
    width: 4px;
    height: 32px;
    background-color: var(--border-light);
    border-radius: 2px;
    transition: background-color 0.2s;
}

.resize-handle:hover,
.resize-handle.active {
    background: rgba(255, 255, 255, 0.03);
}

.resize-handle:hover::after,
.resize-handle.active::after {
    background-color: var(--accent);
}

/* Collapsed state for handle */
.resize-handle.collapsed {
    width: 0;
    opacity: 0;
    border: none;
    pointer-events: none;
}

.player-sidebar {
    width: 320px;
    /* Default width */
    flex-shrink: 0;
    transition: width 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
    opacity: 1;
    overflow: hidden;
    background: var(--bg-sidebar);
}

/* Collapsed state for sidebar */
.player-sidebar.collapsed {
    width: 0 !important;
    opacity: 0;
    border: none;
}

/* Collection Card Preview Background */
.card-bg-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.card-bg-preview .card-thumb-img,
.card-bg-preview canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.35;
    filter: brightness(0.4);
    transition: opacity 0.3s ease, transform 0.3s ease, filter 0.3s ease;
}

.card:hover .card-bg-preview .card-thumb-img,
.card:hover .card-bg-preview canvas {
    opacity: 0.5;
    transform: scale(1.05);
    filter: brightness(0.5);
}

.card-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 100%;
    text-align: center;
}

/* Collection View Actions - Rebuilt Ground Up */
.collection-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    /* Taller touch target area */
    display: flex !important;
    align-items: flex-end;
    /* Align buttons to bottom */
    justify-content: center;
    padding-bottom: 12px;
    gap: 12px;

    /* Visibility & Layering */
    z-index: 1000;
    /* Extremely high to sit on top of everything */
    opacity: 0;
    /* Hidden by default */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 30%, transparent);

    /* Interaction */
    pointer-events: none;
    /* Let clicks pass through empty areas */
    transition: opacity 0.2s ease-out;
}

/* Show on hover of parent card */
.card-folder:hover .collection-actions,
.collection-card:hover .collection-actions {
    opacity: 1;
}

/* Button Styling */
.collection-actions .card-action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;

    /* Visuals */
    background: #1e1e24;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e4e4e7;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);

    /* Layout */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;

    /* Interaction */
    pointer-events: auto;
    /* Re-enable clicks on buttons */
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
}

.collection-actions .card-action-btn:hover {
    transform: scale(1.15) translateY(-2px);
    background: #27272a;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
}

.collection-actions .card-action-danger:hover {
    background: rgba(220, 38, 38, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

/* Search Container Animation Removed - Replaced by Shared Styles */
.search-container.collapsed {
    /* Deprecated */
}

.search-container input {
    /* Deprecated */
}

.search-container input:focus {
    /* Deprecated */
}

/* =============================================
   DOCS TAB STYLES
   ============================================= */

#view-docs {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-app);
}

/* Docs Toolbar - Thinner than other headers */
#docs-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    height: 44px;
    flex-shrink: 0;
}

.docs-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.docs-toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.docs-toolbar-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.docs-toolbar-btn i {
    font-size: 16px;
}

.docs-toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 8px;
}



/* Floating pill shown when caret is inside a link in the docs editor */
.docs-link-pill {
    position: fixed;
    z-index: 3100;
    background: rgba(15,15,18,0.98);
    border: 1px solid rgba(99,102,241,0.12);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 999px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    pointer-events: auto;
    font-size: 13px;
}
.docs-link-pill.hidden { display: none; }
.docs-link-pill .docs-link-pill-url {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}
.docs-link-pill .docs-link-pill-open {
    background: linear-gradient(90deg, #7c3aed, #6366f1);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

/* edit / delete icon buttons */
.docs-link-pill .docs-link-pill-edit,
.docs-link-pill .docs-link-pill-delete {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.docs-link-pill .docs-link-pill-edit:hover,
.docs-link-pill .docs-link-pill-delete:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

/* Docs Dropdowns */
.docs-dropdown {
    position: relative;
}

.docs-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.docs-format-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.docs-format-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.docs-format-item.active {
    background: var(--accent-dim);
    color: var(--accent);
}

/* Docs Editor */
#docs-editor {
    flex: 1;
    padding: 32px 48px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-app);
    outline: none;
}

#docs-editor:empty::before {
    content: attr(placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

#docs-editor h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

#docs-editor h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

#docs-editor h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

#docs-editor h4 {
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 10px;
}

#docs-editor h5 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

#docs-editor h6 {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-muted);
}

#docs-editor p {
    margin-bottom: 12px;
}

#docs-editor ul,
#docs-editor ol {
    margin-left: 24px;
    margin-bottom: 12px;
}

#docs-editor a {
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

#docs-editor a:hover {
    color: var(--accent-hover);
}

/* Docs Link Modal */
.docs-link-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.docs-link-tab {
    flex: 1;
    padding: 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.docs-link-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.docs-link-tab.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.docs-link-panel {
    margin-bottom: 16px;
}

.docs-link-panel .input,
.docs-link-panel input,
.docs-link-panel select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.docs-link-panel input:focus,
.docs-link-panel select:focus {
    border-color: var(--accent);
}

.docs-link-panel select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a1a1aa' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.docs-link-panel select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Sidebar nav container - fill remaining height */
#project-nav-items {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Export/Import Button */
.export-import-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.export-import-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.export-import-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

/* Tab Buttons */
.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Welcome View */
#view-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
}

#view-welcome .btn-ghost {
    border: 1px solid var(--border);
}

#view-welcome .btn-ghost:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}