/* Minimal Dark Theme */

@font-face {
    font-family: 'Geist';
    src: url('https://cdn.jsdelivr.net/npm/geist@1.2.2/dist/fonts/geist-sans/Geist-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geist';
    src: url('https://cdn.jsdelivr.net/npm/geist@1.2.2/dist/fonts/geist-sans/Geist-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geist';
    src: url('https://cdn.jsdelivr.net/npm/geist@1.2.2/dist/fonts/geist-sans/Geist-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e8e8e8;
    --bg-hover: #f0f0f0;
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #9b9b9b;
    --accent: #ff385c;
    --accent-light: #fce4f0;
    --border: #e0e0e0;
}

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
}

/* Header */
.site-header {
    background: var(--bg-primary);
    padding: 8px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-top: 2px solid var(--accent);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.site-header .search-box {
    flex: 1;
    max-width: 500px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-tube {
    background: var(--accent);
    color: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
}

.logo-broadcast {
    display: none;
}

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

.header-actions {
    display: flex;
    gap: 8px;
}

/* Typography */
h2 {
    color: var(--text-primary);
    margin: 20px 0 16px;
    font-size: 16px;
    font-weight: 500;
}

/* Search Box */
.search-box {
    display: flex;
}

.search-box input {
    padding: 8px 16px;
    border: none;
    border-radius: 20px 0 0 20px;
    font-size: 14px;
    flex: 1;
    min-width: 0;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
}

.search-box button {
    padding: 8px 20px;
    border: none;
    border-radius: 0 20px 20px 0;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
}

.search-box button:hover {
    background: var(--bg-hover);
}

/* Buttons */
button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: background 0.2s;
}

button:hover {
    background: var(--bg-tertiary);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    background: var(--accent);
}

.btn-danger {
    background: transparent;
    color: #f44;
}

.btn-danger:hover {
    background: rgba(255, 68, 68, 0.1);
}

.btn-toggle {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-toggle.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Status Bar */
.status-bar {
    background: var(--bg-secondary);
    padding: 8px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    border-radius: 8px;
}

.status-item {
    display: inline-block;
}

.status-item span {
    color: var(--text-secondary);
}

.status-item strong {
    color: var(--accent);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 12px 16px;
    text-align: left;
}

th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-online {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.status-offline {
    background: rgba(127, 127, 127, 0.2);
    color: #888;
}

.status-downloading {
    background: rgba(62, 166, 255, 0.2);
    color: var(--accent);
}

.status-completed {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.status-failed {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.status-inactive {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

.actions {
    display: flex;
    gap: 8px;
}

.empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.refresh-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 24px;
}

/* Dialogs */
dialog {
    background: var(--bg-primary);
    border: none;
    border-radius: 12px;
    padding: 0;
    color: var(--text-primary);
    max-width: 90vw;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    box-shadow: 0 4px 32px rgba(0,0,0,0.15);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.8);
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.dialog-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
}

.dialog-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 50%;
}

.dialog-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dialog-body {
    padding: 20px;
}

.dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 16px;
}

/* Admin mode */
.admin-only {
    display: none !important;
}

body.admin-mode .admin-only {
    display: inline-block !important;
}

body.admin-mode .header-actions.admin-only {
    display: flex !important;
}

body.admin-mode .status-bar.admin-only {
    display: block !important;
}

body.admin-mode .card-actions.admin-only {
    display: flex !important;
}

/* Error Message */
.error-message {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
}

.error-message h2 {
    color: var(--text-primary);
    margin-bottom: 12px;
}

.error-message p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.error-message a {
    color: var(--accent);
    text-decoration: none;
}

.error-message a:hover {
    text-decoration: underline;
}

/* Video Player */
.video-container {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.video-container video {
    width: 100%;
    display: block;
}

.video-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
}

.video-container.fullscreen video {
    height: 100%;
    object-fit: contain;
}

.video-container.fullscreen .video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 40px 12px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.video-container:hover .video-controls {
    opacity: 1;
}

.video-controls button {
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px;
    font-size: 16px;
    border-radius: 50%;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-controls button:hover {
    background: rgba(255,255,255,0.1);
}

.video-progress {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.video-progress:hover {
    height: 6px;
}

.video-progress-filled {
    height: 100%;
    background: #ff385c;
    width: 0%;
    border-radius: 2px;
    position: relative;
}

.video-progress-filled::after {
    display: none;
}

.video-progress:hover .video-progress-filled::after {
    display: block;
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #ff385c;
    border-radius: 50%;
}

.video-time {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    min-width: 80px;
    text-align: center;
}

.video-volume {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-volume-slider {
    width: 60px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    cursor: pointer;
}

.video-volume-filled {
    height: 100%;
    background: #fff;
    width: 100%;
    border-radius: 2px;
}

/* Cards & Gallery */
.downloads-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.download-card {
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s;
}

.download-card:hover {
    transform: translateY(-2px);
}

.card-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
}

.card-thumbnail video,
.card-thumbnail img.thumb-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.card-thumbnail-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 20px;
}

.card-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s;
}

.card-thumbnail:hover .card-play-overlay {
    opacity: 1;
}

.card-play-btn {
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}

.card-status-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
}

.card-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
}

.card-body {
    padding: 12px 4px;
}

.card-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    display: block;
}

.card-title:hover {
    color: var(--accent);
}

.card-filename {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.card-views {
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    gap: 4px;
}

.downloads-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    grid-column: 1 / -1;
    background: var(--bg-secondary);
    border-radius: 12px;
}

/* Shimmer Loading */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.shimmer {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-card {
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
}

.skeleton-thumbnail {
    aspect-ratio: 16/9;
    border-radius: 12px;
    background: var(--bg-secondary);
}

.skeleton-body {
    padding: 12px 4px;
}

.skeleton-title {
    height: 14px;
    border-radius: 4px;
    margin-bottom: 8px;
    width: 90%;
}

.skeleton-meta {
    height: 12px;
    border-radius: 4px;
    width: 60%;
}

.skeleton-channel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px;
}

.skeleton-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
}

