/* ==========================================================================
   FASE 1 — BADGE DE MONEDAS: color controlado por CSS via data-plan attribute
   Diseño idéntico al anterior, pero ahora CSS tiene control real.
   ========================================================================== */
#credits-display {
    display: none;
    /* oculto por defecto — JS añade is-visible-flex */
}

#credits-display[data-plan="base"] {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

#credits-display[data-plan="vip"] {
    background: linear-gradient(135deg, #4c1d95, #7c3aed);
}

/* --- TAG DE PLAN: colores por data-plan --- */
#user-plan-tag {
    display: none;
    /* oculto por defecto */
}

#user-plan-tag[data-plan="esencial"] {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary);
    border-color: rgba(26, 115, 232, 0.2);
}

#user-plan-tag[data-plan="vip"],
#user-plan-tag[data-plan="conciencia"] {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary-accent);
    border-color: rgba(124, 58, 237, 0.2);
}

#user-plan-tag[data-plan="sabiduria"] {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.2);
}

/* --- ESTADO DE BOTONES DE PAGO: .is-processing reemplaza los inline styles --- */
.is-processing {
    opacity: 0.6 !important;
    background: #ccc !important;
    color: #333 !important;
    pointer-events: none !important;
    cursor: wait !important;
}

/* ==========================================================================
   FASE 1 — TOAST DE SESIÓN (logout / expiración)
   ========================================================================== */
.tiarot-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    color: var(--text-on-primary);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    z-index: var(--z-toast);
    box-shadow: var(--shadow-lg);
    transition: opacity var(--transition-slow);
    white-space: nowrap;
    pointer-events: none;
}

.tiarot-toast--fade {
    opacity: 0;
}

/* ==========================================================================
   FASE 1 — NOTIFICACIÓN DE PAGO PROCESANDO
   ========================================================================== */
.tiarot-payment-notif {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-top);
    background: linear-gradient(135deg, var(--primary-accent), var(--primary));
    color: var(--text-on-primary);
    padding: 14px 24px;
    border-radius: var(--radius-lg);
    font-weight: var(--font-weight-bold);
    font-size: var(--text-base);
    box-shadow: var(--shadow-xl);
    text-align: center;
    animation: tiarot-notif-in 0.3s ease;
}

@keyframes tiarot-notif-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ==========================================================================
   FASE 4 — TOKENS para colores antes hardcoded
   ========================================================================== */
/* --- ESTILOS PARA FUNCIONES BLOQUEADAS (TEASER/UPGRADE) --- */
/* --- FORMULARIOS Y CAJAS DE TEXTO --- */
.textarea-wrapper {
    width: 100%;
    background: var(--panel-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-sizing: border-box;
}

.upgrade-wrapper {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.upgrade-label {
    font-size: var(--text-xs);
    color: var(--color-danger);
    /* FASE 4: antes #d93025 hardcoded */
    font-weight: var(--font-weight-bold);
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-style: italic;
    pointer-events: none;
    z-index: var(--z-dropdown);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}


#userQuestion {
    width: 100%;
    height: 13.75rem;
    padding: 0.9375rem;
    padding-right: 3.75rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background-color: #fff;
    color: var(--text-dark);
    font-family: var(--font-body);
    font-size: var(--text-md);
    resize: none;
    box-sizing: border-box;
    transition: all var(--transition-slow);
}

#userQuestion:focus {
    outline: none;
    border-color: var(--google-blue);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.15);
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 5px;
}

.user-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.user-fields .full-width {
    grid-column: 1 / -1;
}

.user-fields input,
.user-fields select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e0e4ea;
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: var(--font-body);
    color: var(--text-dark);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    height: 44px;
}

.user-fields select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.user-fields input:focus,
.user-fields select:focus {
    border-color: var(--google-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

/* --- BOTONES GLOBALES --- */
.main-actions,
.actions-group {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.main-actions button,
.actions-group button {
    flex: 1;
    min-width: 8.75rem;
    padding: 0.75rem 1.375rem;
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--font-weight-bold);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-slow) cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    border: 1px solid transparent;
}

#btnTirar,
.btn-mystic-cam {
    background: var(--google-blue);
    border-color: var(--google-blue);
    color: #fff;
}

#btnTirar:hover,
.btn-mystic-cam:hover {
    background: var(--google-blue-hover);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.btn-secondary,
.btn-secondary-small {
    background: #fff;
    color: var(--google-blue);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover,
.btn-secondary-small:hover {
    background: var(--celeste-claro);
    color: var(--google-blue);
    border-color: var(--google-blue);
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

#btnLimpiar:hover {
    background: #fdf2f2;
    color: var(--danger-red);
    border-color: var(--danger-red);
}

/* --- BOTONES GRANDES MENÚ Y TOOLKIT --- */
.panel-botones {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 0 auto 25px;
    max-width: 750px;
}

.step-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 220px;
    background: var(--bg-light);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 15px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.04);
}

.step-btn:hover,
.step-btn:focus {
    border-color: var(--google-blue);
    background: var(--celeste-claro);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(26, 115, 232, 0.15);
    outline: none;
}

.step-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(26, 115, 232, 0.1);
}

.step-icon-large {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.step-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-text strong {
    font-family: 'Raleway', sans-serif;
    font-size: 0.95rem;
    color: var(--google-blue);
    font-weight: 700;
    white-space: nowrap;
}

.step-text span {
    font-family: 'Raleway', sans-serif;
    font-size: 0.7rem;
    color: var(--text-gray);
    line-height: 1.2;
}

.toolkit-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px auto;
    max-width: 750px;
}

.toolkit-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.toolkit-grid .step-btn {
    flex: 1 1 calc(25% - 12px);
    min-width: 140px;
    margin: 0;
}

#panelOpciones .step {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    padding: 8px 10px;
}

