/* src/features/legislativas/nacionales/ResultadosNacionalesCardsWidget.module.css */

/* --- SOLUCIÓN PARA FUENTES Y ESTILOS GLOBALES --- */
.cardsWidgetContainer,
.cardsWidgetContainer * {
    font-family: "Roboto", system-ui, sans-serif !important;
    box-sizing: border-box;
}

/* --- Contenedor Principal del Widget y Variables --- */
.cardsWidgetContainer {
    --card-border-color: #e0e0e0;
    --card-bg-color: #ffffff;
    --card-header-bg-color: #e6f1fd;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --primary-accent-color: #007bff;
    
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
}

.cardsWidgetContainer h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border-color);
}

/* --- Grilla de Tarjetas --- */
.cardsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

/* --- Tarjeta Individual --- */
.provinciaCard {
    background-color: var(--card-bg-color);
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Cabecera de la Tarjeta --- */
.cardHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-header-bg-color);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--card-border-color);
}

.headerInfo h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.headerInfo span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.headerMap {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f7fbff;
    padding: 0.25rem;
}

.mapSvgContainer, .mapPlaceholder {
    width: 100%;
    height: 100%;
    border-radius: 16px;
}

.mapSvgContainer svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mapPlaceholder.error {
    background-color: #f8d7da;
}

/* --- Cuerpo de la Tarjeta --- */
.cardBody {
    padding: 0.5rem 1rem;
}

.candidatoRow:last-child {
    border-bottom: none;
}

.candidatoRow {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
    border-left: 5px solid;
    border-radius: 12px;
    padding-left: 0.75rem;
}

.candidatoFotoWrapper {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    flex-shrink: 0;
    background-color: #e9ecef;
}

.candidatoFoto {
    width: 100%;
    height: 100%;
    border-radius: 12px;
}

.candidatoData {
    flex-grow: 1;
    min-width: 0;
    margin-right: 0.5rem;
}

.candidatoNombre {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: block;
    text-align: left;
}

.candidatoPartido {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.3rem;
    text-align: left;
}

.progressBarContainer {
    height: 16px;
    background-color: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progressBar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

.candidatoStats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    flex-shrink: 0;
    padding-left: 0.5rem;
}

.statsPercent {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.statsVotos {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.statsBancas {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--card-border-color);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    margin-left: 0.75rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-accent-color);
    min-width: 50px;
}

.statsBancas span {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: -4px;
}

/* --- Pie de la Tarjeta --- */
.cardFooter {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background-color: var(--card-header-bg-color);
    border-top: 1px solid var(--card-border-color);
    padding: 0.75rem 0;
    text-align: center;
}

.cardFooter div {
    border-right: 1px solid var(--card-border-color);
}

.cardFooter div:last-child {
    border-right: none;
}

.cardFooter span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cardFooter strong {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* --- Media Query para Móvil --- */
@media (max-width: 480px) {
    .cardsGrid {
        grid-template-columns: 1fr;
    }

    .cardHeader {
        padding: 0.5rem;
    }
    
    .headerInfo h3 {
        font-size: 1rem;
    }
}

.candidatoPartido.mainTitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: none;
    margin-bottom: 0.3rem;
}

/* --- ESTILOS PARA LA ESTRUCTURA MULTI-CATEGORÍA --- */
.categoriaBloque {
    width: 100%;
}

.categoriaBloque + .categoriaBloque {
    border-top: 1px dashed var(--card-border-color);
    margin-top: 1rem;
    padding-top: 1rem;
}

.categoriaTitulo {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 1rem 0;
}

.categoriaBloque .cardFooter {
    grid-template-columns: repeat(3, 1fr);
    background-color: transparent;
    border-top: 1px solid var(--card-border-color);
    padding: 0.75rem 0;
    margin-top: 0.75rem;
    text-align: center;
}

.categoriaBloque .cardFooter div {
    border-right: 1px solid var(--card-border-color);
}
.categoriaBloque .cardFooter div:last-child {
    border-right: none;
}