/* CineVault - Movie Collection Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-bg: #0a0e27;
    --secondary-bg: #151a35;
    --accent-color: #00d9ff;
    --accent-glow: rgba(0, 217, 255, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --card-bg: rgba(21, 26, 53, 0.6);
    --card-border: rgba(0, 217, 255, 0.2);
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1629 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 217, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease-out;
}

.header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    text-shadow: 0 0 40px var(--accent-glow);
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Breadcrumb */
.breadcrumb {
    background: var(--card-bg);
    padding: 18px 24px;
    border-radius: 16px;
    margin-bottom: 30px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    animation: fadeIn 0.5s ease-out;
}

.breadcrumb span {
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    color: var(--text-secondary);
}

.breadcrumb span:hover {
    background: rgba(0, 217, 255, 0.15);
    color: var(--accent-color);
    transform: translateY(-2px);
}

/* Folder Grid */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.folder-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 32px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out backwards;
}

.folder-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.folder-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent-color);
    box-shadow: 0 20px 60px rgba(0, 217, 255, 0.2);
}

.folder-card:hover::before {
    opacity: 1;
}

.folder-icon {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 12px var(--accent-glow));
    position: relative;
    z-index: 1;
}

.folder-name {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
    color: var(--text-primary);
}

/* File List */
.file-list {
    display: none;
}

.file-list.active {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

.file-item {
    background: var(--card-bg);
    margin: 12px 0;
    padding: 20px 24px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    animation: fadeInLeft 0.5s ease-out backwards;
}

.file-item:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--accent-color);
    transform: translateX(8px);
    box-shadow: 0 8px 24px rgba(0, 217, 255, 0.15);
}

.file-icon {
    margin-right: 20px;
    font-size: 2rem;
    filter: drop-shadow(0 2px 8px var(--accent-glow));
}

.file-name {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 500;
}

/* Video Player Overlay */
.video-player-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.video-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Floating Controls Container - Netflix/YouTube style */
.player-controls-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
    padding: 12px 16px;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.video-container:hover .player-controls-wrapper,
.video-container.controls-visible .player-controls-wrapper {
    opacity: 1;
    pointer-events: auto;
}

