:root {
    color-scheme: dark;
    --bg: #08090b;
    --surface: #0f1115;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --accent: #00f0ff;
    --text-primary: #f1f5f9;
    --text-muted: #64748b;
    --highlight: inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1f293d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #334155; }

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    padding: 24px 16px;
    -webkit-font-smoothing: antialiased;
}

.crt-overlay {
    position: fixed; inset: 0; width: 100vw; height: 100vh;
    background: linear-gradient(rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.12) 50%);
    background-size: 100% 3px; z-index: 9999; pointer-events: none; opacity: 0.12;
}

.container { max-width: 1200px; margin: 0 auto; }

header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 16px; margin-bottom: 28px;
    padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.brand h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.04em; color: #fff; }
.sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; font-family: monospace; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.tab-btn { background: none; border: none; color: var(--text-muted); padding: 6px 12px; font-size: 0.78rem; border-radius: 6px; cursor: pointer; transition: all 0.15s; }
.tab-btn.active { background: rgba(255,255,255,0.08); color: #fff; }

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

.sort-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 7px 30px 7px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.sort-select:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
}

.sort-select:focus {
    border-color: var(--accent);
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid var(--text-muted);
    border-bottom: 1.5px solid var(--text-muted);
    transform: translateY(-2px) rotate(45deg);
    pointer-events: none;
    transition: border-color 0.15s;
}

.select-wrapper:hover::after {
    border-color: var(--text-primary);
}

.sort-select option {
    background: #0f1115;
    color: #f1f5f9;
    padding: 10px;
}

.search-wrapper { position: relative; display: flex; align-items: center; }
.search-icon { width: 14px; height: 14px; fill: var(--text-muted); position: absolute; left: 10px; }
.search-box {
    background: rgba(255,255,255,0.03); border: 1px solid var(--border);
    color: var(--text-primary); padding: 7px 12px 7px 32px; border-radius: 8px;
    font-size: 0.78rem; outline: none; width: 180px; transition: border-color 0.15s;
}
.search-box:focus { border-color: var(--accent); }
.search-kbd { position: absolute; right: 8px; font-size: 0.65rem; color: var(--text-muted); background: rgba(255,255,255,0.06); padding: 2px 5px; border-radius: 4px; pointer-events: none; }

.btn-action, .btn-manage {
    background: rgba(255,255,255,0.03); border: 1px solid var(--border); color: var(--text-primary);
    padding: 7px 14px; border-radius: 8px; font-size: 0.78rem; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.15s;
}
.btn-action:hover, .btn-manage:hover { background: rgba(255,255,255,0.08); border-color: var(--border-hover); }
.btn-action svg { width: 15px; height: 15px; fill: currentColor; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden; cursor: pointer; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; position: relative;
}
.card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.card.selected { border-color: var(--accent) !important; box-shadow: 0 0 12px rgba(0, 240, 255, 0.2); }

.card-select-wrap { position: absolute; top: 8px; left: 8px; z-index: 15; }
.custom-checkbox { display: block; position: relative; width: 22px; height: 22px; cursor: pointer; }
.custom-checkbox input { display: none; }
.checkbox-mark {
    width: 22px; height: 22px; border-radius: 6px; background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border-hover); transition: all 0.15s;
}
.custom-checkbox input:checked + .checkbox-mark { background: var(--accent); border-color: var(--accent); }
.custom-checkbox input:checked + .checkbox-mark::after {
    content: ''; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
    border: solid #000; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.video-box { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.video-box img { width: 100%; height: 100%; object-fit: cover; }
.video-box video.preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }

.badge-duration, .badge-views {
    position: absolute; bottom: 8px; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,0.75); backdrop-filter: blur(4px);
}
.badge-duration { right: 8px; font-family: monospace; }
.badge-views { left: 8px; display: flex; align-items: center; gap: 4px; color: #cbd5e1; }
.badge-views svg { width: 12px; height: 12px; fill: currentColor; }

.meta { padding: 12px; }
.title { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.info-row { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); }

.card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 10; opacity: 0; transition: opacity 0.15s; }
.card:hover .card-actions { opacity: 1; }
.btn-card {
    width: 28px; height: 28px; border-radius: 6px; background: rgba(0,0,0,0.8);
    border: 1px solid var(--border); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.15s;
}
.btn-card:hover { background: #000; border-color: var(--accent); }
.btn-card svg { width: 14px; height: 14px; fill: currentColor; }
.btn-card.fav.active svg { fill: #ef4444; }

.pagination-wrap { display: flex; justify-content: center; margin-top: 32px; }
.btn-load-more {
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
    color: var(--text-primary); padding: 10px 24px; border-radius: 8px; font-size: 0.82rem; cursor: pointer; transition: all 0.15s;
}
.btn-load-more:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--border-hover); }

.player-modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; }
.player-modal.open { display: flex; }
.player-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.9); backdrop-filter: blur(10px); }

.player-content {
    position: relative; width: 92%; max-width: 960px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.85); z-index: 10;
}
.player-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.85rem; font-weight: 500; }

.video-container {
    position: relative; width: 100%; min-height: 240px; max-height: 72vh;
    background: #000; display: flex; align-items: center; justify-content: center;
}
.video-container video { width: 100%; max-height: 72vh; object-fit: contain; }

