/* ===== CSS VARIABLES ===== */
:root {
    --bg-dark: #0a0a0b;
    --bg-card: #111113;
    --bg-card-hover: #18181b;
    --accent: #c8ff00;
    --accent-dim: #8aad00;
    --text-primary: #e8e8ec;
    --text-secondary: #6b6b76;
    --text-muted: #3a3a42;
    --border: #1e1e22;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== NOISE OVERLAY ===== */
.noise-overlay {
    position: fixed;
    inset: 0;
    opacity: 0.012;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1000;
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* ===== CONTAINER ===== */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: visible;
}

.logo {
    display: flex;
    align-items: center;
    overflow: visible;
}

.logo-img {
    height: 120px;
    width: auto;
    margin: -40px 0;
}

/* ===== STATUS BAR ===== */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 0;
    margin-top: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s ease;
}

.status-dot.online {
    background: var(--accent);
    box-shadow: 0 0 10px rgba(200, 255, 0, 0.5);
}

.status-dot.offline {
    background: #ff4444;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.status-text {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== FORMAT WARNING BANNER ===== */
.format-warning-banner {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
    background: rgba(255, 170, 0, 0.08);
    border: 1px solid rgba(255, 170, 0, 0.2);
    border-radius: 12px;
    color: #ffaa00;
    font-size: 13px;
}

.format-warning-banner.visible {
    display: flex;
}

.format-warning-banner svg {
    flex-shrink: 0;
}

.warning-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #ffaa00;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.warning-close:hover {
    opacity: 1;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    flex: 1;
}

/* ===== VIDEO PLAYER SECTION ===== */
.player-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-container {
    position: relative;
    width: 100%;
    background: var(--bg-dark);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    aspect-ratio: 16 / 9;
}

#videoPlayer {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    border-radius: 12px;
}

/* Video overlay */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: rgba(10, 10, 11, 0.7);
    cursor: pointer;
    transition: opacity 0.4s ease;
}

.video-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.big-play-icon {
    filter: drop-shadow(0 0 20px rgba(200, 255, 0, 0.4));
    transition: transform 0.3s ease;
}

.video-overlay:hover .big-play-icon {
    transform: scale(1.15);
}

.overlay-text {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Fullscreen video container */
.video-container:fullscreen {
    background: #000;
    border-radius: 0;
    border: none;
    aspect-ratio: unset;
}

.video-container:fullscreen #videoPlayer {
    border-radius: 0;
}

/* Now playing info */
.now-playing {
    padding: 5px 10px;
}

.now-playing-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-playing-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
}

.now-playing-meta .meta-folder {
    color: var(--accent);
}

.now-playing-meta .meta-size {
    color: var(--text-secondary);
}

.now-playing-meta .meta-ext {
    color: var(--accent);
    background: rgba(200, 255, 0, 0.08);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 11px;
}

/* ===== SIDEBAR ===== */
.sidebar {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 140px);
}

/* Search */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.search-icon {
    position: absolute;
    left: 15px;
    color: var(--accent);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 12px 15px 12px 45px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 15px;
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

#searchInput:focus {
    border-color: var(--accent);
}

#searchInput::placeholder {
    color: var(--text-muted);
}

/* Folder tabs */
.folder-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.folder-tabs .tab {
    padding: 8px 16px;
    background: rgba(10, 10, 11, 0.4);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    white-space: nowrap;
}

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

.folder-tabs .tab.active {
    background: rgba(200, 255, 0, 0.06);
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Folder Drill Navigation ─────────────────────────────── */

.drill-back-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    padding: 0 4px 10px;
    letter-spacing: 0.3px;
    transition: opacity 0.2s;
    border: none;
    background: none;
}

.drill-back-btn:hover { opacity: 0.65; }

