/**
 * Estilos Frontend para Quiz Mundial Pro
 */

:root {
    --qmp-primary: #fd8103;
    --qmp-primary-hover: #e07202;
    --qmp-secondary: #9f25b4;
    --qmp-secondary-hover: #b83ad1;
    --qmp-bg: #f8fafc;
    --qmp-card-bg: #ffffff;
    --qmp-text: #1e293b;
    --qmp-text-light: #64748b;
    --qmp-border: #e2e8f0;
}

.qmp-main-container {
    display: flex;
    gap: 25px;
    max-width: 1080px;
    margin: 50px auto;
    position: relative;
    z-index: 1;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--qmp-text);
    align-items: flex-start;
}

#qmp-countdown-number {
    font-size: 100px;
}

/* Área Principal */
.qmp-quiz-area {
    flex: 2;
    background: var(--qmp-card-bg);
    border-radius: 16px;
    padding: 20px; /* Reducido */
    box-shadow: 0 15px 45px rgba(0,0,0,0.1);
}

.qmp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px; /* Reducido */
}

.qmp-title h2 {
    margin: 0 0 2px 0;
    font-size: 22px; /* Reducido */
    font-weight: 800;
}

.qmp-title p {
    color: var(--qmp-text-light);
    margin: 0;
}

/* Temporizador Circular */
.qmp-timer-container {
    position: relative;
    width: 100px;
    height: 100px;
}

.qmp-timer-svg {
    transform: rotate(-90deg);
}

.qmp-timer-bg {
    fill: none !important;
    stroke: #f1f5f9;
    stroke-width: 6;
}

.qmp-timer-bar {
    fill: none !important;
    stroke: var(--qmp-primary);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.qmp-time-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 800;
    font-size: 16px;
    color: var(--qmp-primary);
    transition: color 0.3s ease;
}

/* Pregunta y Progreso */
.qmp-progress-bar {
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
    margin: 10px 0; /* Reducido */
    overflow: hidden;
}

.qmp-progress-fill {
    height: 100%;
    background: var(--qmp-primary);
    width: 0%;
    transition: width 0.3s ease;
}

.qmp-question-content {
    display: flex;
    gap: 20px;
    margin-top: 30px; /* Más espacio bajo la barra de progreso */
    align-items: center;
}

.qmp-question-image {
    flex: 0 0 32%;
    max-width: 320px;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    background: #f8fafc; /* Light neutral background */
    display: flex;
    align-items: center;
    justify-content: center;
}

.qmp-question-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.qmp-question-options {
    flex: 1;
}

.qmp-option-item {
    display: block;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.qmp-option-item input {
    display: none;
}

.qmp-option-letter {
    display: inline-flex;
    width: 28px;
    height: 28px;
    background: #f1f5f9;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: 700;
    font-size: 13px;
}

.qmp-option-item input:checked + .qmp-option-text .qmp-option-letter {
    background: var(--qmp-primary);
    color: #fff;
}

.qmp-option-item input:checked {
    border-color: var(--qmp-primary);
}

/* Botones de Navegación */
.qmp-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
}

.qmp-btn {
    padding: 12px 30px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.qmp-btn-prev {
    background: #fff;
    border: 1px solid var(--qmp-border);
    color: var(--qmp-text);
}

.qmp-btn-next {
    background: var(--qmp-secondary);
    color: #fff;
}

.qmp-btn-next:hover {
    background: var(--qmp-secondary-hover);
}

/* Sidebar Ranking */
.qmp-sidebar {
    flex: 1;
    max-width: 350px;
}

.qmp-ranking-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.05);
}

.ranking-tabs {
    display: flex;
    gap: 5px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.ranking-tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
}

.ranking-tab.active {
    background: var(--qmp-primary);
    color: #fff;
}

.ranking-list-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f8fafc;
}

.rank-pos {
    width: 30px;
    font-weight: 700;
    color: var(--qmp-text-light);
}

.rank-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.rank-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.rank-pts {
    font-weight: 800;
    color: var(--qmp-primary);
}

/* Footer Icons */
.qmp-footer-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--qmp-text-light);
}

/* Responsive */
@media (max-width: 900px) {
    .qmp-main-container {
        flex-direction: column;
        margin-top: 30px;
        padding: 0 15px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .qmp-quiz-area {
        padding: 15px !important;
        border-radius: 12px;
        width: 100% !important;
        box-sizing: border-box !important;
        flex: none !important;
    }
    .qmp-question-content {
        flex-direction: column;
        margin-top: 15px;
        gap: 15px;
        align-items: stretch;
    }
    .qmp-question-image {
        flex: none;
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        max-width: 220px;
        margin: 0 auto 15px auto;
    }
    .qmp-question-options h3 {
        font-size: 18px !important;
        margin-bottom: 10px !important;
    }
    .qmp-option {
        padding: 6px 12px !important;
    }
    .option-text {
        font-size: 14px !important;
    }
    .qmp-sidebar {
        max-width: 100%;
    }
    .qmp-footer-info {
        display: none !important; /* Ocultar en móviles para ganar espacio */
    }
    .qmp-header {
        margin-bottom: 5px;
    }
    .qmp-title h2 {
        font-size: 18px;
    }
    .qmp-timer-container {
        width: 60px;
        height: 60px;
    }
    .qmp-timer-svg {
        width: 60px !important;
        height: 60px !important;
    }
    .qmp-timer-bg, .qmp-timer-bar {
        r: 26 !important;
        cx: 30 !important;
        cy: 30 !important;
    }
    .qmp-time-text {
        font-size: 12px !important;
        width: 100%;
        text-align: center;
    }
    .qmp-title p {
        display: none; /* Ocultar descripción secundaria */
    }
    .qmp-progress-bar {
        margin: 5px 0 !important;
    }
    .qmp-navigation {
        margin-top: 15px;
    }
    .qmp-navigation .qmp-btn {
        padding: 10px 20px !important;
        font-size: 14px !important;
    }
    #qmp-countdown-number {
        font-size: 60px;
    }
}