.player-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.player-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.video-controls-top {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.control-btn {
    background: transparent;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.close-btn {
    background: transparent;
    font-size: 1.3rem;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Control Groups - Netflix style minimal */
.control-group {
    position: relative;
}

.control-group label {
    display: none;
}

.control-group select {
    background: rgba(30, 30, 30, 0.8);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 6px 28px 6px 10px;
    font-size: 0.8rem;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    min-width: 90px;
}

.control-group select:hover,
.control-group select:focus {
    background-color: rgba(50, 50, 50, 0.9);
    border-color: rgba(255,255,255,0.3);
    outline: none;
}

.control-group select option {
    background: #141414;
    color: white;
    padding: 8px;
}

/* Minimal inline select for top bar */
.minimal-select {
    background: rgba(30, 30, 30, 0.8);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 6px 26px 6px 10px;
    font-size: 0.75rem;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

.minimal-select:hover,
.minimal-select:focus {
    background-color: rgba(50, 50, 50, 0.9);
    border-color: rgba(255,255,255,0.3);
    outline: none;
}

.minimal-select option {
    background: #141414;
    color: white;
}

/* Hide track status badges */
.track-status {
    display: none;
}

/* Debug Info - Hidden by default */
.debug-info {
    display: none;
}

/* Video.js Customization - Full responsive */
.video-wrapper {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#videoPlayer,
.video-js {
    width: 100% !important;
    height: 100% !important;
    max-height: 100vh;
    border-radius: 0;
}

.video-js .vjs-tech {
    object-fit: contain;
}

/* Big play button - YouTube style */
.video-js .vjs-big-play-button {
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 68px;
    height: 68px;
    line-height: 68px;
    font-size: 2rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    transition: all 0.2s ease;
}

.video-js .vjs-big-play-button .vjs-icon-placeholder::before {
    font-size: 2rem;
}

.video-js:hover .vjs-big-play-button {
    background: rgba(255, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Control bar - YouTube/Netflix gradient */
.video-js .vjs-control-bar {
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    height: 48px;
    padding: 0 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-js:hover .vjs-control-bar,
.video-js.vjs-paused .vjs-control-bar {
    opacity: 1;
}

/* Progress bar - YouTube red style */
.video-js .vjs-progress-control {
    position: absolute;
    bottom: 42px;
    left: 0;
    right: 0;
    width: 100%;
    height: 3px;
    transition: height 0.1s ease;
}

.video-js .vjs-progress-control:hover,
.video-js .vjs-progress-control:focus {
    height: 5px;
}

.video-js .vjs-progress-holder {
    height: 100%;
    margin: 0;
}

.video-js .vjs-slider {
    background: rgba(255, 255, 255, 0.2);
}

/* YouTube red progress */
.video-js .vjs-play-progress {
    background: #ff0000;
}

.video-js .vjs-play-progress::before {
    font-size: 14px;
    top: -5px;
    color: #ff0000;
}

.video-js .vjs-load-progress {
    background: rgba(255, 255, 255, 0.35);
}

.video-js .vjs-load-progress div {
    background: rgba(255, 255, 255, 0.15);
}

/* Hover scrubber circle */
.video-js .vjs-progress-control:hover .vjs-play-progress::before {
    font-size: 16px;
}

/* Buffering spinner - minimal */
.video-js .vjs-loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
}

.video-js .vjs-loading-spinner::before,
.video-js .vjs-loading-spinner::after {
    display: none;
}

/* Time display - clean */
.video-js .vjs-time-control {
    display: flex;
    align-items: center;
    padding: 0 4px;
    font-size: 0.8rem;
    min-width: auto;
    font-family: 'Outfit', sans-serif;
}

.video-js .vjs-current-time,
.video-js .vjs-duration {
    display: block;
}

.video-js .vjs-time-divider {
    display: block;
    padding: 0 3px;
    line-height: 48px;
}

/* Seek tooltip */
.video-js .vjs-mouse-display {
    background-color: #ff0000;
}

.video-js .vjs-time-tooltip {
    background-color: rgba(20, 20, 20, 0.95);
    border-radius: 2px;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-family: 'Outfit', sans-serif;
}

/* Control buttons - minimal */
.video-js .vjs-button > .vjs-icon-placeholder::before {
    font-size: 1.6rem;
    line-height: 48px;
}

.video-js .vjs-play-control,
.video-js .vjs-volume-panel,
.video-js .vjs-fullscreen-control {
    cursor: pointer;
}

.video-js .vjs-volume-panel {
    width: 32px;
}

.video-js .vjs-volume-panel:hover {
    width: 100px;
}

/* Fullscreen button */
.video-js .vjs-fullscreen-control {
    order: 99;
}

/* Fullscreen touch hint - hidden */
.fullscreen-hint {
    display: none;
}

/* YouTube-style Seek Indicators */
.seek-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.seek-indicator.left {
    left: 12%;
}

.seek-indicator.right {
    right: 12%;
}

.seek-indicator.visible {
    animation: seekRipple 0.6s ease-out forwards;
}

.seek-icon {
    font-size: 1.8rem;
}

.seek-text {
    font-size: 0.85rem;
    font-weight: 500;
}

@keyframes seekRipple {
    0% {
        transform: translateY(-50%) scale(0.6);
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        transform: translateY(-50%) scale(1.2);
        opacity: 0;
    }
}

/* Tap Zones for seeking (YouTube-like) */
.tap-zone {
    position: absolute;
    top: 0;
    bottom: 60px; /* Above video controls */
    width: 25%;
    z-index: 40;
    cursor: pointer;
}

.tap-zone.left {
    left: 0;
}

.tap-zone.right {
    right: 0;
}

/* Track Status */
.track-status {
    color: var(--success-color);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.15);
}

.track-status.error {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.15);
}

.track-status.warning {
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.15);
}

/* Back Button */
.back-btn {
    background: var(--card-bg);
    color: white;
    border: 1px solid var(--card-border);
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 24px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(20px);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.back-btn:hover {
    background: rgba(0, 217, 255, 0.15);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.2);
}

/* Loading and Error States */
.loading {
    text-align: center;
    font-size: 1.3rem;
    padding: 60px;
    background: var(--card-bg);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    animation: pulse 2s ease-in-out infinite;
}

.error {
    text-align: center;
    font-size: 1.1rem;
    padding: 40px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    line-height: 1.8;
}

.error small {
    display: block;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Codec Warning Banner - minimal */
.codec-warning {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    padding: 10px 16px;
    max-width: 400px;
    z-index: 90;
    display: none;
    animation: fadeIn 0.3s ease;
}

.codec-warning.active {
    display: block;
}

.codec-warning-text {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 8px;
}

.codec-warning-text .icon {
    font-size: 1rem;
    color: #f59e0b;
}

/* Transcoding Progress */
.transcoding-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 12px;
}

.transcoding-overlay.active {
    display: flex;
}

.transcoding-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 217, 255, 0.2);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.transcoding-text {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
}

.transcoding-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 8px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2.5rem;
    }

    .folder-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }

    /* Video player mobile styles */
    .player-controls-wrapper {
        padding: 10px 12px;
    }
    
    .player-header {
        flex-direction: row;
        gap: 10px;
    }
    
    .player-title {
        font-size: 0.85rem;
        max-width: 120px;
    }

    .video-controls-top {
        gap: 6px;
    }
    
    .control-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .close-btn {
        padding: 6px 10px;
    }
    
    .control-group select {
        padding: 6px 24px 6px 8px;
        font-size: 0.75rem;
        min-width: 80px;
    }
    
    .fullscreen-hint {
        font-size: 0.85rem;
        padding: 12px 20px;
    }

    .control-group {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Stagger Animation Delays */
.folder-card:nth-child(1) { animation-delay: 0.1s; }
.folder-card:nth-child(2) { animation-delay: 0.15s; }
.folder-card:nth-child(3) { animation-delay: 0.2s; }
.folder-card:nth-child(4) { animation-delay: 0.25s; }
.folder-card:nth-child(5) { animation-delay: 0.3s; }
.folder-card:nth-child(6) { animation-delay: 0.35s; }

.file-item:nth-child(1) { animation-delay: 0.05s; }
.file-item:nth-child(2) { animation-delay: 0.1s; }
.file-item:nth-child(3) { animation-delay: 0.15s; }
.file-item:nth-child(4) { animation-delay: 0.2s; }
.file-item:nth-child(5) { animation-delay: 0.25s; }

/* Audio Fallback Player */
.audio-fallback-container {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 50;
}

.audio-fallback-container.active {
    display: flex;
}

.audio-fallback-label {
    color: var(--warning-color);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Custom video wrapper for audio handling */
.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
}