.drill-title {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    padding: 0 4px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-item {
    padding: 12px 14px;
    margin-bottom: 6px;
    background: rgba(10, 10, 11, 0.4);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s ease;
}

.folder-item:hover {
    background: rgba(200, 255, 0, 0.06);
    border-color: var(--accent-dim);
    transform: translateX(4px);
}

.folder-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(200, 255, 0, 0.06);
    border: 1px solid rgba(200, 255, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.folder-info {
    flex: 1;
    min-width: 0;
}

.folder-name {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.folder-meta {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--text-secondary);
}

.folder-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}

.folder-item:hover .folder-arrow {
    color: var(--accent);
    transform: translateX(3px);
}

/* Video count */
.video-count {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 0 5px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

/* Video items list */
.video-items {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.video-items::-webkit-scrollbar {
    width: 6px;
}

.video-items::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

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

.video-items::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Individual video item */
.video-item {
    padding: 14px;
    margin-bottom: 8px;
    background: rgba(10, 10, 11, 0.4);
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

.video-item:hover {
    background: rgba(200, 255, 0, 0.06);
    border-color: var(--accent-dim);
    transform: translateX(5px);
}

.video-item:hover .video-item-icon {
    color: var(--accent);
}

.video-item:hover .video-item-name {
    color: var(--accent);
}

.video-item.active {
    background: rgba(200, 255, 0, 0.08);
    border-color: var(--accent);
}

.video-item.not-playable {
    opacity: 0.6;
}

.video-item.not-playable:hover {
    opacity: 0.8;
}

/* Video item icon */
.video-item-icon {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.video-item.active .video-item-icon {
    color: var(--accent);
}

.badge-warning {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #ffaa00;
    color: var(--bg-dark);
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Video item info */
.video-item-info {
    flex: 1;
    min-width: 0;
}

.video-item-name {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.video-item.active .video-item-name {
    color: #fff;
}

.video-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
}

.meta-folder {
    color: var(--accent);
}

.meta-size {
    color: var(--text-secondary);
}

.meta-ext {
    color: var(--accent);
    background: rgba(200, 255, 0, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 10px;
}

.meta-subs {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 10px;
}

/* Audio track selector */
.audio-track-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.audio-track-selector::before {
    content: '🔊';
    font-size: 13px;
    margin-right: 2px;
}

.audio-btn {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-btn:hover {
    background: rgba(200, 255, 0, 0.08);
    border-color: var(--accent-dim);
    color: var(--text-primary);
}

.audio-btn.active {
    background: rgba(200, 255, 0, 0.12);
    border-color: var(--accent);
    color: var(--accent);
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 15px;
    color: var(--text-secondary);
}

.empty-state p {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
}

/* ===== FOOTER ===== */
.footer {
    margin-top: 24px;
    text-align: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.footer p {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        max-height: min(400px, 50vh);
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .player-section {
        padding: 15px;
        border-radius: 12px;
    }

    .sidebar {
        padding: 15px;
        border-radius: 12px;
    }

    .video-container {
        border-radius: 10px;
    }

    #videoPlayer {
        border-radius: 10px;
    }

    .logo-img {
        height: 80px;
        margin: -24px 0;
    }

    .now-playing-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 8px;
        gap: 12px;
    }

    .header {
        padding: 10px 12px;
        margin-bottom: 12px;
    }

    .logo-img {
        height: 60px;
        margin: -16px 0;
    }

    .player-section {
        padding: 12px;
        gap: 14px;
    }

    .sidebar {
        padding: 12px;
        max-height: 45vh;
    }

    .video-item {
        padding: 10px;
        gap: 10px;
    }

    .video-item-name {
        font-size: 13px;
    }

    .now-playing-title {
        font-size: 14px;
    }

    .folder-item {
        padding: 10px 12px;
    }

    .folder-name {
        font-size: 13px;
    }

    .drill-back-btn {
        font-size: 12px;
    }

    .drill-title {
        font-size: 13px;
    }

    #searchInput {
        padding: 9px 12px 9px 38px;
        font-size: 13px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
