/* ============================================
   EL IMPOSTOR - Diseño Familiar y Legible
   ============================================ */

/* Google Font - Nunito es muy legible y amigable */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
    /* Paleta cálida y familiar */
    --primary: #5D4E8C;          /* Púrpura suave */
    --primary-light: #7B6BA8;
    --primary-dark: #453A6B;

    --accent: #FF6B6B;           /* Coral cálido */
    --accent-light: #FF8E8E;
    --accent-dark: #E85555;

    --success: #4ECDC4;          /* Turquesa amigable */
    --success-light: #7EDDD6;
    --success-dark: #3DBDB5;

    --warning: #FFE66D;          /* Amarillo suave */
    --warning-dark: #F5D93A;

    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-light: #F8F9FE;
    --bg-white: #FFFFFF;
    --bg-card: #FFFFFF;

    --text-dark: #2D3436;
    --text-medium: #636E72;
    --text-light: #95A5A6;

    --shadow-soft: 0 4px 20px rgba(93, 78, 140, 0.15);
    --shadow-medium: 0 8px 30px rgba(93, 78, 140, 0.2);
    --shadow-strong: 0 12px 40px rgba(93, 78, 140, 0.25);

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
}

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

html {
    font-size: 18px; /* Base más grande para mejor legibilidad */
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* ============================================
   HEADER - Grande y Amigable
   ============================================ */
.header {
    text-align: center;
    padding: 30px 20px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
}

.logo {
    font-size: 4rem;
    margin-bottom: 10px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
    animation: float 3s ease-in-out infinite;
}

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

.title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-medium);
    font-weight: 600;
}

/* ============================================
   CARDS - Claras y Legibles
   ============================================ */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-medium);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title span {
    font-size: 1.4rem;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-medium);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input, input[type="text"] {
    width: 100%;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border: 2px solid #E8E8E8;
    background: var(--bg-light);
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.input:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px rgba(93, 78, 140, 0.1);
}

.input::placeholder, input::placeholder {
    color: var(--text-light);
    font-weight: 500;
}

/* ============================================
   SELECTOR DE CATEGORÍA
   ============================================ */
.category-selector {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    position: relative;
    z-index: 500;
}

.category-selector label {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

.category-selector select {
    display: block;
    width: 100%;
    min-height: 54px;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-dark);
    background-color: #fff;
    border: 2px solid #E8E8E8;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    z-index: 100;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
}

/* ============================================
   BOTONES - Grandes y Claros
   ============================================ */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 18px 28px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 1.15rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
    text-decoration: none;
}

.btn span {
    font-size: 1.3rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(93, 78, 140, 0.4);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(93, 78, 140, 0.5);
}

.btn-primary:disabled {
    background: #B8B8B8;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--primary);
    border: 3px solid var(--primary);
}

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

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.btn-success:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-danger:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
}

/* ============================================
   LISTA DE JUGADORES
   ============================================ */
.players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(93, 78, 140, 0.08), rgba(123, 107, 168, 0.05));
    border-radius: var(--radius-md);
    border: 2px solid rgba(93, 78, 140, 0.15);
    transition: all 0.2s ease;
}

.player-item:hover {
    border-color: var(--primary-light);
    background: linear-gradient(135deg, rgba(93, 78, 140, 0.12), rgba(123, 107, 168, 0.08));
}

.player-avatar {
    font-size: 2.2rem;
    line-height: 1;
}

