/* ============================================================
   ESTILOS — Sistema Interactivo Tiempo Real
   Personería Municipal de Soacha
   Paleta: Azul Institucional + Estilo Kahoot/Mentimeter
   ============================================================ */

:root {
    --primary: #003366;
    --primary-mid: #004C99;
    --primary-light: #0066CC;
    --primary-soft: #E8F0FE;
    --white: #FFFFFF;
    --gold: #FFD700;
    --silver: #C0C0C0;
    --bronze: #CD7F32;
    --green: #2ecc71;
    --red: #e74c3c;
    --blue: #3498db;
    --orange: #f39c12;
    --purple: #9b59b6;
    --dark: #1a1a2e;
    --darker: #16213e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: 'Nunito', 'Segoe UI', sans-serif; }

.body-bg {
    background: linear-gradient(135deg, var(--dark) 0%, var(--darker) 50%, var(--primary) 100%);
    min-height: 100vh;
}

/* ═══ GLOBAL UTILITIES ═══ */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.color-primary { color: var(--primary); }

/* ═══ GLASS CARD ═══ */
.card-glass {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

/* ═══ INPUTS ═══ */
.input-custom {
    border: 2px solid #dee2e6;
    border-radius: 14px;
    padding: 12px 20px;
    font-size: 1.05rem;
    font-weight: 600;
    transition: all 0.3s;
}
.input-custom:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(0,102,204,0.15);
}

.input-pin {
    border: 3px solid var(--primary);
    border-radius: 16px;
    padding: 16px;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 12px;
    color: var(--primary);
    text-align: center;
}
.input-pin:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(255,215,0,0.3);
}
.input-pin::placeholder {
    letter-spacing: 12px;
    color: #ccc;
}

/* ═══ BUTTONS ═══ */
.btn-kahoot {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border: none;
    border-radius: 50px;
    padding: 14px 40px;
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
}
.btn-kahoot:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,51,102,0.4);
}

/* ═══ HEADER INSTITUCIONAL ═══ */
.header-inst {
    background: var(--primary);
    color: var(--white);
    padding: 12px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* ═══ ADMIN TOOLBAR ═══ */
.admin-toolbar {
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    color: white;
    padding: 10px 16px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.btn-show-toolbar {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 999;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    cursor: pointer;
}

/* ═══ PANTALLA PROYECTOR ═══ */
.pantalla-proyector {
    padding-top: 70px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pantalla-proyector > div {
    width: 100%;
    max-width: 1100px;
    padding: 2rem;
}

/* ═══ PIN GIGANTE ═══ */
.pin-gigante {
    background: rgba(255,255,255,0.1);
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 24px;
    padding: 2rem;
    display: inline-block;
}
.pin-label {
    color: rgba(255,255,255,0.7);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}
.pin-number {
    font-size: 5rem;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 16px;
    text-shadow: 0 4px 15px rgba(255,215,0,0.4);
}

/* ═══ JUGADOR CARD (LOBBY) ═══ */
.jugador-card {
    background: rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 12px 20px;
    text-align: center;
    color: white;
    min-width: 100px;
    backdrop-filter: blur(5px);
}

/* ═══ PREGUNTA - PROYECTOR ═══ */
.pregunta-proyector {
    width: 100%;
}

.badge-pregunta {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 6px 18px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
}

.badge-tipo {
    background: var(--gold);
    color: var(--dark);
    padding: 6px 18px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
}

.timer-proyector {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    border: 3px solid rgba(255,255,255,0.3);
}
.timer-proyector.alerta {
    background: var(--red);
    border-color: var(--red);
    animation: pulse-anim 0.5s infinite;
}

.barra-timer-proyector {
    height: 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}
.barra-timer-proyector .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--gold));
    border-radius: 4px;
    transition: width 1s linear;
}
.barra-timer-proyector .fill.alerta {
    background: linear-gradient(90deg, #ff6b6b, var(--red));
}

.texto-pregunta-proyector {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ═══ OPCIONES - PROYECTOR ═══ */
.opciones-proyector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.opcion-card {
    padding: 20px;
    border-radius: 16px;
    color: white;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-height: 80px;
}

.opcion-icono {
    font-size: 1.8rem;
    opacity: 0.9;
}

.opcion-texto {
    flex: 1;
}

/* ═══ RESULTADOS - BARRAS ═══ */
.resultado-barras {
    max-width: 700px;
    margin: 0 auto;
}

.barra-resultado {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 14px;
    transition: all 0.3s;
}
.barra-resultado.correcta {
    background: rgba(46,204,113,0.15);
    border: 2px solid var(--green);
}

.barra-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
    margin-bottom: 8px;
}

.barra-icono {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.barra-texto {
    flex: 1;
    font-size: 0.95rem;
}

.barra-track {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    height: 36px;
    position: relative;
    overflow: hidden;
}

.barra-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
    min-width: 40px;
}

.barra-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ═══ NUBE DE PALABRAS ═══ */
.word-cloud, .word-cloud-resultado {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 16px;
    padding: 2rem;
    min-height: 200px;
}

.cloud-word {
    display: inline-block;
    font-weight: 700;
    transition: all 0.3s;
    cursor: default;
}
.cloud-word.size-1 { font-size: 1rem; opacity: 0.7; }
.cloud-word.size-2 { font-size: 1.6rem; opacity: 0.8; }
.cloud-word.size-3 { font-size: 2.4rem; opacity: 0.9; }
.cloud-word.size-4 { font-size: 3.2rem; }

/* ═══ RESPUESTAS ABIERTAS ═══ */
.respuestas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.respuesta-card {
    background: rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    gap: 10px;
    color: white;
    backdrop-filter: blur(5px);
}

.resp-avatar { font-size: 1.5rem; }
.resp-contenido { flex: 1; }
.resp-nombre { font-size: 0.85rem; opacity: 0.7; }
.resp-texto { font-size: 0.95rem; margin-top: 2px; }

/* ═══ EMPAREJAR - PROYECTOR ═══ */
.emparejar-proyector, .emparejar-resultado {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 700px;
    margin: 0 auto;
}

.pareja-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.pareja-row.correcta .pareja-izq,
.pareja-row.correcta .pareja-der {
    background: rgba(46,204,113,0.15);
}

.pareja-izq, .pareja-der {
    background: rgba(255,255,255,0.1);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    border: 3px solid;
    min-width: 150px;
    text-align: center;
    font-size: 0.95rem;
}
.pareja-linea {
    color: rgba(255,255,255,0.5);
    font-size: 1.5rem;
}

/* ═══ MINI RANKING ═══ */
.mini-ranking-list {
    max-width: 500px;
    margin: 0 auto;
}

.mini-rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    margin-bottom: 8px;
    color: white;
}
.mini-rank-item.first {
    background: rgba(255,215,0,0.15);
    border: 2px solid var(--gold);
}