#panelOpciones .step:hover,
#panelOpciones .step:focus {
    background: var(--celeste-claro);
    transform: translateY(-2px);
    outline: none;
    box-shadow: 0 4px 8px rgba(26, 115, 232, 0.1);
    border: 1px solid var(--google-blue);
}

#panelOpciones .step:active {
    transform: translateY(0);
}

/* --- BOTONES ESPECÍFICOS --- */
.btn-repreguntar {
    background: var(--celeste-claro);
    border: 2px solid var(--celeste-claro);
    color: var(--google-blue);
    width: 100%;
    padding: 16px 20px;
    font-family: 'Raleway', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 8px rgba(26, 115, 232, 0.1);
}

.btn-repreguntar:hover {
    background: #d2e3fc;
    border-color: var(--google-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(26, 115, 232, 0.2);
}

.btn-mic {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: var(--google-blue);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(26, 115, 232, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
}

.btn-mic:hover {
    transform: scale(1.1);
    background: var(--google-blue-hover);
}

/* --- BARRA DE GRABACIÓN WHATSAPP --- */
.whatsapp-mic-bar {
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
    height: 55px;
    background: #ffffff;
    border-radius: 28px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    z-index: 100;
    gap: 12px;
    border: 1px solid #e0e0e0;
    animation: slideUpMic 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUpMic {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mic-trash-btn {
    background: transparent;
    border: none;
    color: #5f6368;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-trash-btn:hover {
    background: #fdf2f2;
    color: #d93025;
}

.mic-status-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 65px;
}

.mic-red-dot {
    width: 10px;
    height: 10px;
    background: #d93025;
    border-radius: 50%;
    animation: pulse-red-mic 0.8s infinite;
}

@keyframes pulse-red-mic {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.4);
        opacity: 0.6;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.mic-timer {
    font-size: 0.95rem;
    font-weight: 500;
    color: #3c4043;
    font-family: 'Roboto Mono', monospace;
}

.mic-waveform {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 30px;
}

.wave-bar {
    width: 2px;
    height: 8px;
    background: var(--google-blue);
    border-radius: 1px;
    animation: wave-anim-mic 1s infinite ease-in-out;
}

.wave-bar:nth-child(2n) {
    animation-delay: 0.1s;
}

.wave-bar:nth-child(3n) {
    animation-delay: 0.2s;
}

.wave-bar:nth-child(4n) {
    animation-delay: 0.3s;
}

.wave-bar:nth-child(5n) {
    animation-delay: 0.4s;
}

@keyframes wave-anim-mic {

    0%,
    100% {
        height: 8px;
        transform: scaleY(1);
    }

    50% {
        height: 22px;
        transform: scaleY(1.2);
    }
}

.mic-send-btn {
    background: #00a884;
    /* WhatsApp Green */
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.mic-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-mic.recording {
    background: var(--danger-red);
    color: #fff;
    animation: pulse-urgente 1.5s infinite;
    box-shadow: 0 4px 12px rgba(217, 48, 37, 0.4);
}

/* Botón de voz para análisis emocional — diferenciado del mic de dictado */
/* ── Badge de estado de voz capturada ── */
#vozSentimientoBadge {
    margin: 4px 16px 0;
    /* display:none se gestiona vía JS — no aquí */
}

.badge-voz-sentimiento {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    background: var(--celeste-claro);   /* #e8f0fe */
    border: 1px dashed var(--google-blue);
    padding: 6px 12px;
    border-radius: 8px;
    text-transform: none;
    font-weight: 500;
    color: var(--google-blue);
}

.badge-voz-sentimiento svg {
    flex-shrink: 0;
    color: var(--google-blue);
    stroke: currentColor;   /* hereda en lugar de hardcodear #1a73e8 */
}

.badge-voz-sentimiento__clear-btn {
    background: rgba(217, 48, 37, 0.1);
    border: none;
    color: var(--danger-red);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.badge-voz-sentimiento__clear-btn:hover {
    background: rgba(217, 48, 37, 0.22);
}

.badge-voz-sentimiento__play-btn {
    background: var(--celeste-claro);
    border: none;
    color: var(--google-blue);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.badge-voz-sentimiento__play-btn:hover {
    background: var(--bg-light);
}

/* ── Botón de voz para análisis emocional ── */
#btnVozSentimiento {
    background: var(--bg-light);           /* #f1f3f4 */
    color: var(--text-gray);               /* #5f6368 */
    box-shadow: none;
    border: 1.5px solid var(--border-light);
    bottom: 30px;
    right: 86px;                           /* desplazado a la izquierda del #btnMic */
    width: 38px;
    height: 38px;
}

#btnVozSentimiento:hover {
    background: var(--celeste-claro);
    color: var(--google-blue);
    border-color: var(--google-blue);
    transform: scale(1.08);
}

#btnVozSentimiento.recording-active {
    background: rgba(217, 48, 37, 0.08);
    color: var(--danger-red);
    border-color: var(--danger-red);
    animation: pulse-urgente 1.2s infinite;
    box-shadow: 0 0 0 2px rgba(217, 48, 37, 0.18);
}


#btnCapturarInterno {
    background: #fff;
    color: var(--google-blue);
    border: none;
    padding: 12px 24px;
    font-weight: 700;
    font-family: 'Raleway', sans-serif;
    border-radius: 30px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

#btnCapturarInterno:hover {
    transform: scale(1.05);
    background: var(--celeste-claro);
}

.btn-close-cam {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close-cam:hover {
    background: var(--danger-red);
    transform: scale(1.1);
}

.btn-ticket {
    background: transparent;
    color: var(--text-gray);
    border: 1px solid var(--border-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    margin: 0;
    text-transform: uppercase;
    font-size: 0.72rem;
    font-family: 'Raleway', sans-serif;
}

.btn-ticket:hover {
    background: var(--celeste-claro);
    color: var(--google-blue);
    border-color: var(--google-blue);
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.15);
}

/* --- BADGES (ASTROS Y ESTADOS) --- */
.astro-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--google-blue);
    background: var(--celeste-claro);
    padding: 5px 12px;
    border-radius: 15px;
    letter-spacing: 0.5px;
    min-width: 120px;
    text-align: center;
    display: inline-block;
}