.skeleton-name {
    height: 12px;
    border-radius: 4px;
    width: 60px;
}

.skeleton-text {
    height: 24px;
    border-radius: 6px;
}

.skeleton-text-sm {
    height: 14px;
    border-radius: 4px;
}

/* Sidebar */
.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-header {
    color: var(--text-secondary);
    padding: 8px 0;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-item {
    display: flex;
    gap: 12px;
    padding: 8px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    margin: 0 -8px;
}

.sidebar-item:hover {
    background: var(--bg-hover);
}

.sidebar-thumb {
    width: 168px;
    height: 94px;
    background: var(--bg-tertiary);
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 8px;
    position: relative;
}

.sidebar-thumb video,
.sidebar-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

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

.sidebar-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.sidebar-channel {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
}

.sidebar-channel:hover {
    color: var(--text-primary);
}

.sidebar-views {
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.sidebar-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .site-header .container {
        flex-wrap: wrap;
        gap: 12px;
    }

    .logo {
        order: 1;
    }

    .site-header .search-box {
        order: 3;
        flex: 1 1 100%;
        max-width: none;
    }

    .header-actions {
        order: 2;
        gap: 8px;
    }

    .header-actions button {
        padding: 6px 12px;
        font-size: 13px;
    }

    .downloads-gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .card-body {
        padding: 8px 2px;
    }

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

    .card-filename {
        font-size: 11px;
    }

    .card-meta {
        font-size: 11px;
    }

    h2 {
        font-size: 15px;
    }

    .status-bar {
        font-size: 12px;
        padding: 8px 12px;
    }

    dialog {
        max-width: 95vw;
    }

    .search-box input {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .downloads-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .card-play-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    button {
        padding: 6px 12px;
        font-size: 13px;
    }

    .btn-small {
        padding: 4px 8px;
        font-size: 11px;
    }
}
