/* Reset e configurações básicas */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh; 
    padding: 15px;
}

/* Container principal */
.container {
    max-width: 1400px; 
    margin: 0 auto; 
    background: white;
    border-radius: 15px; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Cabeçalho */
.header {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white; 
    padding: 25px; 
    text-align: center;
}

.header h1 { 
    font-size: 2.2em; 
    margin-bottom: 8px; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3); 
}

.header p { 
    font-size: 1.1em; 
    opacity: 0.9; 
}

/* Conteúdo */
.content { 
    padding: 25px; 
}

.day-section { 
    margin-bottom: 35px; 
}

.day-header {
    background: #f8f9fa; 
    padding: 20px; 
    border-radius: 10px;
    margin-bottom: 15px; 
    border-left: 5px solid #007bff;
}

.day-header h2 { 
    color: #333; 
    margin-bottom: 12px; 
    font-size: 1.6em; 
}

/* Estatísticas */
.statistics {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px; 
    margin-top: 12px;
}

.stat-item {
    background: white; 
    padding: 12px; 
    border-radius: 8px; 
    text-align: center;
    border: 2px solid; 
    transition: all 0.3s ease;
}

.stat-item.level-1 { border-color: #28a745; }
.stat-item.level-2 { border-color: #ffc107; }
.stat-item.level-3 { border-color: #fd7e14; }
.stat-item.level-4 { border-color: #dc3545; }
.stat-item.level-5 { border-color: #721c24; }

.stat-count { 
    font-size: 1.8em; 
    font-weight: bold; 
    margin-bottom: 4px; 
}

.stat-label { 
    font-size: 0.85em; 
    color: #666; 
}

/* Filtros de pesquisa */
.search-filters {
    background: white; 
    padding: 18px; 
    border-radius: 10px;
    margin-bottom: 18px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.filter-row {
    display: grid; 
    grid-template-columns: 2fr 1fr 1fr;
    gap: 12px; 
    margin-bottom: 12px;
}

.filter-row input, 
.filter-row select {
    padding: 8px 12px; 
    border: 1px solid #ddd;
    border-radius: 5px; 
    font-size: 0.95em;
}

.toggle-buttons { 
    display: flex; 
    gap: 8px; 
    flex-wrap: wrap; 
}

.toggle-btn {
    background: #007bff; 
    color: white; 
    border: none;
    padding: 8px 16px; 
    border-radius: 5px; 
    cursor: pointer;
    font-size: 0.9em; 
    transition: all 0.2s ease;
}

.toggle-btn:hover { 
    background: #0056b3; 
    transform: translateY(-1px); 
}

.toggle-btn.active { 
    background: #28a745; 
}

/* Grid de localidades */
.locations-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px; 
    margin-top: 15px;
}

/* Cards de localidades */
.location-card {
    background: #f8f9fa; 
    border-radius: 10px; 
    padding: 16px;
    border-left: 4px solid #ccc; 
    transition: all 0.2s ease;
    cursor: pointer; 
    position: relative; 
    overflow: hidden;
    min-height: 500px;
}

.location-card:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 6px 20px rgba(0,0,0,0.12); 
}

.location-card.level-1 { border-left-color: #28a745; }
.location-card.level-2 { border-left-color: #ffc107; }
.location-card.level-3 { border-left-color: #fd7e14; }
.location-card.level-4 { border-left-color: #dc3545; }
.location-card.level-5 { border-left-color: #721c24; }

.location-header {
    display: flex; 
    justify-content: space-between;
    align-items: flex-start; 
    margin-bottom: 12px;
}

.location-info h3 { 
    font-size: 1.15em; 
    color: #333; 
    margin-bottom: 4px; 
    font-weight: 600; 
}

.district-info { 
    color: #666; 
    font-size: 0.9em; 
    margin-bottom: 6px; 
}

.dico-code {
    font-family: 'Courier New', monospace; 
    background: #e9ecef;
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 0.8em; 
    color: #495057;
}

.risk-badge {
    padding: 6px 12px; 
    border-radius: 15px; 
    font-size: 0.8em;
    font-weight: bold; 
    display: flex; 
    align-items: center;
    gap: 4px; 
    white-space: nowrap;
}

/* CORREÇÃO PARA O BARÔMETRO */
.barometer-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.barometer-image {
    width: 100%;
    /* max-width: 200px; */
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.barometer-image:hover {
    transform: scale(1.02);
}

.barometer-fallback {
    width: 100%;
    max-width: 200px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    margin: 0 auto;
}

.barometer-fallback div {
    text-align: center;
    color: #6c757d;
    font-size: 1.2em;
}

.barometer-fallback small {
    font-size: 0.7em;
    color: #868e96;
    line-height: 1.2;
}

.coordinates {
    margin-top: 8px; 
    font-family: 'Courier New', monospace;
    background: #e3f2fd; 
    padding: 6px 8px; 
    border-radius: 4px;
    font-size: 0.75em; 
    color: #1565c0;
}

/* Legenda */
.legend {
    background: white; 
    border-radius: 10px; 
    padding: 15px;
    margin: 12px 0; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 5px solid #ffc107;
}

.legend h3 {
    color: #333; 
    margin-bottom: 12px; 
    font-size: 1.1em;
    text-align: center; 
    display: flex; 
    align-items: center;
    justify-content: center; 
    gap: 6px;
}

.legend-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.legend-table td {
    padding: 8px 4px;
    vertical-align: middle;
    font-size: 0.85em;
    border-bottom: 1px solid #f1f3f4;
}

.legend-table tr:last-child td {
    border-bottom: none;
}

.legend-icon { 
    width: 26px; 
    height: 26px; 
    margin-right: 8px;
    vertical-align: middle;
    display: inline-block;
}

.legend-icon.small {
    width: 20px;
    height: 20px;
    margin-right: 6px;
}

.legend-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px; 
    margin-bottom: 15px;
}

.legend-item {
    display: flex; 
    align-items: center; 
    padding: 10px;
    background: #f8f9fa; 
    border-radius: 6px; 
    gap: 10px;
}

.legend-status {
    display: flex; 
    align-items: center; 
    justify-content: center;
    gap: 12px; 
    margin-top: 12px; 
    padding: 12px;
    background: #f1f3f4; 
    border-radius: 8px;
}

.legend-status-item { 
    display: flex; 
    align-items: center; 
    gap: 4px; 
    font-weight: 500;
    font-size: 0.8em;
}

.status-proibido { color: #dc3545; }
.status-permitido { color: #28a745; }
.status-autorizacao { color: #ffc107; }

/* Rodapé */
.last-update {
    text-align: center; 
    color: #6c757d; 
    font-size: 0.85em;
    margin-top: 25px; 
    padding-top: 15px; 
    border-top: 1px solid #e9ecef;
}

/* Mensagens de erro */
.error {
    background: #f8d7da; 
    color: #721c24; 
    padding: 15px;
    border-radius: 8px; 
    margin: 15px 0; 
    border: 1px solid #f5c6cb;
    text-align: center;
}

/* Animações */
@keyframes alertPulse {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3); 
    }
    50% { 
        transform: scale(1.02); 
        box-shadow: 0 8px 16px rgba(220, 53, 69, 0.5); 
    }
}

/* Media queries para responsividade */
@media (max-width: 768px) {
    .header h1 { 
        font-size: 1.8em; 
    }
    
    .content { 
        padding: 15px; 
    }
    
    .locations-grid { 
        grid-template-columns: 1fr; 
    }
    
    .filter-row { 
        grid-template-columns: 1fr; 
    }
    
    .location-header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 8px; 
    }
    
    .toggle-buttons { 
        justify-content: center; 
    }
    
    .legend-grid { 
        grid-template-columns: 1fr; 
    }
    
    .legend-status { 
        flex-direction: column; 
        gap: 6px; 
    }
    
    .legend-table {
        font-size: 0.75em;
    }
    
    .legend h3 {
        font-size: 1em;
    }

    /* Barômetro em dispositivos móveis */
    .barometer-container {
        margin: 10px 0;
        padding: 8px;
    }
    
    .barometer-image {
        max-width: 160px;
    }
    
    .barometer-fallback {
        max-width: 160px;
        height: 80px;
    }
    
    .barometer-fallback div {
        font-size: 1em;
    }
}