.side-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px;
    border-radius: 50%; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--border);
    color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
    opacity: 0; transition: opacity 0.2s, background 0.15s; z-index: 20;
}
.video-container:hover .side-arrow { opacity: 0.8; }
.side-arrow:hover { opacity: 1 !important; background: rgba(0, 0, 0, 0.9); border-color: var(--accent); }
.arrow-left { left: 12px; }
.arrow-right { right: 12px; }
.side-arrow svg { width: 22px; height: 22px; fill: currentColor; }

.heart-pulse {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0);
    pointer-events: none; z-index: 50; opacity: 0;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.35s ease;
}
.heart-pulse.animate { transform: translate(-50%, -50%) scale(1.6); opacity: 1; }
.heart-pulse svg { width: 80px; height: 80px; fill: #ef4444; filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.8)); }

.custom-controls { padding: 12px 16px; background: #080a0e; border-top: 1px solid var(--border); }
.scrub-bar { width: 100%; height: 5px; background: rgba(255,255,255,0.1); border-radius: 3px; cursor: pointer; margin-bottom: 12px; position: relative; }
.scrub-fill { height: 100%; background: var(--accent); width: 0%; border-radius: 3px; }
.ctrl-row { display: flex; justify-content: space-between; align-items: center; }
.ctrl-left, .ctrl-right { display: flex; align-items: center; gap: 14px; font-size: 0.78rem; color: var(--text-muted); }
.btn-ctrl { background: none; border: none; color: #fff; cursor: pointer; display: flex; align-items: center; padding: 4px; border-radius: 4px; }
.btn-ctrl:hover { color: var(--accent); }
.btn-ctrl svg { width: 18px; height: 18px; fill: currentColor; }
#btnFavCurrent.fav-active svg { fill: #ef4444 !important; }

.batch-bar {
    position: fixed; bottom: -80px; left: 50%; transform: translateX(-50%);
    background: #11141a; border: 1px solid var(--border-hover);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85); padding: 10px 20px;
    border-radius: 12px; display: flex; align-items: center; gap: 16px;
    z-index: 900; transition: bottom 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.batch-bar.active { bottom: 24px; }
.batch-info { font-size: 0.82rem; font-weight: 600; color: var(--accent); }
.batch-actions { display: flex; gap: 8px; }
.btn-batch { border: none; padding: 6px 14px; border-radius: 6px; font-size: 0.78rem; font-weight: 500; cursor: pointer; }
.btn-batch.select-all { background: rgba(255, 255, 255, 0.08); color: #fff; }
.btn-batch.delete { background: #ef4444; color: #fff; }
.btn-batch.cancel { background: transparent; color: var(--text-muted); }

.modal { position: fixed; inset: 0; z-index: 1100; display: none; align-items: center; justify-content: center; }
.modal.open { display: flex; background: rgba(0,0,0,0.8); backdrop-filter: blur(6px); }
.modal-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 24px; width: 90%; max-width: 440px; box-shadow: 0 25px 50px rgba(0,0,0,0.9);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; font-size: 0.9rem; font-weight: 600; }
.modal-box input {
    width: 100%; padding: 10px 12px; background: rgba(255,255,255,0.03);
    border: 1px solid var(--border); border-radius: 8px; color: #fff; margin-bottom: 14px; outline: none; font-size: 0.85rem;
}
.modal-box input:focus { border-color: var(--accent); }
.btn-submit {
    width: 100%; padding: 10px; background: var(--accent); color: #000;
    font-weight: 700; border: none; border-radius: 8px; cursor: pointer; transition: opacity 0.15s; font-size: 0.85rem;
}
.btn-submit:hover { opacity: 0.9; }

.stats-dashboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-card { background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border); border-radius: 8px; padding: 10px 6px; text-align: center; }
.stat-num { display: block; font-size: 1.05rem; font-weight: 700; color: var(--accent); font-family: monospace; }
.stat-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }

.dropzone {
    border: 2px dashed var(--border); padding: 24px 16px; text-align: center;
    border-radius: 8px; cursor: pointer; margin-bottom: 14px; font-size: 0.8rem; color: var(--text-muted); transition: all 0.15s;
}
.dropzone:hover, .dropzone.hover { border-color: var(--accent); background: rgba(0, 240, 255, 0.02); }
.drop-icon { width: 32px; height: 32px; fill: var(--text-muted); margin-bottom: 8px; }

.progress-box { display: none; margin: 14px 0; }
.progress-info { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--text-muted); margin-bottom: 6px; }
.progress-bar-bg { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.15s; }

.logout-row { margin-top: 16px; text-align: center; border-top: 1px solid var(--border); padding-top: 14px; }
.btn-logout { background: transparent; border: none; color: #ef4444; font-size: 0.76rem; cursor: pointer; }
.btn-logout:hover { text-decoration: underline; }

.toast {
    position: fixed; bottom: 24px; right: 24px; background: #111827;
    border: 1px solid var(--accent); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
    color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 0.82rem;
    opacity: 0; transform: translateY(10px); transition: all 0.2s; pointer-events: none; z-index: 99999;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.empty { grid-column: 1 / -1; text-align: center; padding: 64px 0; color: var(--text-muted); font-size: 0.85rem; }
