/* ==========================================================
   estilo.css
   --------------------------------------------------------------
   Mantiene intacto el estilo original (header oscuro, sidebar,
   scroll-snap, .video, .info, etc) y agrega:
     - Sub-header
     - Botones de acción like/skip sobre cada Short
     - Panel lateral de métricas (dashboard)
     - Botón QR + modal
   ========================================================== */

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

body {
    background:
        radial-gradient(circle at top, #111 0%, black 50%);
    font-family: Arial;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    color: white;
}

body::-webkit-scrollbar {
    display: none;
}

/* ============== HEADER ============== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding-left: 25px;
    z-index: 1000;
    border-bottom: 1px solid #222;
    gap: 18px;
}

.logo {
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.header-sub {
    font-size: 13px;
    color: #9aa0a6;
    border-left: 1px solid #333;
    padding-left: 18px;
}

/* ============== FEED ============== */
#feed {
    width: 100%;
    padding-top: 70px;
    padding-right: 360px;
    transition: padding-right 0.35s ease;
}

body.dash-collapsed #feed {
    padding-right: 0;
}

.video {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    scroll-snap-align: start;
}

.video iframe {
    width: 430px;
    height: 92vh;
    border: none;
    border-radius: 25px;
    box-shadow:
        0 0 30px rgba(255, 255, 255, 0.08),
        0 0 100px rgba(255, 255, 255, 0.05);
    transition: 0.3s;
}

.video iframe:hover {
    transform: scale(1.01);
}

.info {
    position: absolute;
    bottom: 40px;
    width: 430px;
    padding: 20px;
    color: white;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    border-radius: 0 0 25px 25px;
}

.info h2 {
    font-size: 22px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px black;
}

.info p {
    color: #ccc;
}

/* Chip de categoría sobre la info del Short. */
.cat-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

/* ============== BOTONES DE ACCIÓN (LIKE / SKIP) ============== */
.video-actions {
    position: absolute;
    right: 70px;
    bottom: 110px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 5;
}

.act-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: transform 0.2s ease, background 0.2s ease;
    font-family: inherit;
}

.act-btn:hover {
    transform: scale(1.08);
    background: rgba(0, 0, 0, 0.65);
}

.act-like:hover {
    border-color: #ff4d6d;
    color: #ff4d6d;
}

.act-skip:hover {
    border-color: #bdbdbd;
}

.act-icon {
    font-size: 22px;
    line-height: 1;
}

.act-label {
    font-size: 11px;
    opacity: 0.8;
}

/* Animación al pulsar like/skip. */
.act-btn.pulse {
    animation: pulseAnim 0.4s ease;
}

@keyframes pulseAnim {
    0%   { transform: scale(1);   }
    40%  { transform: scale(1.25); }
    100% { transform: scale(1);   }
}