.rank-medal { font-size: 1.5rem; }
.rank-avatar { font-size: 1.3rem; }
.rank-name { flex: 1; font-weight: 600; }
.rank-pts { font-weight: 800; color: var(--gold); }

/* ═══ PODIO ═══ */
.podio-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 12px;
    min-height: 260px;
}

.podio-lugar {
    text-align: center;
    border-radius: 16px 16px 0 0;
    padding: 1.5rem 1rem;
    color: white;
    min-width: 130px;
    animation: slide-up 0.8s ease-out;
}

.podio-lugar .medalla { font-size: 2.5rem; display: block; margin-bottom: 4px; }
.podio-lugar .posicion { font-size: 2rem; font-weight: 800; }
.podio-lugar .nombre-podio { font-size: 0.9rem; font-weight: 700; word-wrap: break-word; margin-top: 4px; }
.podio-lugar .puntaje-podio { font-size: 1rem; font-weight: 800; opacity: 0.9; margin-top: 2px; }

.podio-1 { background: linear-gradient(180deg, #FFD700, #FFA000); height: 220px; order: 2; animation-delay: 0.2s; }
.podio-2 { background: linear-gradient(180deg, #C0C0C0, #8E8E8E); height: 180px; order: 1; animation-delay: 0.4s; }
.podio-3 { background: linear-gradient(180deg, #CD7F32, #A0522D); height: 140px; order: 3; animation-delay: 0.6s; }

.ranking-table-wrap {
    max-width: 600px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
}

/* ═══════════════════════════════════════ */
/* ═══ PLAYER (MOBILE-FIRST) ═══ */
/* ═══════════════════════════════════════ */

.player-header {
    background: var(--primary);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.sala-container {
    padding-top: 52px;
    min-height: 100vh;
}

.sala-vista {
    min-height: calc(100vh - 52px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Timer player */
.player-timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.player-timer-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--gold));
    transition: width 1s linear;
    border-radius: 3px;
}
.player-timer-bar .fill.alerta {
    background: linear-gradient(90deg, #ff6b6b, var(--red));
}

.timer-player {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    border: 2px solid rgba(255,255,255,0.3);
}
.timer-player.alerta {
    background: var(--red);
    border-color: var(--red);
    animation: pulse-anim 0.5s infinite;
}

.badge-pregunta-sm {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 14px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
}

.texto-pregunta-player {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
}

/* ═══ OPCIONES - PLAYER ═══ */
.opciones-player {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.opcion-btn-player {
    border: none;
    border-radius: 16px;
    color: white;
    padding: 20px 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    min-height: 100px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.opcion-btn-player:active {
    transform: scale(0.95);
}
.opcion-btn-player .opc-icono {
    font-size: 1.8rem;
}
.opcion-btn-player.seleccionada {
    box-shadow: 0 0 0 4px white, 0 4px 20px rgba(0,0,0,0.3);
    transform: scale(1.03);
}

/* ═══ EMPAREJAR - PLAYER ═══ */
.emparejar-instruccion {
    font-size: 0.9rem;
    opacity: 0.8;
}

.emparejar-columnas {
    display: flex;
    gap: 12px;
    width: 100%;
}

.emp-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.emp-item {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 3px solid;
    border-radius: 12px;
    padding: 12px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.emp-item.emp-activo {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
}

.emp-item.emp-matched {
    opacity: 0.9;
}

/* ═══ FEEDBACK PLAYER ═══ */
.feedback-player {
    text-align: center;
    padding: 2rem;
    border-radius: 20px;
    width: 100%;
}
.feedback-player.correcto { background: rgba(46,204,113,0.2); }
.feedback-player.incorrecto { background: rgba(231,76,60,0.2); }
.feedback-player.enviado { background: rgba(255,255,255,0.1); }

.fb-emoji { font-size: 3rem; margin-bottom: 8px; }
.fb-text { color: white; font-size: 1.5rem; font-weight: 800; }
.fb-puntos { color: var(--gold); font-size: 1.3rem; font-weight: 800; margin-top: 4px; }

/* ═══ RESULTADO PLAYER CARD ═══ */
.resultado-player-card {
    padding: 2rem;
    border-radius: 20px;
    color: white;
    width: 100%;
}
.resultado-player-card.correcto { background: rgba(46,204,113,0.2); }
.resultado-player-card.incorrecto { background: rgba(231,76,60,0.2); }
.resultado-player-card.neutro { background: rgba(255,255,255,0.1); }

/* ═══ RANKING PLAYER LIST ═══ */
.ranking-list-player { width: 100%; max-width: 400px; }

.rank-item-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    margin-bottom: 8px;
    color: white;
}
.rank-item-player.top-1 { background: rgba(255,215,0,0.2); border: 2px solid var(--gold); }
.rank-item-player.top-2 { background: rgba(192,192,192,0.15); border: 2px solid var(--silver); }
.rank-item-player.top-3 { background: rgba(205,127,50,0.15); border: 2px solid var(--bronze); }

.rank-pos { font-size: 1.3rem; min-width: 30px; text-align: center; }
.rank-av { font-size: 1.2rem; }
.rank-nm { flex: 1; font-weight: 600; font-size: 0.95rem; }
.rank-pt { font-weight: 800; color: var(--gold); }

.idea-card-sm {
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 14px;
    color: white;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.word-cloud-player {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 10px;
}

.final-score-player {
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 2rem;
}

/* ═══ LOBBY PULSE ═══ */
.lobby-pulse {
    animation: pulse-anim 2s infinite;
}

/* ═══ ANIMATIONS ═══ */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(60px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-anim {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes shake-anim {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes bounce-in {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pop {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.animate-fade-up { animation: fade-up 0.5s ease-out; }
.animate-bounce-in { animation: bounce-in 0.6s ease-out; }
.animate-shake { animation: shake-anim 0.5s ease; }
.animate-pop { animation: pop 0.4s ease-out both; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .pin-number { font-size: 3rem; letter-spacing: 10px; }
    .texto-pregunta-proyector { font-size: 1.3rem; }
    .opciones-proyector { grid-template-columns: 1fr; }
    .podio-lugar { min-width: 90px; padding: 1rem 0.5rem; }
    .podio-1 { height: 180px; }
    .podio-2 { height: 150px; }
    .podio-3 { height: 120px; }
    .respuestas-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .opciones-player { grid-template-columns: 1fr; }
    .opcion-btn-player { min-height: 70px; flex-direction: row; padding: 14px; }
    .emparejar-columnas { flex-direction: column; }
    .emp-item { font-size: 0.8rem; padding: 10px 8px; }
    .texto-pregunta-player { font-size: 1rem; }
    .card-glass { padding: 1.2rem; }
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
