.fires-page {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    padding: 40px 0;
}

@media (max-width: 768px) {
    .fires-page { padding: 10px 0 30px 0; }
}

.fires-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ════════════════════════════════════════════
   Header
   ════════════════════════════════════════════ */
.fires-header {
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 20px;
    padding: 30px 40px;
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.3);
}

@media (max-width: 768px) {
    .fires-header { padding: 20px; border-radius: 16px; margin: 0 10px 24px 10px; }
}

.fires-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .fires-title { font-size: 1.8rem; }
}

.fires-description {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.95);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

@media (max-width: 768px) { .fires-description { display: none; } }

/* ════════════════════════════════════════════
   Stat cards
   ════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 2px solid #e9ecef;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    color: #ef4444;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 600;
}

/* ════════════════════════════════════════════
   Mapa
   ════════════════════════════════════════════ */
.map-section {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
    .map-section { padding: 12px; border-radius: 16px; margin: 0 10px 24px 10px; }
}

.map-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 16px;
}

.map-wrapper {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border: 2px solid #e9ecef;
    background: #f0f0f0;
}

#fireMap {
    height: 650px;
    width: 100%;
}

@media (min-width: 1400px) { #fireMap { height: 750px; } }
@media (max-width: 768px)  { #fireMap { height: 480px; } }

.mapboxgl-ctrl-logo { display: none !important; }
.mapboxgl-ctrl-attrib { font-size: 9px !important; opacity: 0.5; }

/* ════════════════════════════════════════════
   Controles toggle de capas (estilo records)
   ════════════════════════════════════════════ */
.layer-controls {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 220px;
}

@media (max-width: 768px) {
    .layer-controls {
        top: 10px; left: 10px; right: auto; max-width: none;
        flex-direction: row; flex-wrap: wrap; padding: 8px; gap: 4px;
    }
}

.layer-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    user-select: none;
    flex: 1;
    min-width: 0;
}

.layer-toggle:hover { background: #f8fafc; border-color: #cbd5e1; }

.layer-toggle.active {
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.layer-toggle.active.drought    { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); }
.layer-toggle.active.perimeters { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
.layer-toggle.active.fires      { background: linear-gradient(135deg, #f97316 0%, #c2410c 100%); }

.layer-toggle .toggle-icon { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }
.layer-toggle .toggle-label {
    flex: 1; text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.layer-toggle .toggle-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 7px; border-radius: 10px;
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.layer-toggle.active .toggle-count {
    background: rgba(255, 255, 255, 0.25); color: white;
}

@media (max-width: 768px) {
    .layer-toggle { padding: 6px 8px; font-size: 0.75rem; }
    .layer-toggle .toggle-label { display: none; }
    .layer-toggle .toggle-icon { font-size: 1rem; }
}

/* ════════════════════════════════════════════
   Leyenda compacta esquina inferior derecha
   ════════════════════════════════════════════ */
.map-legend {
    position: absolute;
    bottom: 28px;
    right: 16px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    font-size: 0.8rem;
    max-width: 200px;
}

@media (max-width: 768px) {
    .map-legend { display: none; }
}

.legend-title {
    font-weight: 700; margin-bottom: 8px; color: #2c3e50; font-size: 0.85rem;
}

.legend-item {
    display: flex; align-items: center; margin-bottom: 5px;
    color: #475569;
}

.legend-color {
    width: 14px; height: 14px; border-radius: 50%;
    margin-right: 8px; flex-shrink: 0;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
}

.legend-section {
    margin-top: 10px; padding-top: 9px; border-top: 1px solid #e2e8f0;
}

.legend-color.square {
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

/* ════════════════════════════════════════════
   Popups Mapbox
   ════════════════════════════════════════════ */
.mapboxgl-popup-content {
    border-radius: 14px !important;
    padding: 0 !important;
    overflow: hidden;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18) !important;
    font-family: var(--font-body, system-ui, sans-serif);
    min-width: 220px;
}

.mapboxgl-popup-close-button {
    font-size: 1.4rem !important;
    padding: 4px 10px 6px !important;
    color: white !important;
    z-index: 2;
}

.cm-popup-head {
    padding: 10px 14px;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cm-popup-head.fire    { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
.cm-popup-head.drought { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); }

.cm-popup-body {
    padding: 12px 14px 14px;
}

.cm-popup-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.85rem;
    padding: 3px 0;
}
.cm-popup-row .k { color: #64748b; }
.cm-popup-row .v { color: #1e293b; font-weight: 600; text-align: right; }

.cm-popup-acres {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    color: #ef4444;
    text-align: center;
    margin: 6px 0 8px;
}

/* ════════════════════════════════════════════
   Tabla de definiciones de sequía
   ════════════════════════════════════════════ */
.drought-info {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
    .drought-info { padding: 16px; border-radius: 16px; margin: 0 10px 24px 10px; }
}

.drought-info h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 14px;
}

.drought-info p {
    color: #6c757d;
    line-height: 1.7;
    margin-bottom: 20px;
}

.drought-table-container {
    overflow-x: auto;
}

.drought-table { width: 100%; border-collapse: collapse; min-width: 480px; }

.drought-table th, .drought-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9rem;
}

.drought-table th {
    background: #f8f9fa;
    font-weight: 700;
    color: #2c3e50;
}

.drought-color-cell {
    display: inline-block;
    width: 28px; height: 18px;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.update-info {
    text-align: center;
    margin-top: 20px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    color: #64748b;
    font-size: 0.85rem;
}

.error-msg {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
