/* ============================================
   VARIABLES COLORES
   ============================================ */
:root {
    /* Colores principales */
    --gp-blue: #0055A4;
    --gp-gold: #FFCC00;
    --gp-gold-dark: #D4A017;

    /* Colores neutros */
    --black: #1a1a1a;
    --white: #ffffff;
    --bg-gradient: linear-gradient(to bottom, #F5F5F5, #E8E8E8);
    --text-main: var(--black);
    --text-muted: #1a1a1a;
    --white: #FFFFFF;
    --border: #e0e0e0;
}

/* ============================================
   BASE & RESET
   ============================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   HEADER CON LOGO
   ============================================ */
.header-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 10px;
    background: var(--white);
    border-bottom: 3px solid var(--gp-gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.show-logo {
    max-height: 20vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ============================================
   TÍTULOS Y SUBTÍTULO
   ============================================ */
h1 {
    text-align: center;
    color: var(--gp-blue);
    margin: 20px 10px 10px;
    font-size: clamp(1.5em, 4vw, 2em);
    border-bottom: 2px solid var(--gp-gold);
    padding-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin: 0 10px 30px;
    font-size: clamp(0.9em, 2.5vw, 1.1em);
}

.title-line {
    display: block;
}

/* ============================================
   FILTROS
   ============================================ */
.filter-container {
    margin-bottom: 20px;
}

.custom-select {
    padding: 8px 12px;
    font-size: 1rem;
    border: 2px solid var(--gp-blue);
    border-radius: 8px;
    background-color: var(--white);
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: border-color 0.3s;
}

.custom-select:focus {
    border-color: var(--gp-gold);
}

.custom-select:hover {
    border-color: var(--gp-gold);
}

/* ============================================
   MAPA
   ============================================ */
#map {
    height: 50vh;
    min-height: 350px;
    width: calc(100% - 40px);
    max-width: 1400px;
    margin: 30px auto 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid var(--gp-blue);
}

/* ============================================
   PANEL DE TOTALES
   ============================================ */
.totals-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding: 20px;
    margin-bottom: 30px;
    background: var(--white);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--gp-blue);
}

.total-item {
    flex: 1 1 150px;
    text-align: center;
    padding: 15px;
    border-right: 1px solid var(--border);
}

.total-item:last-child {
    border-right: none;
}

.total-number {
    display: block;
    font-size: clamp(1.8em, 5vw, 2.5em);
    font-weight: bold;
    color: var(--gp-blue);
    line-height: 1.2;
}

.gold-text {
    color: var(--gp-gold) !important;
    text-shadow: 1px 1px 2px rgba(255, 204, 0, 0.3);
}

.total-label {
    font-size: 0.9em;
    color: var(--text-muted);
    display: block;
    margin-top: 5px;
}

/* ============================================
   LISTA DE GANADORES
   ============================================ */