/* Full Leaderboard Table Styles */
.qmp-leaderboard-container {
    max-width: 900px;
    margin: 0 auto;
}

.qmp-leaderboard-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.leaderboard-header {
    text-align: center;
    margin-bottom: 30px;
}

.leaderboard-header h2 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
}

.qmp-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.qmp-leaderboard-table th {
    text-align: left;
    padding: 15px;
    border-bottom: 2px solid #f1f5f9;
    color: var(--qmp-text-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 1px;
}

.qmp-leaderboard-table td {
    padding: 15px;
    border-bottom: 1px solid #f8fafc;
    vertical-align: middle;
}

.leaderboard-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 700;
    font-size: 16px;
}

.leaderboard-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.rank-badge-full {
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--qmp-text);
}

.leaderboard-score {
    font-weight: 800;
    color: var(--qmp-primary);
    font-size: 18px;
}

/* Destacar Top 3 */
.top-rank-1 { background: #fffdf5; }
.top-rank-1 .rank-badge-full { background: #fef08a; color: #854d0e; }
.top-rank-2 { background: #f8fafc; }
.top-rank-2 .rank-badge-full { background: #e2e8f0; color: #475569; }
.top-rank-3 { background: #fffaf5; }
.top-rank-3 .rank-badge-full { background: #ffedd5; color: #9a3412; }

@media (max-width: 600px) {
    .qmp-leaderboard-card { padding: 20px; }
    .leaderboard-avatar { width: 32px; height: 32px; }
    .leaderboard-score { font-size: 16px; }
}
/* Diseño de Opciones Premium */
.qmp-question-options {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Menos espacio entre opciones */
    margin-top: 0;
}

.qmp-option-item {
    display: block;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.qmp-option-item input {
    display: none; /* Escondemos el radio original */
}

.qmp-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px; /* Súper compacto */
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
}

.qmp-option:hover:not(.disabled) {
    border-color: #7c3aed;
    background: #f5f3ff;
    transform: translateY(-2px);
}

.option-letter {
    width: 32px;
    height: 32px;
    background: #f1f5f9; /* Círculo Gris */
    color: #64748b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.option-text {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

/* Estados de Feedback Inmediato */
.qmp-option.is-correct {
    background: #f0fdf4 !important; /* Fondo Verde Total */
    border-color: #22c55e !important;
}

.qmp-option.is-correct .option-letter {
    background: #22c55e !important;
    color: #ffffff !important;
}

.qmp-option.is-correct .option-text {
    color: #16a34a !important;
}

.qmp-option.is-wrong {
    background: #fef2f2 !important; /* Fondo Rojo Total */
    border-color: #ef4444 !important;
}

.qmp-option.is-wrong .option-letter {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.qmp-option.is-wrong .option-text {
    color: #b91c1c !important;
}

.qmp-option.disabled {
    cursor: not-allowed;
    opacity: 0.9;
}

/* Iconos de Feedback */
.qmp-option.is-correct::after {
    content: '✓';
    position: absolute;
    right: 20px;
    font-size: 20px;
    font-weight: 900;
    color: #22c55e;
}

.qmp-option.is-wrong::after {
    content: '✕';
    position: absolute;
    right: 20px;
    font-size: 20px;
    font-weight: 900;
    color: #ef4444;
}

/* --- NUEVOS ESTILOS RANKING UNIFICADO --- */
.qmp-ranking-unified {
    background: #fff;
    border-radius: 16px;
    padding: 40px 0 30px 0;
    box-shadow: 0 4px 25px rgba(0,0,0,0.05);
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.qmp-ranking-list {
    border-top: 1px solid #f1f5f9;
}

.qmp-ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 25px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.qmp-ranking-item:hover {
    background: #f8fafc;
}

.qmp-item-hidden {
    display: none !important;
}

.qmp-rank-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #475569;
    font-size: 15px;
    background: #fff;
    margin-right: 20px;
    flex-shrink: 0;
}

.qmp-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.qmp-user-name {
    font-weight: 800;
    color: #1e293b;
    font-size: 14px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.qmp-user-points {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 12px;
}

.qmp-user-points::after {
    content: "";
    display: block;
    width: 60px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 10px;
    position: relative;
    box-shadow: inset 20px 0 0 var(--qmp-primary); /* Color naranja del quiz */
}
