/* =====================================================
   La Marquesina - Centro de Juegos Familiares
   Estilo Visual - Moderno, Divertido, Boricua
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap');

:root {
    /* Paleta de colores inspirada en PR */
    --color-primary: #E63946;       /* Rojo vibrante */
    --color-secondary: #1D3557;     /* Azul profundo */
    --color-accent: #F4A261;        /* Naranja tropical */
    --color-success: #2A9D8F;       /* Verde teal */
    --color-warning: #E9C46A;       /* Amarillo dorado */
    --color-purple: #7B2CBF;        /* Púrpura festivo */
    
    /* Fondos */
    --bg-primary: #0D1B2A;          /* Fondo oscuro */
    --bg-secondary: #1B2838;        /* Fondo cards */
    --bg-card: #243447;             /* Cards elevadas */
    --bg-gradient: linear-gradient(135deg, #0D1B2A 0%, #1B2838 50%, #1D3557 100%);
    
    /* Textos */
    --text-primary: #FFFFFF;
    --text-secondary: #A8DADC;
    --text-muted: #8892B0;
    
    /* Efectos */
    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-button: 0 4px 15px rgba(230, 57, 70, 0.4);
    --shadow-glow: 0 0 30px rgba(230, 57, 70, 0.3);
    
    /* Bordes */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 30px;
    --radius-full: 50px;
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset y Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Fondo animado con partículas */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(230, 57, 70, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(42, 157, 143, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(123, 44, 191, 0.08) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* Contenedor principal */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* =====================================================
   Tipografía
   ===================================================== */

h1, h2, h3, h4 {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

.title-main {
    font-size: clamp(2.5rem, 8vw, 4rem);
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent), var(--color-warning));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-align: center;
    text-shadow: 0 4px 30px rgba(230, 57, 70, 0.3);
    margin-bottom: 0.5rem;
    animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

/* =====================================================
   Header
   ===================================================== */

.header {
    text-align: center;
    padding: 2rem 0;
    position: relative;
}

.logo-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.back-button {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-button:hover {
    background: var(--color-primary);
    transform: translateY(-50%) scale(1.1);
}

/* =====================================================
   Cards de Juegos
   ===================================================== */

.games-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

.game-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--card-color, var(--color-primary)), var(--color-accent));
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-glow);
}

.game-card:active {
    transform: translateY(-4px) scale(0.98);
}

.game-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    display: block;
}

.game-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.game-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.game-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--color-success);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.game-badge.coming-soon {
    background: var(--text-muted);
}

/* =====================================================
   Botones
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-bounce);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), #C1121F);
    color: white;
    box-shadow: var(--shadow-button);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(230, 57, 70, 0.5);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--color-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success), #21867a);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--color-warning), #daa520);
    color: var(--bg-primary);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 1.2rem 2.5rem;
    font-size: 1.25rem;
}

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

/* =====================================================
   Formularios
   ===================================================== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-secondary);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition-normal);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Number Input Stepper */
.number-stepper {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
}

.number-stepper button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.number-stepper button:hover {
    background: var(--color-primary);
}

.number-stepper button:active {
    transform: scale(0.9);
}

.number-stepper .number-display {
    font-family: 'Fredoka', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    min-width: 80px;
    text-align: center;
    color: var(--color-accent);
}

/* Player Input List */
.player-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.player-input-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.player-number {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.player-input-row input {
    flex: 1;
}

/* =====================================================
   Categorías Grid
   ===================================================== */

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.category-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-bounce);
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--cat-color, var(--color-primary)), transparent);
    opacity: 0.1;
    transition: var(--transition-normal);
}

.category-card:hover {
    transform: translateY(-5px) scale(1.03);
    border-color: var(--cat-color, var(--color-primary));
}

.category-card:hover::before {
    opacity: 0.2;
}

.category-card.selected {
    border-color: var(--cat-color, var(--color-primary));
    box-shadow: 0 0 20px var(--cat-color, var(--color-primary));
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.category-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 600;
}

/* =====================================================
   Pantalla de Rol (Pass the Phone)
   ===================================================== */

.role-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.role-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.role-card.impostor {
    border: 3px solid var(--color-primary);
    animation: pulseRed 2s ease-in-out infinite;
}

@keyframes pulseRed {
    0%, 100% { box-shadow: 0 0 20px rgba(230, 57, 70, 0.3); }
    50% { box-shadow: 0 0 40px rgba(230, 57, 70, 0.6); }
}

.role-card.normal {
    border: 3px solid var(--color-success);
}

.player-name-display {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.role-reveal {
    display: none;
}

.role-reveal.visible {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.role-emoji {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.role-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.role-title.impostor-text {
    color: var(--color-primary);
}

.role-title.normal-text {
    color: var(--color-success);
}

.tema-display {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
}

.tema-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.tema-word {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    color: var(--color-accent);
}

.pista-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.5rem;
}

.tap-instruction {
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* =====================================================
   Timer
   ===================================================== */

.timer-container {
    margin: 2rem 0;
    text-align: center;
}

.timer-display {
    font-family: 'Fredoka', sans-serif;
    font-size: 5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

.timer-display.warning {
    color: var(--color-warning);
    animation: timerPulse 0.5s ease-in-out infinite;
}

.timer-display.danger {
    color: var(--color-primary);
    animation: timerPulse 0.25s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.timer-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Timer Options */
.timer-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1.5rem 0;
}

.timer-option {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.timer-option:hover {
    border-color: var(--color-primary);
}

.timer-option.selected {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* =====================================================
   Pantalla de Juego Activo
   ===================================================== */

.game-active {
    text-align: center;
    padding: 2rem 0;
}

.game-info {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.game-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    margin-bottom: 1rem;
}

.players-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.player-chip {
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-align: center;
    transition: var(--transition-normal);
}

.player-chip.voted-out {
    opacity: 0.4;
    text-decoration: line-through;
}

.player-chip.suspected {
    border: 2px solid var(--color-warning);
}

/* =====================================================
   Modal/Overlay
   ===================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    transform: scale(0.8);
    transition: var(--transition-bounce);
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

/* =====================================================
   Resultado Final
   ===================================================== */

.result-screen {
    text-align: center;
    padding: 3rem 1rem;
}

.result-emoji {
    font-size: 6rem;
    margin-bottom: 1rem;
    animation: bounceIn 0.6s ease-out;
}

.result-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.result-title.win {
    color: var(--color-success);
}

.result-title.lose {
    color: var(--color-primary);
}

.result-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.impostor-reveal {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

/* =====================================================
   Utilidades
   ===================================================== */

.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden { display: none !important; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .category-card {
        padding: 1rem 0.75rem;
    }
    
    .category-icon {
        font-size: 2rem;
    }
    
    .category-name {
        font-size: 0.85rem;
    }
    
    .timer-display {
        font-size: 4rem;
    }
    
    .role-emoji {
        font-size: 4rem;
    }
    
    .number-stepper .number-display {
        font-size: 2.5rem;
    }
    
    .number-stepper button {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 30px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =====================================================
   Animaciones de página
   ===================================================== */

.page-enter {
    animation: pageEnter 0.4s ease-out forwards;
}

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

/* Loading spinner */
.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Confetti animation class (to be triggered via JS) */
.confetti-active {
    position: relative;
    overflow: hidden;
}
