/*
 * Estilos compartidos del bloque "card de concurso del histórico".
 * Usados por templates/historico.html y templates/no_puzzle.html.
 *
 * Se extrajeron de templates/historico.html para reutilizar el mismo
 * componente visual en la web del jugador cuando no hay concurso activo.
 */

/* ── Card del concurso ── */
.concurso-card {
    background: #fcf4e3;
    border: 2px solid #d4b98a;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0px 4px 12px rgba(0,0,0,0.2);
}

.concurso-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.concurso-titulo {
    color: #704214;
    font-size: 1.5em;
    font-weight: bold;
    margin: 0;
}

.concurso-fecha {
    color: #6b5c4a;
    font-size: 0.95em;
}

.concurso-pregunta {
    background: #fffefa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f7c600;
    margin: 15px 0;
    font-size: 1.1em;
}

.concurso-imagenes {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.concurso-imagen-figura {
    margin: 0;
    text-align: center;
}

.concurso-imagen-caption {
    font-size: 0.85em;
    color: #6b5c4a;
    margin-bottom: 4px;
    font-weight: 600;
}

.concurso-imagen-thumb {
    max-width: 180px;
    max-height: 180px;
    border-radius: 8px;
    border: 2px solid #e0d4b8;
    cursor: zoom-in;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    background: #fff;
    object-fit: contain;
}

.concurso-imagen-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.concurso-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-item {
    background: #fffefa;
    border: 1px solid #d4b98a;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.stat-item-label {
    font-size: 0.85em;
    color: #6b5c4a;
    display: block;
    margin-bottom: 5px;
}

.stat-item-value {
    font-size: 1.3em;
    color: #704214;
    font-weight: bold;
}

/* ── Sección ganador ── */
.ganador-section {
    background: linear-gradient(135deg, #fffefa, #fcf4e3);
    border: 3px solid #f7c600;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.ganador-titulo {
    text-align: center;
    color: #704214;
    font-size: 1.3em;
    margin-bottom: 15px;
}

.ganador-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fdf4d0;
    border: 2px solid #f7c600;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.ganador-section-header:hover {
    background: #f9ecb3;
}

.ganador-section-chevron {
    font-size: 0.9em;
    color: #9e6d30;
    transition: transform 0.2s;
    transform: rotate(-90deg);
}

.ganador-section-header.is-open .ganador-section-chevron {
    transform: rotate(0deg);
}

.ganador-section-titulo {
    color: #704214;
    font-size: 1.2em;
    font-weight: bold;
}

.ganador-section-body {
    display: none;
    margin-top: 12px;
}

.ganador-section-header.is-open + .ganador-section-body {
    display: block;
}

.ganador-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ganador-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #f7c600;
    object-fit: cover;
}

.ganador-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f7c600, #e0b500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #3b2f2f;
    font-weight: bold;
    border: 3px solid #f7c600;
}

.ganador-datos {
    flex: 1;
}

.ganador-nombre {
    font-size: 1.5em;
    color: #704214;
    font-weight: bold;
    margin-bottom: 5px;
}

.ganador-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.ganador-stat {
    font-size: 0.95em;
    color: #6b5c4a;
}

/* ── Sección participantes ── */
.participantes-section {
    margin-top: 20px;
}

.participantes-titulo {
    color: #704214;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.participantes-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f3d8a7;
    border: 2px solid #d4b98a;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.participantes-header:hover {
    background: #efd098;
}

.participantes-chevron {
    font-size: 0.9em;
    color: #9e6d30;
    transition: transform 0.2s;
    transform: rotate(-90deg);
}

.participantes-header.is-open .participantes-chevron {
    transform: rotate(0deg);
}

.participantes-header-titulo {
    color: #704214;
    font-size: 1.1em;
    font-weight: bold;
}

.participantes-body {
    display: none;
    margin-top: 12px;
}

.participantes-header.is-open + .participantes-body {
    display: block;
}

.participantes-respuesta-cell {
    max-width: 260px;
    word-break: break-word;
    font-size: 0.9em;
    color: #3e2f1e;
}

.participantes-tabla {
    width: 100%;
    border-collapse: collapse;
    background: #fffefa;
    border-radius: 8px;
    overflow: hidden;
}

.participantes-tabla th {
    background: linear-gradient(135deg, #f7c600, #e0b500);
    color: #3b2f2f;
    padding: 12px;
    text-align: left;
    font-weight: bold;
}

.participantes-tabla td {
    padding: 10px 12px;
    border-bottom: 1px solid #e8dcc8;
}

.participantes-tabla tr:hover {
    background: #fef9e8;
}

.badge-elegible {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: #2e7d32;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    border: 1px solid #4caf50;
}

/* ── Etiquetas npub ── */
.npub-prefix {
    opacity: 0.45;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.npub-id {
    font-weight: 700;
    color: #704214;
    letter-spacing: 0.5px;
    font-family: 'Courier New', monospace;
}

.npub-rest {
    opacity: 0.55;
    font-weight: 400;
}

/* ── Estado vacío (mostrarConcursos sin datos) ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b5c4a;
}

.empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .concurso-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ganador-info {
        flex-direction: column;
        text-align: center;
    }

    .ganador-stats {
        justify-content: center;
    }

    .participantes-tabla {
        font-size: 0.9em;
    }
}
