:root {
    --bg-color: #0f0f11;
    --card-bg: #1f1f23;
    --primary: #9146ff;
    --primary-hover: #772ce8;
    --text: #ffffff;
    --text-muted: #adadb8;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text); }

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* Login */
#login-screen { display: flex; justify-content: center; align-items: center; }
.login-box { background: var(--card-bg); padding: 40px; border-radius: 10px; text-align: center; width: 100%; max-width: 400px; }
.login-box input { width: 100%; padding: 12px; margin: 20px 0; border: none; border-radius: 5px; background: #333; color: white; font-size: 16px; }
.login-box button { width: 100%; padding: 12px; background: var(--primary); color: white; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; }
.login-box button:hover { background: var(--primary-hover); }
.error { color: #ff4a4a; margin-top: 10px; }

/* Header */
header { display: flex; justify-content: space-between; align-items: center; padding: 15px 25px; background: var(--card-bg); border-bottom: 1px solid #333; }
.logo { font-size: 22px; font-weight: bold; }
.user-info { color: var(--text-muted); font-size: 14px; }
header button { padding: 10px 20px; background: var(--primary); color: white; border: none; border-radius: 5px; cursor: pointer; }

/* Grid COMPACTO */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; padding: 25px; }
.video-card { background: var(--card-bg); border-radius: 8px; overflow: hidden; cursor: pointer; transition: transform 0.2s; border: 1px solid #333; }
.video-card:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 8px 15px rgba(145, 70, 255, 0.2); border-color: var(--primary); }
.video-thumbnail { width: 100%; height: 130px; background: #000; position: relative; overflow: hidden; display: flex; justify-content: center; align-items: center; color: var(--text-muted); }
.video-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s; }
.video-thumbnail::after { content: '▶'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 35px; color: rgba(255,255,255,0.8); opacity: 0; transition: opacity 0.3s; }
.video-card:hover .video-thumbnail::after { opacity: 1; }
.video-card:hover .video-thumbnail img { opacity: 0.5; }

/* Info de la Tarjeta Compactada */
.video-info { padding: 10px; }
.video-title { font-size: 15px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.video-author { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: var(--card-bg); padding: 25px; border-radius: 10px; width: 90%; max-width: 500px; position: relative; }
.player-content { max-width: 900px; }
.modal-content input[type="text"], .modal-content input[type="password"], .modal-content input[type="file"], .modal-content input[type="date"] { width: 100%; padding: 10px; margin: 8px 0; background: #333; color: white; border: none; border-radius: 5px; outline: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 15px; }
.modal-actions button { padding: 8px 16px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #555; color: white; transition: background 0.2s; }
.btn-secondary:hover { background: #666; }
#compression-status { font-size: 12px; color: #ffeb3b; margin-top: 10px; text-align: center; font-weight: bold; }

/* Player */
.video-wrapper { border-radius: 8px; overflow: hidden; background: #000; box-shadow: 0 5px 20px rgba(0,0,0,0.8); margin-bottom: 12px; }
#main-player { width: 100%; max-height: 70vh; display: block; outline: none; }
.player-header { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.close-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; color: white; font-size: 20px; cursor: pointer; z-index: 10; transition: transform 0.2s; }
.close-btn:hover { transform: scale(1.2); color: #ff4a4a; }
.btn-icon { background: none; border: none; font-size: 18px; cursor: pointer; transition: transform 0.2s; }
.btn-icon:hover { transform: scale(1.2); }
#player-modal { display: flex !important; visibility: hidden; opacity: 0; transition: visibility 0s 0.3s, opacity 0.3s; }
#player-modal:not(.hidden) { visibility: visible; opacity: 1; transition: opacity 0.3s; }

/* Stats Panel & Toolbar Compacta */
.stats-panel { background: #18181b; padding: 10px 25px; display: flex; gap: 30px; border-bottom: 1px solid #333; font-size: 13px; color: #adadb8; }
.stat-item span { color: #fff; font-weight: bold; }

.toolbar { background: #1f1f23; padding: 10px 25px; display: flex; gap: 15px; align-items: center; border-bottom: 1px solid #333; flex-wrap: wrap; }
#search-input { flex-grow: 1; max-width: 350px; padding: 8px 15px; border-radius: 20px; border: 1px solid #444; background: #0f0f11; color: white; outline: none; font-size: 14px; }
#search-input:focus { border-color: var(--primary); }
.filter-toggle { cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 13px; color: #ccc; }
.btn-select { padding: 8px 12px; border-radius: 20px; border: 1px solid #444; background: #0f0f11; color: white; outline: none; cursor: pointer; font-size: 13px; }
.stats-mini { color: #adadb8; font-size: 12px; font-weight: bold; margin-left: auto; }

/* Barra de progreso clásica */
.classic-progress-bar { width: 100%; height: 20px; background: #222; border: 2px solid #555; border-radius: 4px; overflow: hidden; margin-top: 10px; position: relative; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #9146ff, #b983ff); width: 0%; transition: width 0.2s; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 11px; white-space: nowrap; overflow: hidden; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); }
.progress-info { margin-top: 6px; font-size: 12px; text-align: center; color: #ffeb3b; }

/* Botones extra del reproductor */
.player-controls-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid #333; flex-wrap: wrap; gap: 10px; }
.player-actions-left, .player-actions-right { display: flex; gap: 8px; align-items: center; }
.btn-tool { background: #2a2a30; color: #fff; border: none; padding: 7px 10px; border-radius: 5px; cursor: pointer; font-size: 13px; transition: background 0.2s; }
.btn-tool:hover { background: #3f3f46; }
.btn-tool-select { background: #2a2a30; color: #fff; border: none; padding: 7px 10px; border-radius: 5px; cursor: pointer; outline: none; font-size: 13px; }
.btn-danger { background: #ff4a4a; color: white; border: none; padding: 7px 12px; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: bold; transition: background 0.2s; }
.btn-danger:hover { background: #d32f2f; }

/* Alias Input en Header */
.user-info { display: flex; align-items: center; gap: 10px; }
#alias-input { padding: 5px 10px; border-radius: 5px; border: 1px solid #444; background: #333; color: white; max-width: 150px; font-size: 13px; }
.btn-small { padding: 5px 10px; background: var(--primary); color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 12px; }

/* Metadata en las tarjetas (FECHAS MÁS VISIBLES) */
.video-meta-small { font-size: 12px; color: #cccccc; margin-top: 6px; display: flex; justify-content: space-between; align-items: center; font-weight: 500; }

/* Animaciones Guays */
.fade-in { animation: fadeIn 0.4s ease-in; }
.slide-up { animation: slideUp 0.3s cubic-bezier(0.25, 1, 0.5, 1); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Botón de subida gigante */
.btn-upload-huge { margin-left: auto; padding: 10px 20px; background: var(--primary); color: white; border: none; border-radius: 6px; font-weight: bold; font-size: 14px; cursor: pointer; transition: background 0.2s, transform 0.2s; box-shadow: 0 4px 15px rgba(145, 70, 255, 0.3); }
.btn-upload-huge:hover { background: var(--primary-hover); transform: scale(1.05); }

/* Navbar y Header */
.main-nav { display: flex; gap: 15px; }
.nav-btn { background: transparent; color: #adadb8; border: none; font-size: 15px; font-weight: bold; cursor: pointer; padding: 8px; border-bottom: 2px solid transparent; transition: all 0.2s; }
.nav-btn:hover { color: #fff; }
.nav-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Sección Mi Cuenta */
.account-header { display: flex; align-items: center; gap: 15px; padding: 30px 25px; background: linear-gradient(0deg, var(--bg-color), #1a1a1f); border-bottom: 1px solid #333; margin-bottom: 15px;}
.acc-avatar { width: 70px; height: 70px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: bold; box-shadow: 0 0 15px rgba(145, 70, 255, 0.3); }
#acc-alias-display { color: white; font-size: 24px; margin-bottom: 3px; }
#acc-stats { color: #adadb8; font-size: 13px; }

/* Sistema de Notificaciones (Toasts) */
#toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 9999; }
.toast { background: #1f1f23; color: white; padding: 12px 18px; border-radius: 6px; border-left: 4px solid var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.5); font-weight: bold; font-size: 13px; animation: slideInRight 0.3s forwards, fadeOut 0.3s forwards 3s; opacity: 0; }
.toast.error { border-left-color: #ff4a4a; }
.toast.success { border-left-color: #4CAF50; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; display: none; } }

/* Estados Vacíos */
.empty-state { text-align: center; padding: 40px; color: #777; font-size: 16px; font-weight: bold; background: rgba(0,0,0,0.2); border-radius: 8px; margin: 0 25px; }

/* Estilos para la etiqueta de Juego (Badges) */
.game-badge { background: #1a1a1f; color: var(--primary); font-size: 10px; padding: 2px 6px; border-radius: 4px; display: inline-block; margin-bottom: 4px; border: 1px solid var(--primary); text-transform: uppercase; font-weight: bold; letter-spacing: 0.5px; }
.game-badge-large { background: var(--primary); color: white; padding: 4px 8px; border-radius: 10px; font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; }

/* Agrupador por Fechas en el Grid */
.date-group-header {
    grid-column: 1 / -1; 
    width: 100%;
    margin-top: 15px;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 2px solid #333;
    color: white;
    font-size: 18px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.date-group-games { font-size: 13px; color: var(--primary); font-weight: normal; }
.media-type-badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); padding: 4px; border-radius: 4px; font-size: 12px; z-index: 10; }

/* Texto de Ctrl+V */
.paste-hint { color: #888; font-size: 12px; margin-top: 4px; font-weight: 500; }

/* Nuevo selector de juegos */
.game-select-input { width: 100%; padding: 10px; margin: 8px 0; background: #333; color: white; border: none; border-radius: 5px; outline: none; font-size: 14px; cursor: pointer; transition: border 0.2s; }
.game-select-input:focus { border: 1px solid var(--primary); }
#video-game-new { transition: all 0.3s ease; }

/* Botón de Enlace Directo (Estilo Discord) */
#share-source-btn {
    background-color: #5865F2; 
    color: white;
    border: none;
    padding: 7px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: background-color 0.2s, transform 0.2s;
}
#share-source-btn:hover { background-color: #4752C4; transform: scale(1.05); }