/* ============== DASHBOARD LATERAL ============== */
.dashboard {
    position: fixed;
    top: 70px;
    right: 0;
    width: 360px;
    height: calc(100vh - 70px);
    background: rgba(15, 15, 20, 0.85);
    backdrop-filter: blur(14px);
    border-left: 1px solid #222;
    padding: 22px 20px;
    overflow-y: auto;
    z-index: 900;
    transition: transform 0.35s ease;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.dashboard::-webkit-scrollbar { width: 6px; }
.dashboard::-webkit-scrollbar-thumb {
    background: #333; border-radius: 3px;
}

.dashboard.collapsed {
    transform: translateX(100%);
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.dash-title {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}

.dash-reset {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #333;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    cursor: pointer;
    transition: 0.2s;
}

.dash-reset:hover {
    background: rgba(255, 77, 109, 0.15);
    border-color: #ff4d6d;
}

.dash-section {
    margin-bottom: 22px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #222;
    border-radius: 14px;
}

.dash-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #888;
    margin-bottom: 12px;
}

/* Categoría favorita */
.dash-favorita { min-height: 70px; }
.fav-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--cat-color) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--cat-color) 40%, transparent);
}
.fav-emoji { font-size: 38px; }
.fav-info { display: flex; flex-direction: column; }
.fav-label { font-size: 10px; text-transform: uppercase; color: #aaa; letter-spacing: 1px; }
.fav-name  { font-size: 20px; font-weight: bold; color: #fff; }
.fav-score { font-size: 12px; color: #ccc; margin-top: 2px; }

.fav-empty {
    text-align: center;
    color: #888;
    padding: 6px;
}
.fav-empty-emoji { font-size: 30px; margin-bottom: 4px; }
.fav-empty-text  { font-size: 12px; line-height: 1.4; }

/* Barras de afinidad. */
.aff-row {
    display: grid;
    grid-template-columns: 22px 110px 1fr 28px;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}
.aff-emoji { font-size: 16px; }
.aff-name  { color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aff-val   { color: #fff; font-weight: bold; text-align: right; }
.aff-bar-track {
    height: 8px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
}
.aff-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Lista de tiempos. */
.time-row {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 12px;
    border-bottom: 1px solid #1a1a1a;
}
.time-row:last-child { border-bottom: none; }
.time-emoji { font-size: 14px; }
.time-name  { color: #ccc; }
.time-val   { color: #fff; font-weight: bold; }

/* KPIs. */
.dash-kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.kpi {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}
.kpi-val {
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    line-height: 1;
}
.kpi-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-top: 4px;
}

.dash-footer {
    text-align: center;
    font-size: 10px;
    color: #666;
    letter-spacing: 0.5px;
    padding: 8px 0 4px;
}

/* Botón plegable del dashboard. */
.dash-toggle {
    position: fixed;
    top: 90px;
    right: 370px;
    z-index: 950;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid #333;
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: right 0.35s ease, background 0.2s, border-color 0.2s;
}
.dash-toggle:hover {
    background: rgba(40, 40, 50, 0.9);
    border-color: #4FC3F7;
}
.dash-toggle.collapsed {
    right: 20px;
}
.dash-toggle-icon { font-size: 16px; }

/* ============== QR (FAB + modal) ============== */
.qr-fab {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 950;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid #333;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: inherit;
    transition: 0.2s;
}
.qr-fab:hover {
    transform: scale(1.08);
    border-color: #4FC3F7;
}
.qr-fab > span:first-child { font-size: 22px; }
.qr-fab-label { font-size: 10px; opacity: 0.8; }

.qr-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.qr-modal.open { display: flex; }

.qr-modal-card {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 18px;
    padding: 26px 30px;
    width: 460px;
    max-width: calc(100vw - 40px);
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.qr-modal-card h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #fff;
}
.qr-canvas {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}
.qr-canvas img,
.qr-canvas canvas {
    border-radius: 10px;
}
.qr-url-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 13px;
    color: #fff;
    background: #0a0a0d;
    border: 1px solid #333;
    border-radius: 8px;
    outline: none;
    text-align: center;
    transition: border-color 0.2s;
}
.qr-url-input:focus {
    border-color: #4FC3F7;
}
.qr-url-input::placeholder {
    color: #555;
}
.qr-regen-btn {
    width: 100%;
    margin-top: 10px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 13px;
    color: #fff;
    background: rgba(79, 195, 247, 0.12);
    border: 1px solid rgba(79, 195, 247, 0.4);
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}
.qr-regen-btn:hover {
    background: rgba(79, 195, 247, 0.25);
    border-color: #4FC3F7;
}
.qr-hint {
    font-size: 11px;
    color: #777;
    line-height: 1.5;
    margin-top: 14px;
    text-align: left;
}
.qr-hint code {
    background: #1a1a1f;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: "Consolas", "Courier New", monospace;
    color: #9aa0a6;
    font-size: 10.5px;
}
.qr-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #333;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
.qr-close:hover {
    background: rgba(255, 77, 109, 0.15);
    border-color: #ff4d6d;
}

/* ============== FOOTER ============== */
.page-footer {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-top: 1px solid #1a1a1a;
}

/* ============== MINI-CHIP FLOTANTE (favorita actual, solo mobile) ============== */
.mini-fav {
    position: fixed;
    bottom: 100px;
    left: 20px;
    z-index: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    font-size: 13px;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: calc(100vw - 40px);
    pointer-events: none;
}
.mini-fav.hidden {
    opacity: 0;
    transform: translateY(20px);
}
.mini-fav-emoji { font-size: 18px; line-height: 1; }
.mini-fav-text {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mini-fav-score {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    font-family: "Consolas", "Courier New", monospace;
    min-width: 22px;
    text-align: center;
}
.mini-fav-empty {
    color: #aaa;
    font-size: 12px;
    font-style: italic;
}

/* En desktop el chip nunca se ve. */
@media (min-width: 901px) {
    .mini-fav { display: none !important; }
}

/* ============== PARTE MOVIL ============== */
@media (max-width: 900px) {
    /* En mobile el QR no tiene sentido (ya estás en el celular). */
    .qr-fab { display: none; }

    .dashboard {
        width: 100%;
        transform: translateX(100%);
    }
    .dashboard:not(.collapsed) {
        transform: translateX(0);
    }
    #feed {
        padding-right: 0;
    }
    .dash-toggle {
        right: 20px;
    }
    .dash-toggle.collapsed {
        right: 20px;
    }
    .header-sub { display: none; }
    .video-actions {
        right: 24px;
        bottom: 130px;
    }

    /* Cuando el panel de métricas está abierto en mobile, ocultamos
       el mini-chip para que no se solape visualmente. */
    body.is-mobile .dashboard:not(.collapsed) ~ .mini-fav {
        opacity: 0 !important;
        transform: translateY(20px);
    }
}