.astro-badge.lunar {
    background: var(--text-dark);
    color: #fff;
}

.badge-visual {
    background: #e8f0fe;
    border: 1px dashed var(--google-blue);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    text-transform: none;
    font-weight: 500;
}

/* --- CARGADORES (LOADERS) --- */
#loader {
    display: none;
    width: 100%;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
}

.loader-ia {
    width: 50px;
    height: 50px;
    border: 4px solid transparent;
    border-top: 4px solid var(--mystic-gold);
    border-bottom: 4px solid var(--loader-blue);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    position: relative;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.2);
}

.loader-ia::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 4px solid transparent;
    border-left: 4px solid var(--mystic-gold);
    border-right: 4px solid var(--loader-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite reverse;
}

.loader-ia-pareja {
    position: absolute;
    right: -50px;
    width: 40px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ring-p1,
.ring-p2 {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid;
    animation: pulse-ring 1.5s infinite ease-in-out;
}

.ring-p1 {
    left: 0;
    border-color: var(--danger-red);
    border-left-color: transparent;
    z-index: 2;
}

.ring-p2 {
    right: 0;
    border-color: var(--google-blue);
    border-right-color: transparent;
    animation-delay: 0.75s;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8) rotate(0deg);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.1) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: scale(0.8) rotate(360deg);
        opacity: 0.7;
    }
}

.processing-text {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: -10px 0 20px 0;
    text-align: center;
    font-family: 'Raleway', sans-serif;
    animation: color-pulse 2s infinite ease-in-out;
}

@keyframes color-pulse {
    0% {
        color: var(--google-blue);
        text-shadow: 0 0 5px rgba(26, 115, 232, 0.2);
        transform: scale(0.98);
    }

    50% {
        color: var(--mystic-gold);
        text-shadow: 0 0 12px rgba(243, 156, 18, 0.6);
        transform: scale(1.02);
    }

    100% {
        color: var(--google-blue);
        text-shadow: 0 0 5px rgba(26, 115, 232, 0.2);
        transform: scale(0.98);
    }
}

/* --- CROPPER MODAL INTERACTIVO --- */
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-container {
    width: 95%;
    max-width: 500px;
    background: #1a1a1a;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.crop-image-wrapper {
    width: 100%;
    height: 55vh;
    background: #000;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

#crop-image {
    max-width: 100%;
    display: block;
}

.crop-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
}

/* Magia para hacer que el cortador individual sea ovalado */
.cropper-oval .cropper-view-box,
/* --- AUTOCOMPLETADO DE CIUDADES (CUSTOM) --- */
.city-suggestions-container {
    position: relative;
    width: 100%;
}

.city-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    padding: 0;
    margin-top: -4px;
    scrollbar-width: thin;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
    font-size: 0.95rem;
    color: #202124;
    transition: background 0.2s;
    list-style: none;
    text-align: left;
    border-bottom: 1px solid #f1f3f4;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f8f9fa;
    color: var(--google-blue);
}

.suggestion-item.active {
    background: #e8f0fe;
    color: var(--google-blue);
}

/* ─── Feedback visual de procesamiento (data-loading) ─────────────────── */
/* Aplicado automáticamente por events.js en botones con data-single-fire */
[data-loading] {
    position: relative;
    pointer-events: none !important;
    opacity: 0.72 !important;
    cursor: wait !important;
}

[data-loading]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 15px;
    height: 15px;
    margin: -7px 0 0 -7px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: tiarot-spin 0.65s linear infinite;
    pointer-events: none;
}

