/* assets/css/style.css */
:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --primary: #bb86fc;
    --secondary: #03dac6;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --border: #333;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
}

.navbar {
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--primary);
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.btn {
    background: var(--primary);
    color: #000;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--secondary);
}

/* Auth Forms */
.auth-box {
    max-width: 400px;
    margin: 4rem auto;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    background: #2c2c2c;
    border: 1px solid var(--border);
    color: white;
    border-radius: 4px;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* ── List View Mode ── */
.video-grid.list-view {
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

/* Card row: fixed height, horizontal layout */
.video-grid.list-view .video-card {
    flex-direction: row !important;
    height: 110px !important;
    align-items: center;
}

.video-grid.list-view .video-card-container {
    flex-direction: row !important;
    height: 110px !important;
    align-items: center;
    overflow: hidden;
}

.video-grid.list-view .video-card-container > .video-card {
    height: 100% !important;
}

/* Heart: LEFT side, minimal spacing */
.video-grid.list-view .fav-heart {
    position: static;
    flex-shrink: 0;
    align-self: center;
    padding: 0 0.5rem;
    font-size: 1.2rem;
    order: -1;
}

/* The <a> wrapping thumbnail + info */
.video-grid.list-view .video-card > a {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

/* Thumbnail */
.video-grid.list-view .video-thumbnail {
    width: 160px;
    min-width: 160px;
    height: 110px;
    flex-shrink: 0;
}

.video-grid.list-view .video-thumbnail video {
    width: 160px;
    height: 110px;
    object-fit: cover;
}

/* Info block: fixed width for consistency */
.video-grid.list-view .video-info {
    width: 220px;
    min-width: 180px;
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
}

.video-grid.list-view .video-title {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.video-grid.list-view .video-meta {
    font-size: 0.8rem;
}

/* Extra block: links + tags stacked vertically in list */
.video-grid.list-view .card-extra {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    padding: 0 0.75rem;
    min-width: 0;
    overflow: hidden;
}

.video-grid.list-view .card-links {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}

.video-grid.list-view .card-links > div {
    font-size: 0.8rem !important;
    margin-top: 0 !important;
}

.video-grid.list-view .card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.video-grid.list-view .category-badge {
    font-size: 0.6rem;
    padding: 1px 5px;
}

.video-grid.list-view .video-card:hover {
    transform: none;
}

/* ── Card Extra: Base (Grid View) ── */
.card-extra {
    padding: 0 0.75rem 0.75rem;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 0.35rem;
}


.video-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.video-card-container > .video-card {
    background: transparent;
    border-radius: 0;
}

.video-card:hover {
    transform: translateY(-5px);
}

.video-thumbnail {
    width: 100%;
    height: 180px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.video-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-info {
    padding: 1rem;
}

.video-title {
    font-size: 1.1rem;
    margin: 0 0 0.5rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.tag {
    background: #333;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.category-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(187, 134, 252, 0.8);
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 5;
    pointer-events: none;
}

/* Player Controls */
.player-container {
    max-width: 900px;
    margin: 0 auto;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    background: #000;
}

.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.controls-bar {
    background: var(--card-bg);
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
    border-radius: 8px;
}

/*  Favorites Heart  */
.fav-heart {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    z-index: 10;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
}

.fav-heart:hover {
    transform: scale(1.2);
}

/* Tag Category Colors */
.tag-style {
    background: rgba(33, 150, 243, 0.2);
    color: #2196F3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.tag-technical {
    background: rgba(255, 152, 0, 0.2);
    color: #FF9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.tag-level {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.tag-position {
    background: rgba(156, 39, 176, 0.2);
    color: #9C27B0;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.tag-origin {
    background: rgba(233, 30, 99, 0.2);
    color: #E91E63;
    border: 1px solid rgba(233, 30, 99, 0.3);
}

.tag-other {
    background: rgba(158, 158, 158, 0.2);
    color: #9E9E9E;
    border: 1px solid rgba(158, 158, 158, 0.3);
}

.tag-badge {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-block;
    margin: 2px;
}

/* ── Shared Management Styles ── */
.manage-box {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    max-width: 800px;
    margin: 0 auto;
}

.manage-box h2 {
    margin-top: 0;
}

.manage-container {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.manage-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.manage-table th,
.manage-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #333;
    vertical-align: middle;
}

.manage-table th {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.item-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.item-table th,
.item-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #333;
    text-align: left;
}

.item-table th {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.item-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.inline-input {
    background: transparent;
    border: 1px solid transparent;
    padding: 4px 8px;
    color: inherit;
    width: 100%;
}

.inline-input:focus {
    border-color: var(--primary);
    outline: none;
}

.btn-icon {
    padding: 3px 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-del {
    background: transparent;
    border: 1px solid #cf6679;
    color: #cf6679;
}

.btn-danger {
    background: transparent;
    border: 1px solid #cf6679;
    color: #cf6679;
}

.mini-thumb {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    background: #000;
}

/* ── Modals ── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.modal-box {
    background: var(--card-bg);
    width: 90%;
    max-width: 450px;
    margin: 80px auto;
    padding: 2rem;
    border-radius: 8px;
}

/* ── Role Badge ── */
.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.role-admin {
    background: rgba(187, 134, 252, 0.2);
    color: var(--primary);
}

.role-user {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

/* ── Quota Bar ── */
.quota-bar {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.quota-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.quota-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Filter Header ── */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-header .search-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-header input {
    max-width: 300px;
}

/* ── Sorting ── */
.sort-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.sort-link:hover {
    color: var(--primary);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    color: white;
    background: #333;
    font-size: 0.85rem;
}

.pagination .active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    font-weight: bold;
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Action Bar (Bulk) ── */
.action-bar {
    position: sticky;
    top: 20px;
    background: var(--surface, #2c2c2c);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    margin-bottom: 1.5rem;
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.action-bar.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Video Meta Links ── */
.meta-link {
    text-decoration: none;
    position: relative;
    z-index: 2;
}

.meta-link:hover {
    text-decoration: underline;
}

.meta-link-song {
    color: var(--primary);
}

.meta-link-teacher {
    color: #ccc;
}
/* Refactored Classes */
.landing-card {
    max-width: 400px;
    margin: 4rem auto;
    text-align: center;
    background: var(--surface);
    padding: 2rem;
    border-radius: 8px;
}
.btn-block {
    display: block;
    margin-bottom: 1rem;
    padding: 10px;
}
.controls-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}
.view-toggle {
    background: var(--card-bg);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    gap: 4px;
}
.btn-sm {
    padding: 4px 10px;
    font-size: 0.9rem;
}
.section-mb {
    margin-bottom: 3rem;
}
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    color: var(--text-muted);
}

/* --- Extracted Inline Styles from Phase B --- */

/* From bulk_upload.php */
/* ── Drop Zone ── */
        .drop-zone {
            border: 2px dashed var(--primary);
            border-radius: 12px;
            padding: 3rem 2rem;
            text-align: center;
            cursor: pointer;
            transition: background 0.2s, border-color 0.2s;
            background: rgba(187, 134, 252, 0.05);
            margin-bottom: 1rem;
        }
        .drop-zone.dragover {
            background: rgba(187, 134, 252, 0.15);
            border-color: var(--secondary);
        }
        .drop-zone h3 { margin: 0 0 0.5rem 0; color: var(--primary); }
        .drop-zone p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

        /* ── Progress ── */
        .upload-progress { margin-bottom: 2rem; }
        .progress-item {
            background: var(--card-bg);
            border-radius: 6px;
            padding: 0.5rem 1rem;
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            gap: 1rem;
        }
        .progress-item .name { flex: 1; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .progress-bar-bg {
            width: 120px;
            height: 6px;
            background: #333;
            border-radius: 3px;
            overflow: hidden;
        }
        .progress-bar-fill {
            height: 100%;
            background: var(--primary);
            border-radius: 3px;
            transition: width 0.3s;
        }
        .progress-item .status { font-size: 0.8rem; color: var(--text-muted); width: 60px; text-align: right; }

        /* ── Staging Table ── */
        .staging-section { margin-top: 2rem; }
        .staging-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }
        .staging-header h2 { margin: 0; }
        .staging-actions { display: flex; gap: 0.5rem; }

        .staging-card {
            background: var(--card-bg);
            border-radius: 8px;
            padding: 1rem;
            margin-bottom: 1rem;
            display: grid;
            grid-template-columns: 160px 1fr auto;
            gap: 1rem;
            align-items: start;
        }
        .staging-preview {
            width: 160px;
            height: 100px;
            background: #000;
            border-radius: 6px;
            overflow: hidden;
            flex-shrink: 0;
        }
        .staging-preview video {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .staging-fields {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.5rem;
        }
        .staging-fields .full-width { grid-column: 1 / -1; }
        .staging-fields label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 2px; display: block; }
        .staging-fields input,
        .staging-fields select,
        .staging-fields textarea {
            width: 100%;
            padding: 0.35rem 0.5rem;
            background: #2c2c2c;
            border: 1px solid var(--border);
            color: white;
            border-radius: 4px;
            font-size: 0.85rem;
            box-sizing: border-box;
        }
        .staging-fields textarea { resize: vertical; min-height: 40px; }
        .staging-card-actions {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }
        .btn-publish { background: #4caf50; color: #fff; font-size: 0.85rem; padding: 0.4rem 0.8rem; }
        .btn-discard { background: #f44336; color: #fff; font-size: 0.85rem; padding: 0.4rem 0.8rem; }
        .btn-publish:hover, .btn-discard:hover { opacity: 0.85; }

        .tag-pills { display: flex; flex-wrap: wrap; gap: 4px; }
        .tag-pill {
            background: #444;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 0.8rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
            user-select: none;
        }
        .tag-pill.active { background: var(--primary); color: #000; }
        .tag-pill input { display: none; }

        .save-indicator {
            font-size: 0.75rem;
            color: var(--secondary);
            opacity: 0;
            transition: opacity 0.3s;
        }
        .save-indicator.show { opacity: 1; }

        .empty-staging {
            text-align: center;
            padding: 3rem;
            color: var(--text-muted);
        }

        @media (max-width: 768px) {
            .staging-card {
                grid-template-columns: 1fr;
            }
            .staging-preview { width: 100%; height: 140px; }
            .staging-fields { grid-template-columns: 1fr; }
        }

/* From capsules.php */
.capsule-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }
        .capsule-card {
            background: var(--card-bg);
            border-radius: 8px;
            overflow: hidden;
            transition: transform 0.2s, box-shadow 0.2s;
            cursor: pointer;
            position: relative;
            display: flex;
            flex-direction: column;
            text-decoration: none;
            color: inherit;
            border: 1px solid #333;
        }
        .capsule-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.4);
            border-color: var(--primary);
        }
        .capsule-thumb {
            width: 100%;
            aspect-ratio: 16/9;
            background: #000;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }
        .capsule-thumb video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            opacity: 0.6;
        }
        .capsule-play-overlay {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 2.5rem;
            color: white;
            opacity: 0.8;
            pointer-events: none;
        }
        .capsule-info {
            padding: 1rem;
        }
        .capsule-title {
            font-size: 1rem;
            font-weight: bold;
            margin-bottom: 5px;
            color: var(--primary);
        }
        .capsule-subtitle {
            font-size: 0.8rem;
            color: #aaa;
            margin-bottom: 10px;
        }
        .capsule-duration {
            position: absolute;
            bottom: 10px;
            right: 10px;
            background: rgba(0,0,0,0.8);
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 0.75rem;
        }
        
        .pagination {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 3rem;
            margin-bottom: 2rem;
        }

/* From manage_all_videos.php */
.badge-owner {
            background: rgba(255,255,255,0.05);
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 0.8rem;
            color: #aaa;
        }

/* From manage_tags.php */
.category-group { margin-bottom: 1.5rem; }
        .category-header {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 0;
            border-bottom: 2px solid;
            margin-bottom: 0.5rem;
            font-weight: bold;
            font-size: 1rem;
        }
        .category-dot {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            display: inline-block;
        }
        .count-badge {
            background: rgba(255,255,255,0.1);
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: normal;
        }
        .search-box { margin-bottom: 1rem; }
        .inline-select {
            background: #2c2c2c;
            border: 1px solid transparent;
            padding: 4px 8px;
            color: inherit;
            border-radius: 4px;
            width: 100%;
        }
        .inline-select:focus { border-color: var(--primary); outline: none; }
        .cat-row {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 0.75rem;
            border-bottom: 1px solid #333;
        }
        .cat-row:last-child { border-bottom: none; }
        .cat-section {
            background: rgba(0,0,0,0.15);
            border-radius: 8px;
            padding: 1rem;
            margin-bottom: 1.5rem;
            border: 1px solid #333;
        }
        .cat-section summary {
            cursor: pointer;
            font-weight: bold;
            margin-bottom: 0.75rem;
        }

/* From manage_users.php */
.manage-container {
            background: var(--card-bg);
            padding: 1.5rem;
            border-radius: 8px;
            margin-bottom: 2rem;
            overflow-x: auto;
        }

        .manage-table {
            width: 100%;
            border-collapse: collapse;
            text-align: left;
        }

        .manage-table th, .manage-table td {
            padding: 0.75rem 1rem;
            border-bottom: 1px solid #333;
            vertical-align: middle;
        }

        .manage-table th {
            color: var(--text-muted);
            font-size: 0.85rem;
            text-transform: uppercase;
        }

        .role-badge {
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 0.8rem;
            font-weight: bold;
        }

        .role-admin { background: rgba(187,134,252,0.2); color: var(--primary); }
        .role-user { background: rgba(255,255,255,0.1); color: #ccc; }

        .quota-bar {
            width: 100%;
            height: 6px;
            background: #333;
            border-radius: 3px;
            overflow: hidden;
            margin-top: 4px;
        }

        .quota-bar-fill {
            height: 100%;
            border-radius: 3px;
            transition: width 0.3s;
        }

        .quota-text {
            font-size: 0.75rem;
            color: var(--text-muted);
        }

        .modal-overlay {
            display: none;
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: rgba(0,0,0,0.8);
            z-index: 1000;
        }

        .modal-box {
            background: var(--card-bg);
            width: 90%;
            max-width: 450px;
            margin: 80px auto;
            padding: 2rem;
            border-radius: 8px;
        }

/* From manage_video_types.php */
.type-row {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.6rem 0.75rem;
            border: 1px solid #333;
            border-radius: 6px;
            margin-bottom: 0.5rem;
            transition: border-color 0.2s;
        }
        .type-row:hover { border-color: var(--primary); }
        .type-input {
            background: transparent;
            border: 1px solid transparent;
            padding: 4px 8px;
            color: inherit;
            font-size: 0.9rem;
        }
        .type-input:focus { border-color: var(--primary); outline: none; background: #2c2c2c; border-radius: 4px; }
        .type-id { width: 130px; font-weight: bold; color: var(--primary); }
        .type-label { flex: 1; }
        .type-count { min-width: 80px; text-align: center; font-size: 0.85rem; }
        .type-count span { background: rgba(187,134,252,0.15); color: var(--primary); padding: 2px 10px; border-radius: 10px; font-weight: 500; }

/* From manage_videos.php */
.sort-link small { font-size: 0.7rem; }

/* From playlists.php */
.sortable-ghost { opacity: 0.3; border: 2px dashed var(--primary) !important; }
        .drag-handle { cursor: grab; color: #555; padding: 4px 8px; font-size: 1.2rem; user-select: none; }
        .drag-handle:active { cursor: grabbing; }
        .playlist-card-wrapper { position: relative; }

/* From profile.php */
.profile-grid {
            display: grid;
            grid-template-columns: 300px 1fr;
            gap: 2rem;
            align-items: start;
        }

        @media (max-width: 768px) {
            .profile-grid { grid-template-columns: 1fr; }
        }

        .profile-sidebar {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 2rem;
            text-align: center;
        }

        .profile-avatar {
            width: 120px;
            height: 120px;
            border-radius: 50%;
            border: 3px solid var(--primary);
            margin: 0 auto 1rem;
            object-fit: cover;
        }

        .profile-name {
            font-size: 1.4rem;
            font-weight: bold;
            margin-bottom: 0.25rem;
        }

        .profile-role {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 0.75rem;
            font-weight: bold;
            text-transform: uppercase;
            margin-bottom: 1rem;
        }

        .profile-role.admin { background: rgba(187,134,252,0.2); color: var(--primary); }
        .profile-role.user { background: rgba(255,255,255,0.1); color: #ccc; }

        .profile-stat-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.75rem;
            margin-top: 1.5rem;
            text-align: center;
        }

        .stat-card {
            background: rgba(255,255,255,0.05);
            border-radius: 8px;
            padding: 0.75rem 0.5rem;
        }

        .stat-value {
            font-size: 1.5rem;
            font-weight: bold;
            color: var(--primary);
        }

        .stat-label {
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-top: 2px;
        }

        .profile-main {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .profile-section {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 1.5rem 2rem;
        }

        .profile-section h3 {
            margin-bottom: 1rem;
            padding-bottom: 0.5rem;
            border-bottom: 1px solid #333;
        }

        .form-row {
            display: flex;
            gap: 1rem;
            margin-bottom: 1rem;
        }

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

        .quota-bar-large {
            width: 100%;
            height: 10px;
            background: #333;
            border-radius: 5px;
            overflow: hidden;
            margin-top: 8px;
        }

        .quota-bar-large-fill {
            height: 100%;
            border-radius: 5px;
            transition: width 0.4s ease;
        }

        .success-msg {
            color: #03dac6;
            font-size: 0.9rem;
            margin-top: 0.5rem;
            display: none;
        }

        .error-msg {
            color: #cf6679;
            font-size: 0.9rem;
            margin-top: 0.5rem;
            display: none;
        }

        .share-list {
            list-style: none;
            padding: 0;
            margin-top: 1rem;
        }

        .share-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(255,255,255,0.03);
            border: 1px solid #333;
            border-radius: 8px;
            padding: 0.75rem 1rem;
            margin-bottom: 0.75rem;
            transition: border-color 0.2s;
        }

        .share-item:hover {
            border-color: rgba(187,134,252,0.3);
        }

        .share-info {
            flex-grow: 1;
        }

        .share-title {
            font-weight: bold;
            color: var(--primary);
            font-size: 0.95rem;
            margin-bottom: 2px;
        }

        .share-meta {
            font-size: 0.75rem;
            color: #888;
        }

        .share-actions {
            display: flex;
            gap: 8px;
            margin-left: 1rem;
        }

/* From settings.php */
.settings-section {
            background: var(--card-bg);
            padding: 1.5rem;
            border-radius: 8px;
            margin-bottom: 1.5rem;
        }
        .settings-section h3 { margin-top: 0; margin-bottom: 1rem; border-bottom: 1px solid #333; padding-bottom: 0.5rem; }
        .sub-link {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.75rem 1rem;
            border: 1px solid #333;
            border-radius: 6px;
            margin-bottom: 0.5rem;
            text-decoration: none;
            color: inherit;
            transition: border-color 0.2s, background 0.2s;
        }
        .sub-link:hover { border-color: var(--primary); background: rgba(255,255,255,0.02); }
        .sub-link .arrow { color: var(--text-muted); font-size: 1.2rem; }
        .scan-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
        .scan-table th, .scan-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #333; text-align: left; }
        .scan-table th { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; }
        .imported-row { opacity: 0.4; pointer-events: none; }

/* From watch.php */
.player-wrapper {
            background: #000;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 20px 50px rgba(0,0,0,0.5);
            border: 1px solid rgba(187,134,252,0.2);
            position: relative;
            max-height: 85vh;
            display: flex;
            flex-direction: column;
        }
        #mainVideo {
            flex: 1;
            min-height: 0;
            max-height: calc(85vh - 70px); /* Adjust for controls height */
            object-fit: contain;
            background: #000;
        }
        .mirrored { transform: scaleX(-1); }

/* From watch_capsule.php */
.watch-container {
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }
        .player-wrapper {
            background: #000;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 20px 50px rgba(0,0,0,0.5);
            border: 1px solid rgba(187,134,252,0.2);
            position: relative;
            max-height: 85vh;
            display: flex;
            flex-direction: column;
        }
        #mainVideo {
            flex: 1;
            min-height: 0;
            max-height: calc(85vh - 70px); /* Adjust for controls height */
            object-fit: contain;
            background: #000;
        }
        .meta-section {
            margin-top: 2rem;
            background: var(--card-bg);
            padding: 2rem;
            border-radius: 12px;
            border: 1px solid #333;
        }
        .back-nav {
            margin-bottom: 1.5rem;
        }
        .btn-back {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            color: var(--primary);
            text-decoration: none;
            font-weight: bold;
            transition: transform 0.2s;
        }
        .btn-back:hover {
            transform: translateX(-5px);
        }

/* ── Playlist Playback Params UI ── */

/* Botones de selección de velocidad y modo bucle */
.speed-opt.active,
.loop-opt.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    font-weight: bold;
}
.speed-opt:hover,
.loop-opt:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Toggle switch (checkbox estilo iOS) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #444;
    border-radius: 24px;
    transition: background 0.25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #ccc;
    border-radius: 50%;
    transition: transform 0.25s, background 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #000;
}

/* Badge de parámetros en sidebar de playlists */
.playlist-params-badge {
    font-size: 0.7rem;
    color: var(--primary);
    background: rgba(187,134,252,0.08);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid rgba(187,134,252,0.15);
    margin-top: 3px;
    display: inline-block;
}

/* Meta Link for Video Sources */
.meta-link-source {
    color: #ffb74d;
}