.player-name {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.player-delete {
    background: var(--accent);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.player-delete:hover {
    background: var(--accent-dark);
    transform: scale(1.1);
}

/* ============================================
   INSTRUCCIONES
   ============================================ */
.instructions {
    background: linear-gradient(135deg, #FFF9E6, #FFF5D6);
    border: 3px dashed var(--warning-dark);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.instructions-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    font-size: 1rem;
    color: var(--text-dark);
    padding: 10px 0;
    padding-left: 32px;
    position: relative;
    line-height: 1.5;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
}

.instructions li:last-child {
    border-bottom: none;
}

.instructions li::before {
    content: '✨';
    position: absolute;
    left: 0;
    font-size: 1.1rem;
}

/* ============================================
   CARTA DEL JUEGO
   ============================================ */
.game-card {
    width: 260px;
    height: 360px;
    margin: 25px auto;
    perspective: 1000px;
    cursor: pointer;
}

.game-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.game-card.flipped .game-card-inner {
    transform: rotateY(180deg);
}

.game-card-front,
.game-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    box-shadow: var(--shadow-strong);
    overflow: hidden;
}

.game-card-front {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.game-card-back {
    background: white;
    transform: rotateY(180deg);
    border: 4px solid var(--primary);
}

.game-card-back.impostor {
    border-color: var(--accent);
    background: linear-gradient(135deg, #FFF5F5, #FFE8E8);
}

/* Contenido de la carta */
.game-card-back .card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: filter 0.5s ease, opacity 0.5s ease;
}

/* Efecto de difuminado progresivo */
.game-card-back.blur-1 .card-content { filter: blur(2px); opacity: 0.85; }
.game-card-back.blur-2 .card-content { filter: blur(5px); opacity: 0.65; }
.game-card-back.blur-3 .card-content { filter: blur(10px); opacity: 0.4; }
.game-card-back.blur-4 .card-content { filter: blur(16px); opacity: 0.15; }
.game-card-back.blur-5 .card-content { filter: blur(25px); opacity: 0; }

.card-icon {
    font-size: 4.5rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.card-text {
    font-size: 1.3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.secret-word {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary);
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.impostor-text {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.3;
}

/* ============================================
   VOTACIÓN
   ============================================ */
.voting-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vote-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--bg-light);
    border: 3px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.vote-option:hover {
    background: rgba(93, 78, 140, 0.1);
    border-color: var(--primary-light);
}

.vote-option.selected {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(255, 107, 107, 0.1));
    border-color: var(--accent);
}

.vote-avatar {
    font-size: 2.5rem;
}

.vote-name {
    flex: 1;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
}

.vote-check {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #E0E0E0;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: all 0.3s ease;
}

.vote-option.selected .vote-check {
    background: var(--accent);
    color: white;
}

/* ============================================
   RESULTADOS
   ============================================ */
.result-message {
    text-align: center;
    padding: 40px 30px;
    border-radius: var(--radius-xl);
    margin-bottom: 25px;
    box-shadow: var(--shadow-medium);
}

.result-message.winner {
    background: linear-gradient(135deg, #E8FFF8, #D4F5ED);
    border: 4px solid var(--success);
}

.result-message.loser {
    background: linear-gradient(135deg, #FFF0F0, #FFE4E4);
    border: 4px solid var(--accent);
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 15px;
    animation: bounce 1s infinite;
}

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

.result-title {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 10px;
}

.result-message.winner .result-title {
    color: var(--success-dark);
}

.result-message.loser .result-title {
    color: var(--accent-dark);
}

.result-text {
    font-size: 1.1rem;
    color: var(--text-medium);
    font-weight: 600;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
}

.badge-impostor {
    background: var(--accent);
    color: white;
}

.badge-ciudadano {
    background: var(--success);
    color: white;
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--accent); }

.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

/* ============================================
   FOOTER
   ============================================ */
footer {
    text-align: center;
    padding: 25px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 600;
}

/* ============================================
   BOTÓN ADMIN (discreto)
   ============================================ */
.admin-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: var(--shadow-soft);
    opacity: 0.5;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-btn:hover {
    opacity: 1;
    transform: scale(1.1) rotate(90deg);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    html {
        font-size: 16px;
    }

    .container {
        padding: 15px;
    }

    .header {
        padding: 25px 15px;
        border-radius: var(--radius-lg);
    }

    .logo {
        font-size: 3.5rem;
    }

    .title {
        font-size: 1.7rem;
    }

    .card {
        padding: 20px;
        border-radius: var(--radius-md);
    }

    .game-card {
        width: 220px;
        height: 310px;
    }

    .btn {
        padding: 16px 24px;
        font-size: 1.05rem;
    }
}

/* ============================================
   ANIMACIONES ESPECIALES
   ============================================ */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

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

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(93, 78, 140, 0.3); }
    50% { box-shadow: 0 0 40px rgba(93, 78, 140, 0.5); }
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.15); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

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

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

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

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

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

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.1); }
    28% { transform: scale(1); }
    42% { transform: scale(1.1); }
    70% { transform: scale(1); }
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.shake { animation: shake 0.5s ease; }
.pulse { animation: pulse 2s ease infinite; }
.glow { animation: glow 2s ease infinite; }
.bounce-in { animation: bounceIn 0.6s ease both; }
.slide-up { animation: slideUp 0.5s ease both; }
.slide-in { animation: slideIn 0.5s ease both; }
.fade-in { animation: fadeIn 0.5s ease both; }
.wiggle { animation: wiggle 0.5s ease; }
.pop { animation: pop 0.3s ease; }
.heartbeat { animation: heartbeat 1.5s ease infinite; }

/* Animaciones para elementos de lista */
.player-item {
    animation: slideUp 0.4s ease both;
}

.player-item:nth-child(1) { animation-delay: 0s; }
.player-item:nth-child(2) { animation-delay: 0.05s; }
.player-item:nth-child(3) { animation-delay: 0.1s; }
.player-item:nth-child(4) { animation-delay: 0.15s; }
.player-item:nth-child(5) { animation-delay: 0.2s; }
.player-item:nth-child(6) { animation-delay: 0.25s; }
.player-item:nth-child(7) { animation-delay: 0.3s; }
.player-item:nth-child(8) { animation-delay: 0.35s; }
.player-item:nth-child(9) { animation-delay: 0.4s; }
.player-item:nth-child(10) { animation-delay: 0.45s; }
.player-item:nth-child(11) { animation-delay: 0.5s; }
.player-item:nth-child(12) { animation-delay: 0.55s; }

/* Animacion hover para botones */
.btn:active {
    transform: scale(0.95);
}

/* Animacion para cards al cargar */
.card {
    animation: slideUp 0.5s ease both;
}

.card:nth-of-type(1) { animation-delay: 0.1s; }
.card:nth-of-type(2) { animation-delay: 0.2s; }
.card:nth-of-type(3) { animation-delay: 0.3s; }

/* Transicion suave para la carta del juego */
.game-card {
    animation: bounceIn 0.8s ease both;
}

/* Efecto de resplandor para la carta impostor */
.game-card-back.impostor {
    animation: glowRed 2s ease infinite;
}

@keyframes glowRed {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 107, 107, 0.3), var(--shadow-strong); }
    50% { box-shadow: 0 0 40px rgba(255, 107, 107, 0.5), var(--shadow-strong); }
}

/* Contenedor para impostor en reveal */
.impostor-reveal {
    text-align: center;
    padding: 10px;
}

/* ============================================
   PWA - Offline indicator
   ============================================ */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--accent);
    color: white;
    text-align: center;
    padding: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 10000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-banner.show {
    transform: translateY(0);
}

/* ============================================
   INSTALL PWA BUTTON
   ============================================ */
.install-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: var(--shadow-medium);
    display: none;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.5s ease both;
    z-index: 1000;
}

.install-btn:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
}

.install-btn.show {
    display: flex;
}