.winners-section {
    padding: 0 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.winners-box {
    background: linear-gradient(135deg, #FFFBE5, var(--white));
    border: 2px solid var(--gp-gold);
}

.winners-intro {
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0;
}

.winners-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.winners-list li {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.year-badge {
    background: var(--gp-gold);
    color: var(--text-main);
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9em;
    min-width: 60px;
    text-align: center;
    border: 1px solid var(--gp-gold-dark);
}

.winner-name {
    font-weight: 600;
    color: var(--gp-blue);
}

.winner-location {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* ============================================
   CONTENEDOR DE ESTADÍSTICAS
   ============================================ */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 0 20px 30px;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
}

.stats-box {
    flex: 1 1 300px;
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 280px;
    border-left: 4px solid var(--gp-blue);
}

.stats-box h2 {
    margin-top: 0;
    color: var(--gp-blue);
    border-bottom: 2px solid var(--gp-gold);
    padding-bottom: 12px;
    font-size: clamp(1em, 3vw, 1.2em);
}

/* ============================================
   TABLAS
   ============================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: clamp(0.85em, 2vw, 1em);
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    background-color: var(--gp-blue);
    color: var(--white);
    font-weight: 600;
}

td:last-child {
    text-align: center;
}

.badge {
    background: var(--gp-gold);
    color: var(--text-main);
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: bold;
    display: inline-block;
    min-width: 32px;
    text-align: center;
    border: 1px solid var(--gp-gold-dark);
}

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
    text-align: center;
    padding: 20px;
    color: var(--white);
    font-size: 0.9em;
    background: var(--gp-blue);
    margin-top: auto;
    border-top: 4px solid var(--gp-gold);
}

.footer-text span {
    display: block;
}

/* ============================================
   LEYENDA EN EL MAPA
   ============================================ */
.legend-container {
    background: var(--white) !important;
    padding: 12px 15px !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
    font-family: Arial, sans-serif !important;
    font-size: 13px !important;
    color: var(--text-main) !important;
    border-left: 4px solid var(--gp-gold) !important;
    margin: 5px !important;
}

/* ============================================
   MEDIA QUERIES RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .show-logo {
        max-width: 60%;
    }

    #map {
        height: 45vh;
        min-height: 300px;
        width: calc(100% - 20px);
    }

    .stats-box {
        padding: 15px;
    }

    .total-item {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 15px 5px;
    }

    .show-logo {
        max-width: 75%;
    }

    h1 {
        margin: 15px 10px 10px;
        font-size: 1.4em;
    }

    .subtitle {
        margin: 0 10px 20px;
        font-size: 0.95em;
    }

    #map {
        height: 40vh;
        min-height: 250px;
        width: calc(100% - 20px);
    }

    .stats-box {
        padding: 15px;
    }

    .totals-panel {
        gap: 10px;
        padding: 15px;
    }

    .total-number {
        font-size: 1.5em;
    }

    th,
    td {
        padding: 10px 8px;
    }

    .badge {
        padding: 4px 10px;
        font-size: 0.9em;
    }

    .year-badge {
        min-width: 50px;
        font-size: 0.85em;
    }

    .winner-name {
        font-size: 0.95em;
    }

    .winner-location {
        font-size: 0.85em;
    }
}

/* ============================================
   MODO OSCURO MANUAL (data-theme)
   ============================================ */
[data-theme="dark"] {
    --black: #f0f0f0;
    --white: #16213e;
    --bg-gradient: linear-gradient(to bottom, #1a1a2e, #16213e);
    --text-main: #eee;
    --text-muted: #aaa;
    --border: #333;
    --card-bg: #16213e;
    --border-light: rgba(255, 255, 255, 0.1);
    --text-shadow: none;
}

[data-theme="dark"] .title {
    color: var(--gp-gold);
}

[data-theme="dark"] .subtitle,
.total-label {
    color: var(--black);
}

[data-theme="dark"] .header-container {
    background: var(--white);
    border-bottom-color: var(--gp-gold);
}

[data-theme="dark"] .stats-box {
    background: var(--white);
    border-left-color: var(--gp-blue);
}

[data-theme="dark"] .total-number,
.stats-box h2 {
    color: var(--gp-gold-dark);
}

[data-theme="dark"] .totals-panel {
    background: var(--white);
    border-top-color: var(--gp-blue);

}

[data-theme="dark"] .winners-box {
    background: linear-gradient(135deg, #1a1a1a, var(--white));
    border-color: var(--gp-gold);
}

[data-theme="dark"] .winner-name {
    color: var(--gp-gold);
}

[data-theme="dark"] .winner-location {
    color: var(--black);
}

[data-theme="dark"] .winners-list li {
    border-bottom-color: var(--border);
}

[data-theme="dark"] .year-badge {
    background: var(--gp-gold-dark);
    color: var(--black);
}

[data-theme="dark"] th {
    background-color: #004C99;
    border-bottom-color: var(--border);
    color: var(--gp-gold-dark);
}

[data-theme="dark"] .badge {
    color: var(--white);
}

[data-theme="dark"] .footer-text {
    color: var(--black);
}

#theme-toggle {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-light, #ccc);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: transform 0.2s ease;
}

#theme-toggle:hover {
    transform: scale(1.1);
}

[data-theme="dark"] #theme-toggle .icon-moon {
    display: none;
}

#theme-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] #theme-toggle .icon-sun {
    display: inline;
}

.theme-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 10px 0;
}