@keyframes tiarot-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── MODO IMPRESIÓN — Informe limpio (sin UI web) ─────────────────────── */
@media print {

    /* ── 1. OCULTAR TODA LA UI ─────────────────────────────────── */
    .app-navbar,
    #resp-sticky-bar,
    #contenedor-botones-ticket,
    #toolkit-resultados,
    #ritualInstructions,
    #ritualTimerContainer,
    #panelSendero,
    #historial-chat-flotante,
    .module-dropdown-popup,
    #sugerencias-chat-links,
    .repregunta-input-container,
    #repregunta-chat-container,
    #panelOpciones,
    .main-query-section,
    .user-data-box,
    .calculator-box,
    #wrap-try-app,
    #compatibilityBox,
    .landing-section,
    footer,
    .side-menu,
    .side-menu-overlay,
    #modal-auth,
    #modal-recarga,
    #modal-paywall,
    #btnInstalarPWA,
    .audio-player-container,
    .audio-player-bar,
    audio,
    .chat-bubble-audio,
    .btn-audio,
    #loaderIA,
    #loader-ia,
    #loader-ia-pareja,
    .chat-input-area,
    .input-area-container,
    [id^="btnMic"],
    .btn-mic-chat,
    .resp-module-controls,
    .floating-action-buttons,
    #btnVerSenderoReporte,
    #btnDescargarLectura,
    #btnCompartirTicketResp,
    #btnCompartirAudioResp,
    #btnDiarioResp,
    #btnToggleTarotResp,
    #btnToggleAstroResp,
    .resp-bar-right,
    .resp-bar-left,
    .chat-postit-container,
    #caja-respuesta,
    .consulta-header .astro-row,
    .resp-controls,
    .btn-repreguntar,
    .gemini-tool-chip,
    [data-action],
    button:not(.carta-wrap button),
    textarea,
    input,
    select {
        display: none !important;
    }

    /* ── 2. RESET LAYOUT PARA IMPRESIÓN ───────────────────────── */
    * {
        box-shadow: none !important;
    }

    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        font-family: 'Georgia', serif;
        font-size: 11pt;
        color: #1a1a2e;
    }

    /* ── 3. CONTENEDOR PRINCIPAL DEL INFORME ──────────────────── */
    #interpretacion {
        display: block !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 10mm 12mm !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: white !important;
    }

    /* ── 4. ENCABEZADO DEL INFORME ────────────────────────────── */
    .consulta-header {
        display: block !important;
        border-bottom: 2px solid #2c3e7a !important;
        padding-bottom: 8px !important;
        margin-bottom: 12px !important;
        text-align: center !important;
    }

    .consulta-header::before {
        content: "TIAROT — Informe de Lectura";
        display: block;
        font-family: 'Cinzel', 'Georgia', serif;
        font-size: 8pt;
        color: #5f6368;
        text-transform: uppercase;
        letter-spacing: 2px;
        margin-bottom: 6px;
    }

    #tituloInforme {
        display: block !important;
        font-size: 16pt !important;
        color: #2c3e7a !important;
        font-family: 'Cinzel', 'Georgia', serif !important;
        font-weight: 700 !important;
        text-align: center !important;
        margin: 4px 0 !important;
    }

    #subtituloInforme,
    .subtitulo-informe {
        display: block !important;
        font-style: italic !important;
        font-size: 10pt !important;
        color: #5f6368 !important;
        text-align: center !important;
    }

    /* ── 5. BADGES ASTROLÓGICOS (Luna, Sol, Temporada) ────────── */
    #astro-left,
    #astro-right {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-size: 8pt !important;
        padding: 2px 8px !important;
        border-radius: 10px !important;
        border: 1px solid #ccc !important;
        margin: 4px !important;
    }

    /* ── 6. FOTO DE CONSULTA ──────────────────────────────────── */
    #foto-previa-container,
    .foto-previa-container {
        display: block !important;
        text-align: center !important;
        margin: 10px auto !important;
        page-break-inside: avoid !important;
    }

    #foto-previa-img {
        display: block !important;
        max-width: 160px !important;
        max-height: 160px !important;
        margin: 0 auto !important;
        border-radius: 50% !important;
        border: 3px solid #2c3e7a !important;
        object-fit: cover !important;
    }

    /* ── 7. CARTAS DEL MAZO ───────────────────────────────────── */
    #mazo-resultado {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
        margin: 12px auto !important;
        padding: 0 !important;
        page-break-inside: avoid !important;
    }

    #mazo-resultado .card-item {
        width: 75px !important;
        flex-shrink: 0 !important;
        text-align: center !important;
    }

    #mazo-resultado .carta-wrap {
        width: 64px !important;
        height: 108px !important;
    }

    #mazo-resultado .carta-wrap img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 4px !important;
        border: 1px solid #ccc !important;
    }

    #mazo-resultado .nombre-carta {
        font-size: 7pt !important;
        text-align: center !important;
        margin-top: 3px !important;
        word-break: break-word !important;
        color: #444 !important;
    }

    /* ── 8. BUBBLES DEL CHAT (texto de interpretación) ───────── */
    #chat-history {
        display: block !important;
    }

    .chat-bubble {
        display: block !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        max-width: 100% !important;
        margin-bottom: 10px !important;
        padding: 8px 12px !important;
        box-shadow: none !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 6px !important;
        background: white !important;
    }

    /* Ocultar burbuja de usuario — solo mostrar respuestas IA */
    .chat-bubble.user-bubble {
        background: #f8f9fa !important;
        border-left: 3px solid #2c3e7a !important;
        color: #444 !important;
        font-style: italic !important;
        font-size: 9pt !important;
    }

    .chat-bubble.ia-bubble {
        font-size: 10.5pt !important;
        line-height: 1.6 !important;
        color: #1a1a2e !important;
    }

    /* ── 9. PIE DE PÁGINA ─────────────────────────────────────── */
    @page {
        margin: 15mm 12mm;
        size: A4 portrait;
    }

    body::after {
        content: "Generado por TIAROT · tiarot.com";
        display: block;
        text-align: center;
        font-size: 7pt;
        color: #aaa;
        border-top: 1px solid #eee;
        margin-top: 20mm;
        padding-top: 4px;
    }
}

/* Clase JS para aplicar el mismo efecto via scripting antes de window.print() */
body.modo-impresion .app-navbar,
body.modo-impresion #resp-sticky-bar,
body.modo-impresion #contenedor-botones-ticket,
body.modo-impresion .module-dropdown-popup {
    visibility: hidden;
}

/* ── Upgrade label: ocultar texto visible dentro del toolbar ── */
/* secureApplyTeaser genera .upgrade-label con texto explicativo.
   En la barra de herramientas esto causa overflow visible. Lo ocultamos
   dentro del toolbar; el overlay y el blur del botón son suficiente señal. */
