/* =============================================================================
   GEMM Live Streaming — Design Tokens & Global Styles
   Complementa Tailwind CDN. Tokens semánticos para consistencia visual.
   ============================================================================= */

:root {
    /* ── Paleta de colores ──────────────────────────────────────────────────── */
    --color-bg-primary:     #0a0e1a;
    --color-bg-secondary:   #111827;
    --color-bg-card:        #1a2332;
    --color-bg-card-hover:  #1f2b3d;
    --color-bg-input:       #0f1726;

    --color-brand-dark:     #0d3b6e;
    --color-brand-medium:   #1565a3;
    --color-brand-light:    #2196f3;
    --color-brand-gold:     #c9a227;
    --color-brand-gold-light: #e0be4f;

    --color-text-primary:   #f1f5f9;
    --color-text-secondary: #94a3b8;
    --color-text-muted:     #64748b;

    --color-success:        #22c55e;
    --color-danger:         #ef4444;
    --color-warning:        #f59e0b;

    --color-border:         #1e293b;
    --color-border-focus:   #1565a3;

    /* ── Tipografía ─────────────────────────────────────────────────────────── */
    --font-family:          'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-xs:         0.75rem;
    --font-size-sm:         0.875rem;
    --font-size-base:       1rem;
    --font-size-lg:         1.125rem;
    --font-size-xl:         1.25rem;
    --font-size-2xl:        1.5rem;
    --font-size-3xl:        1.875rem;

    /* ── Spacing ────────────────────────────────────────────────────────────── */
    --space-xs:   0.25rem;
    --space-sm:   0.5rem;
    --space-md:   1rem;
    --space-lg:   1.5rem;
    --space-xl:   2rem;
    --space-2xl:  3rem;

    /* ── Bordes y sombras ───────────────────────────────────────────────────── */
    --radius-sm:  0.375rem;
    --radius-md:  0.625rem;
    --radius-lg:  0.875rem;
    --radius-xl:  1rem;
    --radius-full: 9999px;

    --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow-gold: 0 0 20px rgba(201,162,39,0.15);
    --shadow-glow-blue: 0 0 20px rgba(21,101,163,0.2);

    /* ── Transiciones ───────────────────────────────────────────────────────── */
    --transition-fast:  150ms ease;
    --transition-base:  250ms ease;
    --transition-slow:  500ms ease;
}

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

body {
    font-family: var(--font-family);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Animaciones ────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

@keyframes pulseRing {
    0%   { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-fade-in {
    animation: fadeIn var(--transition-slow) ease forwards;
}

.animate-slide-up {
    animation: slideUp var(--transition-slow) ease forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ── OTP Inputs ─────────────────────────────────────────────────────────────── */
.otp-input {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--color-bg-input);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-brand-gold);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    caret-color: var(--color-brand-gold);
}

.otp-input:focus {
    border-color: var(--color-brand-gold);
    box-shadow: var(--shadow-glow-gold);
}

.otp-input::selection {
    background: rgba(201,162,39,0.2);
}

/* ── Badge EN VIVO ──────────────────────────────────────────────────────────── */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239,68,68,0.15);
    color: var(--color-danger);
    font-size: var(--font-size-sm);
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.live-badge::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

/* ── Contador de usuarios ───────────────────────────────────────────────────── */
.user-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(21,101,163,0.15);
    color: var(--color-brand-light);
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

/* ── Tarjeta de pregunta Q&A ────────────────────────────────────────────────── */
.question-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: border-color var(--transition-fast), transform var(--transition-fast);
    animation: fadeIn var(--transition-base) ease forwards;
}

.question-card:hover {
    border-color: var(--color-border-focus);
    transform: translateY(-1px);
}

.question-card.approved {
    border-color: var(--color-success);
    background: rgba(34,197,94,0.05);
}

.question-card.rejected {
    opacity: 0.5;
    border-color: var(--color-danger);
}

/* ── Botones ────────────────────────────────────────────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, var(--color-brand-dark), var(--color-brand-medium));
    color: var(--color-text-primary);
    font-weight: 600;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-base);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-brand-medium), var(--color-brand-dark));
    box-shadow: var(--shadow-glow-blue);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: var(--color-success);
    color: white;
    font-weight: 600;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-success:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

.btn-danger {
    background: transparent;
    color: var(--color-danger);
    font-weight: 600;
    padding: 8px 16px;
    border: 1px solid var(--color-danger);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-danger:hover {
    background: rgba(239,68,68,0.1);
    transform: translateY(-1px);
}

/* ── Mensajes de error/éxito ────────────────────────────────────────────────── */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    z-index: 9999;
    animation: slideUp var(--transition-base) ease forwards;
    max-width: 400px;
}

.toast.error {
    background: rgba(239,68,68,0.15);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
}

.toast.success {
    background: rgba(34,197,94,0.15);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

/* ── FAB (botón flotante) ───────────────────────────────────────────────────── */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--color-brand-gold), var(--color-brand-gold-light));
    color: var(--color-bg-primary);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg), var(--shadow-glow-gold);
    transition: all var(--transition-fast);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 40px rgba(201,162,39,0.3);
}

/* ── Modal Q&A ──────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-xl);
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    animation: slideUp var(--transition-base) ease;
    border: 1px solid var(--color-border);
    border-bottom: none;
}

@media (min-width: 640px) {
    .modal-content {
        border-radius: var(--radius-xl);
        margin-bottom: 10vh;
        border-bottom: 1px solid var(--color-border);
    }

    .modal-overlay.active {
        align-items: center;
    }
}

/* ── Teleprompter (presenter) ───────────────────────────────────────────────── */
.teleprompter-name {
    color: var(--color-brand-gold);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: var(--space-md);
    transition: opacity var(--transition-slow);
}

.teleprompter-question {
    color: var(--color-text-primary);
    font-size: 42px;
    font-weight: 700;
    line-height: 1.3;
    transition: opacity var(--transition-slow);
}

/* ── Scrollbar personalizada ────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* ── Loading spinner ────────────────────────────────────────────────────────── */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-brand-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Hidden utility ─────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}
