/* Extracted from watch.php */

* { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            margin: 0;
            font-family: 'Segoe UI', Tahoma, sans-serif;
            background: #222233;
            color: #eee;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }
        a { color: #77aaff; text-decoration: none; }
        a:hover { text-decoration: underline; }

        .navbar {
            background: #1a1a2e;
            padding: 1rem 1.5rem;
            border-bottom: 1px solid #333366;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: fixed;
            top: 0;
            width: 100%;
            z-index: 1000;
        }
        .navbar-left {
            display: flex;
            align-items: center;
            gap: 1.5rem;
        }
        .navbar-right {
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        .nav-link {
            color: #eee;
            font-size: 1rem;
            padding: 0.5rem 1rem;
            border-radius: 6px;
            transition: background 0.2s;
            text-decoration: none !important;
        }
        .nav-link:hover { background: #333366; }
        .nav-link.active { background: #6677ff; color: white; }

        /* Hamburger menu for mobile */
        .hamburger {
            display: none;
            font-size: 1.8rem;
            background: none;
            border: none;
            color: #eee;
            cursor: pointer;
        }

        /* Mobile menu */
        .mobile-menu {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            width: 100%;
            background: #1a1a2e;
            border-bottom: 1px solid #333366;
            flex-direction: column;
            padding: 1rem;
            box-shadow: 0 8px 16px rgba(0,0,0,0.4);
        }
        .mobile-menu.open { display: flex; }
        .mobile-menu a {
            padding: 0.8rem 1rem;
            color: #eee;
            text-decoration: none;
            border-radius: 6px;
            transition: background 0.2s;
        }
        .mobile-menu a:hover { background: #333366; }

        /* Dropdown for Upload */
        .dropdown {
            position: relative;
            display: inline-block;
        }
        .dropbtn {
            background: none;
            border: none;
            color: #eee;
            font-size: 1rem;
            padding: 0.5rem 1rem;
            cursor: pointer;
        }
        .dropdown-content {
            display: none;
            position: absolute;
            right: 0;
            background: #1a1a2e;
            min-width: 160px;
            box-shadow: 0 8px 16px rgba(0,0,0,0.4);
            border-radius: 4px;
            z-index: 1001;
            border: 1px solid #333366;
        }
        .dropdown-content a {
            color: #eee;
            padding: 12px 16px;
            text-decoration: none;
            display: block;
        }
        .dropdown-content a:hover { background: #333366; }
        .dropdown:hover .dropdown-content { display: block; }

        .container {
            flex: 1;
            display: flex;
            overflow: hidden;
            height: 100%;
            margin-top: 60px;
        }
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-height: 100%;
            overflow-y: auto;
        }
        .video-player {
            width: 100%;
            background: #111122;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1rem;
            border-bottom: 1px solid #333366;
            position: relative;
        }
        .video-wrapper {
            width: 100%;
            max-width: 800px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
        }
        .main-video {
            width: 100%;
            max-width: 56.25vh; /* portrait aspect ratio */
            margin: 0 auto;
            position: relative;
        }
        .main-video img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            z-index: 1;
        }
        .main-video video {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
        }
        .controls {
            display: flex;
            align-items: center;
            gap: 1rem;
            width: 100%;
            max-width: 800px;
            padding: 0.5rem 0;
        }
        .play-btn, .pause-btn, .fullscreen-btn, .theatre-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 1.5rem;
            color: #6677ff;
            padding: 0.25rem;
        }
        .play-btn:hover, .pause-btn:hover, .fullscreen-btn:hover, .theatre-btn:hover { color: #5555ff; }
        .progress-container {
            flex-grow: 1;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .progress-bar {
            flex-grow: 1;
            height: 8px;
            background: #333366;
            border-radius: 4px;
            cursor: pointer;
        }
        .progress {
            height: 100%;
            background: #6677ff;
            border-radius: 4px;
            width: 0;
        }
        .time-display {
            font-size: 0.9rem;
            color: #aaa;
            min-width: 110px;
            text-align: left;
            white-space: nowrap;
        }
        .volume-slider {
            width: 100px;
            height: 8px;
            background: #333366;
            border-radius: 4px;
            cursor: pointer;
            appearance: none;
            outline: none;
        }
        .volume-slider::-webkit-slider-thumb {
            appearance: none;
            width: 12px;
            height: 12px;
            background: #6677ff;
            border-radius: 50%;
            cursor: pointer;
        }
        .volume-slider::-moz-range-thumb {
            width: 12px;
            height: 12px;
            background: #6677ff;
            border-radius: 50%;
            cursor: pointer;
        }
        .video-info {
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem;
        }
        .video-info p {
            font-size: 0.9rem;
            color: #ccc;
        }
        .video-info .video-name {
            font-size: 1.1rem;
            color: #77aaff;
            font-weight: 600;
        }
        .search-bar {
            padding: 0.5rem;
            width: 100%;
            max-width: 600px;
            margin: 1rem auto;
            border: 1px solid #333366;
            border-radius: 4px;
            background: #1a1a2e;
            color: #eee;
            font-size: 0.9rem;
        }
        .library-container {
            flex: 1;
            background: #1a1a2e;
            padding: 1rem;
            overflow-y: auto;
        }
        .video-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
            gap: 0.2rem;
            list-style: none;
            padding: 0;
        }
        .video-list li {
            background: #222244;
            border-radius: 6px;
            overflow: hidden;
            transition: transform 0.2s;
            margin-bottom: 0.2rem;
        }
        .video-list li:hover { transform: scale(1.05); }
        .video-list li a {
            display: flex;
            flex-direction: column;
            padding: 0.3rem;
            color: #eee;
            text-decoration: none;
            font-size: 0.8rem;
        }
        .video-list li a.active { background: #6677ff; color: white; }
        .video-list img {
            width: 100%;
            height: 80px;
            object-fit: cover;
            border-bottom: 1px solid #333366;
        }
        .video-name {
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .error-message {
            color: #ff5555;
            text-align: center;
            padding: 1rem;
            font-size: 0.9rem;
        }
        .pagination {
            display: flex;
            gap: 1rem;
            justify-content: center;
            margin-top: 1rem;
        }
        .pagination-btn {
            display: inline-block;
            padding: 0.5rem 1rem;
            background: #444488;
            color: white;
            border-radius: 4px;
            text-decoration: none;
        }
        .pagination-btn:hover { background: #5555aa; }
        .pagination-btn.disabled { background: #333366; cursor: not-allowed; }

        /* Modal styles */
        .modal {
            display: none;
            position: fixed;
            z-index: 2000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.7);
            align-items: center;
            justify-content: center;
        }
        .modal-content {
            background: #1a1a2e;
            padding: 2rem;
            border-radius: 8px;
            border: 1px solid #333366;
            width: 90%;
            max-width: 520px;
            color: #eee;
            position: relative;
        }
        .close {
            position: absolute;
            right: 1.5rem;
            top: 1rem;
            color: #aaa;
            font-size: 1.8rem;
            font-weight: bold;
            cursor: pointer;
        }
        .close:hover { color: #fff; }
        .modal h2 { color: #77aaff; margin-bottom: 1.5rem; }
        .upload-section {
            margin: 1.5rem 0;
            padding: 1.2rem;
            background: #111122;
            border-radius: 6px;
            border: 1px solid #333366;
        }
        .upload-section h3 { margin-bottom: 1rem; color: #77aaff; }
        .upload-section form { display: flex; flex-direction: column; gap: 1rem; }
        .upload-section input[type="file"], .upload-section select {
            padding: 0.6rem;
            background: #222244;
            border: 1px solid #333366;
            color: #eee;
            border-radius: 4px;
        }
        .upload-section button {
            background: #6677ff;
            color: white;
            border: none;
            padding: 0.8rem;
            border-radius: 6px;
            cursor: pointer;
        }
        .upload-section button:hover { background: #5555ff; }
        .progress-container-modal {
            height: 6px;
            background: #333366;
            border-radius: 3px;
            margin: 0.6rem 0;
            overflow: hidden;
        }
        .progress-bar-modal {
            height: 100%;
            background: #6677ff;
            width: 0%;
            transition: width 0.2s;
        }
        .status-message {
            min-height: 1.3rem;
            padding: 0.6rem;
            border-radius: 4px;
            font-size: 0.95rem;
        }
        .status-message.success { background: #2a6633; color: #d4f4d4; }
        .status-message.error { background: #662a2a; color: #f4d4d4; }

        /* Theatre mode */
        .theatre-mode .video-wrapper {
            max-width: 95vw !important;
            margin: 0 auto;
        }
        .theatre-mode .main-video {
            max-width: none;
            width: 100%;
        }

        /* Hide custom controls in fullscreen */
        .video-wrapper:fullscreen .controls,
        .video-wrapper:fullscreen .video-info {
            display: none !important;
        }

        /* Mobile adjustments */
        @media (max-width: 768px) {
            .navbar-links {
                display: none;
            }
            .hamburger {
                display: block;
            }
            .navbar-right {
                gap: 0.8rem;
            }
        }
/* =====================================================
   Folder sidebar + drag-and-drop
   ===================================================== */

.player-layout {
    display: flex;
    gap: 0;
    max-width: 100%;
    margin-top: 70px;
    min-height: calc(100vh - 70px);
}

.folder-sidebar {
    width: 220px;
    min-width: 180px;
    background: #141426;
    border-right: 1px solid #2a2a44;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    flex-shrink: 0;
}

.folder-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem 0.75rem;
    border-bottom: 1px solid #2a2a44;
}

.folder-sidebar-header h3 {
    font-size: 0.95rem;
    color: #aab;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.btn-new-folder {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #445;
    background: #222244;
    color: #88aaff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.btn-new-folder:hover {
    background: #6677ff;
    color: #fff;
    border-color: #6677ff;
}

.folder-list {
    list-style: none;
    margin: 0.5rem 0;
    padding: 0;
    flex: 1;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    cursor: pointer;
    color: #ccc;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
    position: relative;
    user-select: none;
}
.folder-item:hover {
    background: #1e1e36;
    color: #fff;
}
.folder-item.active {
    background: #2a2a55;
    color: #fff;
    border-left: 3px solid #6677ff;
    padding-left: calc(1rem - 3px);
}
.folder-item.drag-over {
    background: #334466 !important;
    outline: 2px dashed #6677ff;
    outline-offset: -2px;
}

.folder-icon { font-size: 1rem; flex-shrink: 0; }
.folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.folder-count {
    font-size: 0.75rem;
    color: #778;
    background: #1a1a2e;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    min-width: 1.5rem;
    text-align: center;
}
.folder-item.active .folder-count { color: #aaf; background: #333366; }

.folder-delete-btn {
    display: none;
    background: none;
    border: none;
    color: #f66;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}
.folder-item:hover .folder-delete-btn { display: inline; }

.folder-drop-hint {
    font-size: 0.7rem;
    color: #556;
    padding: 0.5rem 1rem;
    text-align: center;
    border-top: 1px solid #2a2a44;
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.library-header h3 {
    margin: 0;
    font-size: 1.1rem;
}
.lib-count { color: #778; font-weight: 400; font-size: 0.9rem; }

.video-list .video-item {
    cursor: grab;
}
.video-list .video-item:active {
    cursor: grabbing;
}
.video-list .video-item.dragging {
    opacity: 0.45;
}

.video-folder-label {
    font-size: 0.85rem;
    color: #889;
    margin-top: 0.25rem;
}

.empty-msg {
    text-align: center;
    color: #888;
    padding: 1.5rem;
}

.page-info {
    color: #889;
    font-size: 0.9rem;
    padding: 0 0.5rem;
}

/* New folder modal (simple prompt fallback uses native; styled toast optional) */
.folder-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #1a1a2e;
    border: 1px solid #445;
    color: #eee;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    font-size: 0.9rem;
}
.folder-toast.error { border-color: #a44; color: #fcc; }
.folder-toast.success { border-color: #4a4; color: #cfc; }

@media (max-width: 900px) {
    .player-layout { flex-direction: column; }
    .folder-sidebar {
        width: 100%;
        height: auto;
        max-height: 180px;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid #2a2a44;
    }
    .folder-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.5rem;
    }
    .folder-item {
        border-radius: 6px;
        padding: 0.4rem 0.75rem;
    }
    .folder-item.active {
        border-left: none;
        padding-left: 0.75rem;
    }
    .folder-drop-hint { display: none; }
}

.folder-header-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}
.btn-edit-lock {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #445;
    background: #222244;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.btn-edit-lock.unlocked {
    background: #2a4a2a;
    border-color: #4a4;
}
.btn-new-folder:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.folder-sidebar.edit-locked .folder-delete-btn {
    display: none !important;
}
.video-list.edit-locked .video-item {
    cursor: default;
}
.video-list.edit-locked .video-item[draggable="true"] {
    /* still draggable attribute but we prevent in JS */
}