.tiarot-toolbar .upgrade-label {
    display: none !important;
}
.tiarot-toolbar .upgrade-wrapper {
    margin-top: 0 !important;   /* anular el +18px que agrega JS */
    display: inline-flex !important;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════
   TIAROT TOOLBAR — Barra de herramientas con estilo propio
   Versión dark-glass por defecto. Variantes: light, glass.
   Aplica a #panelOpciones y #resp-sticky-bar cuando tienen
   la clase .tiarot-toolbar o el atributo data-toolbar-style.
   ═══════════════════════════════════════════════════════════════ */

/* ── BASE: dark-glass (por defecto) ── */
.tiarot-toolbar {
    background: linear-gradient(135deg, rgba(13, 20, 48, 0.94) 0%, rgba(26, 42, 88, 0.92) 100%);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border: 1px solid rgba(100, 140, 255, 0.18);
    border-radius: 14px;
    box-shadow:
        0 4px 24px rgba(10, 18, 52, 0.28),
        0 1px 4px rgba(26, 115, 232, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    padding: 8px 12px !important;
    margin-bottom: 12px;
    position: relative;
    overflow: visible;
}


/* Dark: chips con texto claro */
.tiarot-toolbar .gemini-tool-chip {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(220, 235, 255, 0.92);
    border-color: rgba(100, 140, 255, 0.22);
}

.tiarot-toolbar .gemini-tool-chip:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(100, 160, 255, 0.4);
    color: #fff;
}

.tiarot-toolbar .gemini-tool-chip.chip-active {
    background: rgba(26, 115, 232, 0.28);
    color: #a8c8ff;
    border-color: rgba(26, 115, 232, 0.5);
}

/* Toggle status badge — colores controlados por CSS variables configurables desde admin */
.toggle-status {
    font-size: 11px;
    margin-left: 2px;
    transition: color var(--transition-fast);
}
.toggle-status[data-active="true"]  { color: var(--toggle-on-color,  #10b981); }
.toggle-status[data-active="false"] { color: var(--toggle-off-color, #ef4444); }

/* Separador vertical entre grupos de chips */
.tiarot-toolbar > span[style*="width:1px"] {
    background: rgba(100, 140, 255, 0.3) !important;
}

/* ── VARIANTE: glass (sobrio pero visible) ── */
.tiarot-toolbar[data-toolbar-style="glass"] {
    background: rgba(248, 249, 252, 0.88);
    backdrop-filter: blur(16px) saturate(1.8);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    border-color: rgba(26, 115, 232, 0.14);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255,255,255,0.9);
}

.tiarot-toolbar[data-toolbar-style="glass"] .gemini-tool-chip {
    background: rgba(255, 255, 255, 0.75);
    color: #3c4043;
    border-color: rgba(0, 0, 0, 0.1);
}

.tiarot-toolbar[data-toolbar-style="glass"] .gemini-tool-chip:hover {
    background: #e8eaed;
    color: #202124;
}

.tiarot-toolbar[data-toolbar-style="glass"] .gemini-tool-chip.chip-active {
    background: #e8f0fe;
    color: #1a73e8;
    border-color: #d2e3fc;
}

.tiarot-toolbar[data-toolbar-style="glass"]::before {
    opacity: 0.6;
}

/* ── VARIANTE: light (claro diferenciado) ── */
.tiarot-toolbar[data-toolbar-style="light"] {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    backdrop-filter: none;
    border-color: rgba(124, 58, 237, 0.18);
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.08), 0 1px 4px rgba(0,0,0,0.06);
}

.tiarot-toolbar[data-toolbar-style="light"] .gemini-tool-chip {
    background: rgba(255, 255, 255, 0.9);
    color: #3c4043;
    border-color: rgba(124, 58, 237, 0.2);
}

.tiarot-toolbar[data-toolbar-style="light"] .gemini-tool-chip:hover {
    background: #ede9fe;
    color: #5b21b6;
}

.tiarot-toolbar[data-toolbar-style="light"]::before {
    background: linear-gradient(180deg, #7c3aed 0%, #1a73e8 100%);
}

/* ── BOTÓN MÓDULOS: siempre más grande ── */
.tiarot-toolbar #btn-module-trigger,
.tiarot-toolbar #btn-resp-module-trigger {
    padding: 9px 18px !important;
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, var(--toolbar-modules-color, var(--primary, #1a73e8)) 0%, color-mix(in srgb, var(--toolbar-modules-color, var(--primary, #1a73e8)) 80%, #000) 100%) !important;
    color: #fff !important;
    border-color: color-mix(in srgb, var(--toolbar-modules-color, var(--primary, #1a73e8)) 60%, transparent) !important;
    box-shadow: 0 3px 12px color-mix(in srgb, var(--toolbar-modules-color, var(--primary, #1a73e8)) 40%, transparent), 0 1px 3px rgba(0,0,0,0.2) !important;
    transition: all 0.2s ease;
}

.tiarot-toolbar #btn-module-trigger:hover,
.tiarot-toolbar #btn-resp-module-trigger:hover {
    background: linear-gradient(135deg, color-mix(in srgb, var(--toolbar-modules-color, var(--primary, #1a73e8)) 85%, #000) 0%, color-mix(in srgb, var(--toolbar-modules-color, var(--primary, #1a73e8)) 70%, #000) 100%) !important;
    box-shadow: 0 5px 18px color-mix(in srgb, var(--toolbar-modules-color, var(--primary, #1a73e8)) 50%, transparent), 0 2px 6px rgba(0,0,0,0.18) !important;
    transform: translateY(-1px);
}

/* Hover status text color on dark toolbar */
.tiarot-toolbar span[id^="status"] {
    color: #6ee7b7 !important;
}

/* ── STICKY BAR en Respuesta: sin margen inferior extra ── */
#resp-sticky-bar.tiarot-toolbar {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    margin-bottom: 0 !important;
    padding: 8px 16px !important;
}

#resp-sticky-bar.tiarot-toolbar::before {
    display: none;
}

/* ═══════════════════════════════════════════
   LOADERS CONTEXTUALES — Pareja / Mascota
   ═══════════════════════════════════════════ */

/* Loader de Pareja/Sinergia — corazones */
.loader-couple {
    position: relative;
    width: 54px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-couple svg {
    animation: heartbeat-sync 1.4s ease-in-out infinite;
    filter: drop-shadow(0 2px 6px rgba(217, 48, 37, 0.4));
}

@keyframes heartbeat-sync {
    0%, 100% { transform: scale(1); }
    14%       { transform: scale(1.22); }
    28%       { transform: scale(1); }
    42%       { transform: scale(1.15); }
    70%       { transform: scale(1); }
}

.loader-couple-rings {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 2px solid rgba(217, 48, 37, 0.2);
    animation: ring-expand 1.4s ease-out infinite;
}

@keyframes ring-expand {
    0%   { transform: translate(-50%,-50%) scale(0.6); opacity: 0.8; }
    100% { transform: translate(-50%,-50%) scale(1.6); opacity: 0; }
}

/* Loader de Mascota — patita */
.loader-paw {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-paw svg {
    animation: paw-bounce 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 3px 8px rgba(26, 115, 232, 0.35));
}

@keyframes paw-bounce {
    0%, 100% { transform: translateY(0) rotate(-5deg) scale(1); }
    30%       { transform: translateY(-8px) rotate(5deg) scale(1.12); }
    60%       { transform: translateY(-3px) rotate(-3deg) scale(1.05); }
}

/* ── Responsive ajuste ── */
@media (max-width: 600px) {
    .tiarot-toolbar {
        border-radius: 10px;
        padding: 6px 10px !important;
    }

    .tiarot-toolbar #btn-module-trigger,
    .tiarot-toolbar #btn-resp-module-trigger {
        padding: 7px 12px !important;
        font-size: 0.82rem !important;
    }

    #resp-sticky-bar.tiarot-toolbar {
        padding: 6px 12px !important;
    }
}

/* ==========================================================================
   FIX MOB-N1 (CTO Audit v5.0 - 2026-03-14): Fast-tap para elementos interactivos
   ARQUITECTURA: touch-action:manipulation elimina el delay de 300ms del browser
   en doble-tap zoom. Capacitor/Cordova requieren esto para experiencia nativa.
   -webkit-tap-highlight-color quita el flash gris en iOS al tocar elementos.
   ========================================================================== */
button,
[data-action],
.step-btn,
.btn-action,
.btn-primary,
.btn-secondary,
.btn-secondary-small,
.btn-repreguntar,
.btn-ticket,
.btn-mic,
.mic-send-btn,
.mic-trash-btn,
.carta-mazo {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ── RAG: Vimeo Player Embebido (embed oficial) ─────────────── */
.rag-vimeo-player {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #0d1430;
    border: 1px solid rgba(100, 140, 255, 0.2);
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
}

.rag-vimeo-player__label {
    font-size: 12px;
    color: rgba(200, 220, 255, 0.85);
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.rag-vimeo-player__label strong {
    color: rgba(150, 180, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
}

.rag-vimeo-player__hint {
    font-size: 11px;
    color: rgba(150, 180, 255, 0.6);
    margin: 8px 0 0;
    text-align: right;
}


.rag-vimeo-player__titulo {
    font-size: 13px;
    font-weight: 600;
    color: #e8eeff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rag-vimeo-player__hint {
    font-size: 11px;
    color: rgba(150, 180, 255, 0.6);
    margin: 0;
}

.rag-vimeo-player__cta {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: #7eb3ff;
    padding: 5px 10px;
    border: 1px solid rgba(100, 160, 255, 0.35);
    border-radius: 20px;
    letter-spacing: 0.5px;
}

/* ══════════════════════════════════════════════════════════════
   BIBLIOTECA BAR — Barra de recursos contextuales (RAG)
   feat(biblioteca): 2026-03-16 — rediseño motorcore style v2
   Configurable via data-biblioteca-style:
     • "default" (motorcore claro — DEFAULT)
     • "glass"   (glassmorphism semitransparente)
     • "dark"    (oscuro premium)
   ══════════════════════════════════════════════════════════════ */

/* ─── ESTILO BASE — compartido por los 3 temas ─── */
.biblioteca-bar {
    margin: 20px 0;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    width: 100%;
    box-sizing: border-box;
    animation: biblioteca-fadein 0.35s ease forwards;
}

@keyframes biblioteca-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── TEMA DEFAULT — estilo motorcore (IGUAL A LA APP) ─── */
.biblioteca-bar,
.biblioteca-bar[data-biblioteca-style="default"] {
    background: var(--card-bg, var(--bg-surface, #ffffff));
    border: var(--card-border, 1px solid rgba(26,115,232,0.12));
    border-top: var(--card-border-top, 3px solid rgba(26,115,232,0.18));
    box-shadow: var(--card-shadow,
        0 4px 16px rgba(13,27,62,0.07),
        0 1px 4px rgba(13,27,62,0.04));
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-bar__header,
.biblioteca-bar .biblioteca-bar__header {
    border-bottom-color: var(--border-subtle, #e8eaed);
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-bar__title,
.biblioteca-bar .biblioteca-bar__title {
    color: var(--text-secondary, #5f6368);
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-bar__badge,
.biblioteca-bar .biblioteca-bar__badge {
    background: var(--primary, #1a73e8);
    color: #fff;
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-item,
.biblioteca-bar .biblioteca-item {
    background: var(--bg-panel, #f8f9fa);
    border-color: var(--border-default, #dadce0);
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-item:hover,
.biblioteca-bar .biblioteca-item:hover {
    background: var(--color-blue-50, #e8f0fe);
    border-color: rgba(26,115,232,0.25);
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-item__thumb,
.biblioteca-bar .biblioteca-item__thumb {
    background: var(--color-blue-50, #e8f0fe);
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-item__tipo,
.biblioteca-bar .biblioteca-item__tipo {
    color: var(--primary, #1a73e8);
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-item__titulo,
.biblioteca-bar .biblioteca-item__titulo {
    color: var(--text-primary, #202124);
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-item__meta,
.biblioteca-bar .biblioteca-item__meta {
    color: var(--text-muted, #9aa0a6);
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-item__play,
.biblioteca-bar .biblioteca-item__play {
    background: var(--primary, #1a73e8);
    box-shadow: 0 3px 10px rgba(26,115,232,0.35);
    color: #fff;
    border: none;
}

.biblioteca-bar[data-biblioteca-style="default"] .biblioteca-item__play:hover,
.biblioteca-bar .biblioteca-item__play:hover {
    background: var(--primary-hover, #1557b0);
    box-shadow: 0 5px 16px rgba(26,115,232,0.45);
    transform: scale(1.08);
}

/* ─── TEMA GLASS — glassmorphism ─── */
.biblioteca-bar[data-biblioteca-style="glass"] {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(26,115,232,0.18);
    border-top: 2px solid rgba(26,115,232,0.3);
    box-shadow: 0 4px 24px rgba(13,27,62,0.10), inset 0 1px 0 rgba(255,255,255,0.8);
}

.biblioteca-bar[data-biblioteca-style="glass"] .biblioteca-bar__header {
    border-bottom-color: rgba(26,115,232,0.12);
}

.biblioteca-bar[data-biblioteca-style="glass"] .biblioteca-bar__title {
    color: #3c4043;
}

.biblioteca-bar[data-biblioteca-style="glass"] .biblioteca-item {
    background: rgba(255,255,255,0.5);
    border-color: rgba(26,115,232,0.12);
}

.biblioteca-bar[data-biblioteca-style="glass"] .biblioteca-item:hover {
    background: rgba(232,240,254,0.7);
}

.biblioteca-bar[data-biblioteca-style="glass"] .biblioteca-item__thumb {
    background: rgba(26,115,232,0.12);
}

.biblioteca-bar[data-biblioteca-style="glass"] .biblioteca-item__tipo { color: #1a73e8; }
.biblioteca-bar[data-biblioteca-style="glass"] .biblioteca-item__titulo { color: #202124; }
.biblioteca-bar[data-biblioteca-style="glass"] .biblioteca-item__meta { color: #5f6368; }

.biblioteca-bar[data-biblioteca-style="glass"] .biblioteca-item__play {
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    box-shadow: 0 3px 10px rgba(26,115,232,0.4);
    border: none;
    color: #fff;
}

/* ─── TEMA DARK — oscuro premium ─── */
.biblioteca-bar[data-biblioteca-style="dark"] {
    background: linear-gradient(135deg, #0d1a3a 0%, #0a1128 100%);
    border: 1px solid rgba(80,130,255,0.25);
    border-top: 2px solid rgba(91,142,255,0.4);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}

.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-bar__header {
    border-bottom-color: rgba(80,130,255,0.15);
}

.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-bar__title     { color: rgba(180,210,255,0.9); }
.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-bar__badge     { background: #5b8eff; }

.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-item {
    background: rgba(255,255,255,0.04);
    border-color: rgba(80,130,255,0.12);
}

.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-item:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(91,142,255,0.25);
}

.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-item__thumb {
    background: linear-gradient(135deg, #1a3a6e 0%, #0d2050 100%);
}

.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-item__tipo   { color: #5b8eff; }
.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-item__titulo { color: #dce8ff; }
.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-item__meta   { color: rgba(140,180,255,0.6); }

.biblioteca-bar[data-biblioteca-style="dark"] .biblioteca-item__play {
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    box-shadow: 0 3px 12px rgba(26,115,232,0.45);
    border: none;
    color: #fff;
}

/* ─── ESTRUCTURA COMPARTIDA ─── */
.biblioteca-bar__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid transparent;
}

.biblioteca-bar__icon {
    font-size: 0.95rem;
    flex-shrink: 0;
}

.biblioteca-bar__title {
    font-family: var(--font-body, 'Raleway', sans-serif);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    flex: 1;
}

.biblioteca-bar__badge {
    font-size: 0.6rem;
    font-weight: 800;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.biblioteca-bar__items {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;          /* una sola fila */
    gap: 8px;
    overflow-x: auto;           /* scroll si hay muchos */
    padding-bottom: 2px;        /* evitar corte del box-shadow del item */
    scrollbar-width: thin;
    scrollbar-color: rgba(26,115,232,0.2) transparent;
}

/* chip individual — ancho fijo para que quepan varios */
.biblioteca-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md, 8px);
    border: 1px solid transparent;
    flex: 0 0 auto;             /* NO crecer: ancho propio */
    max-width: 280px;
    min-width: 180px;
    transition: background var(--transition-fast, 150ms), border-color var(--transition-fast, 150ms);
    cursor: default;
}

.biblioteca-item__thumb {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.biblioteca-item__info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.biblioteca-item__tipo {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.biblioteca-item__titulo {
    font-family: var(--font-body, 'Raleway', sans-serif);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.biblioteca-item__meta {
    font-size: 0.63rem;
    white-space: nowrap;
}

.biblioteca-item__play {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast, 150ms), box-shadow var(--transition-fast, 150ms);
}

.biblioteca-item__play:hover  { transform: scale(1.12); }
.biblioteca-item__play:active { transform: scale(0.9); }

/* ─── Responsive mobile: wrap en 2 columnas ─── */
@media (max-width: 600px) {
    .biblioteca-bar { padding: 12px; border-radius: var(--radius-md, 8px); }
    .biblioteca-bar__items { flex-wrap: wrap; }
    .biblioteca-item { min-width: calc(50% - 4px); max-width: 100%; }
    .biblioteca-item__play { width: 28px; height: 28px; }
}


.biblioteca-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-md, 8px);
    border: 1px solid transparent;
    transition: background var(--transition-fast, 150ms), border-color var(--transition-fast, 150ms), transform var(--transition-fast, 150ms);
    cursor: default;
}

.biblioteca-item__thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.biblioteca-item__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.biblioteca-item__tipo {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.biblioteca-item__titulo {
    font-family: var(--font-body, 'Raleway', sans-serif);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.biblioteca-item__meta {
    font-size: 0.68rem;
}

.biblioteca-item__play {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast, 150ms), box-shadow var(--transition-fast, 150ms), background var(--transition-fast, 150ms);
}

.biblioteca-item__play:hover { transform: scale(1.1); }
.biblioteca-item__play:active { transform: scale(0.93); }

/* ─── Responsive mobile ─── */
@media (max-width: 600px) {
    .biblioteca-bar { padding: 12px; border-radius: var(--radius-md, 8px); }
    .biblioteca-item__titulo { font-size: 0.78rem; }
    .biblioteca-item__play { width: 32px; height: 32px; }
}

/* ══════════════════════════════════════════════════════════════
   BIBLIOTECA MODAL — Overlay flotante con player de Vimeo
   Siempre dark para máximo contraste del video
   feat(biblioteca): 2026-03-16 v2
   ══════════════════════════════════════════════════════════════ */

.biblioteca-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 2000);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: biblioteca-modal-in 0.2s ease forwards;
}

@keyframes biblioteca-modal-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.biblioteca-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 30, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
}

.biblioteca-modal__content {
    position: relative;
    z-index: 1;
    width: 92%;
    max-width: 780px;
    /* Usa card tokens del sistema — coherente con otros modales */
    background: var(--bg-surface, #ffffff);
    border: 1px solid rgba(26,115,232,0.18);
    border-top: 3px solid var(--primary, #1a73e8);
    border-radius: var(--radius-xl, 16px);
    padding: 20px 20px 16px;
    box-shadow:
        0 24px 64px rgba(0,0,0,0.35),
        0 0 0 1px rgba(26,115,232,0.06);
    animation: biblioteca-modal-slide 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-sizing: border-box;
}

@keyframes biblioteca-modal-slide {
    from { transform: scale(0.92) translateY(14px); }
    to   { transform: scale(1) translateY(0); }
}

.biblioteca-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bg-panel, #f8f9fa);
    border: 1px solid var(--border-default, #dadce0);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary, #5f6368);
    transition: background var(--transition-fast, 150ms), color var(--transition-fast, 150ms);
}

.biblioteca-modal__close:hover {
    background: var(--color-danger-bg, #fce8e6);
    color: var(--color-danger, #ea4335);
    border-color: rgba(234,67,53,0.25);
}

.biblioteca-modal__label {
    font-family: var(--font-body, 'Raleway', sans-serif);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary, #1a73e8);
    margin: 0 0 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.biblioteca-modal__titulo {
    font-family: var(--font-body, 'Raleway', sans-serif);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary, #202124);
    margin: 0 0 14px;
    padding-right: 36px;
    line-height: 1.35;
}

/* Player 16:9 */
.biblioteca-modal__player-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-subtle, #e8eaed);
}

.biblioteca-modal__player {
    position: absolute;
    inset: 0;
}

.biblioteca-modal__player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.biblioteca-modal__hint {
    font-family: var(--font-body, 'Raleway', sans-serif);
    font-size: 0.68rem;
    color: var(--text-muted, #9aa0a6);
    margin: 10px 0 0;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* ── Footer del modal: hint + CTA en misma fila ─── */
.biblioteca-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* ── Barra de progreso del fragmento ── */
.biblioteca-modal__progress-wrap {
    width: 100%;
    height: 3px;
    background: var(--border-subtle, #e8eaed);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.biblioteca-modal__progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary, #1a73e8) 0%, #4fa3f7 100%);
    border-radius: 2px;
    transition: width 0.5s linear;
}

.biblioteca-modal__progress-bar.is-complete {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

/* ── CTA de compra ── */
.biblioteca-modal__cta {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--primary, #1a73e8) 0%, #1557b0 100%);
    color: #fff;
    border-radius: var(--radius-full, 9999px);
    text-decoration: none;
    font-family: var(--font-body, 'Raleway', sans-serif);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px rgba(26,115,232,0.4);
    transition: transform 150ms ease, box-shadow 150ms ease;
    white-space: nowrap;
    cursor: pointer;
}

.biblioteca-modal__cta--visible {
    animation: cta-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cta-pop-in {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.biblioteca-modal__cta:hover {
    background: linear-gradient(135deg, #1e88e5 0%, #1557b0 100%);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 20px rgba(26,115,232,0.5);
    color: #fff;
}

.biblioteca-modal__cta:active { transform: scale(0.97); }
.biblioteca-modal__cta-icon { font-size: 1rem; flex-shrink: 0; }
.biblioteca-modal__cta-text { flex: 1; }

@media (max-width: 600px) {
    .biblioteca-modal__footer { flex-direction: column; align-items: flex-start; }
    .biblioteca-modal__cta { width: 100%; justify-content: center; }
}

/* ── Overlay de restricción de segmento ── */
.biblioteca-restrict-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 17, 40, 0.82);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.biblioteca-restrict-overlay.is-visible {
    opacity: 1;
    pointer-events: all;
}

.biblioteca-restrict-overlay__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 20px 28px;
}

.biblioteca-restrict-overlay__icon {
    font-size: 2rem;
    animation: restrict-shake 0.4s ease;
}

@keyframes restrict-shake {
    0%,100% { transform: rotate(0); }
    25%      { transform: rotate(-8deg); }
    75%      { transform: rotate(8deg); }
}

.biblioteca-restrict-overlay__msg {
    font-family: var(--font-body, 'Raleway', sans-serif);
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.biblioteca-restrict-overlay__cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: #fff;
    border-radius: 9999px;
    font-family: var(--font-body, 'Raleway', sans-serif);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(26,115,232,0.45);
    transition: transform 150ms, box-shadow 150ms;
}

.biblioteca-restrict-overlay__cta:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(26,115,232,0.6);
    color: #fff;
}
