/* GERAL */
body { margin: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f2f2f2; color: #333; }
.previsao-container { max-width: 1200px; margin: auto; padding: 20px; }
.local-info h1 { margin: 0; font-size: 24px; color: #333; }
.local-info p { color: #666; margin-top: 5px; }

/* CONTROLES E FILTROS */
.controles-topo { margin-top: 15px; }
.btn-pdf { background: #ff6f00; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: bold; transition: 0.3s; }
.btn-pdf:hover { background: #e65100; }

.filtro-previsao { display: flex; gap: 10px; margin: 20px 0; overflow-x: auto; }
.filtro-previsao button { flex: 1; padding: 12px; border-radius: 12px; border: none; cursor: pointer; background: #e0e0e0; font-weight: 600; white-space: nowrap; transition: 0.3s; }
.filtro-previsao button.ativo { background: #2196f3; color: #fff; box-shadow: 0 4px 10px rgba(33, 150, 243, 0.3); }

/* CARD DO DIA */
.dia-card { background: #fff; border-radius: 16px; padding: 20px; margin-bottom: 25px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.05); padding: 0; overflow: hidden; transition: all 0.3s ease;}

.dia-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f0; }
.dia-header h3 { margin: 0; font-size: 18px; }
.dia-header strong { font-size: 18px; color: #444; }

/* RESUMO (GRID RESPONSIVO) */
.dia-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 20px; }
.dia-resumo div { background: #f8f9fa; border-radius: 10px; padding: 10px; text-align: center; font-size: 13px; color: #666; border: 1px solid #eee; }
.dia-resumo strong { display: block; font-size: 15px; color: #333; margin-top: 5px; }

/* ÁREA DO CONTEÚDO (GRÁFICO + INDICES) */
.dia-conteudo { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

/* CONTAINER DO GRÁFICO (IMPORTANTE PARA RESPONSIVIDADE) */
.grafico-box {
  position: relative;
  width: 100%;
  height: 250px;
  background: #fff;
}

/* =========================================
   CARD DE INSIGHTS (INFORMAÇÕES ALEATÓRIAS)
   ========================================= */
.insight-card {
    display: flex;
    align-items: center;
    padding: 15px 20px !important;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
}

.insight-content {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.insight-icon {
    font-size: 28px;
    min-width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa; 
    border-radius: 12px;
    border: 1px solid #eee;
}

.insight-text {
    flex: 1;
}

.insight-text h4 {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.insight-text strong {
    display: block;
    font-size: 22px;
    color: #333;
    margin-bottom: 2px;
}

.insight-text p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

@media (max-width: 600px) {
    .insight-content { gap: 12px; }
    .insight-icon { min-width: 55px; height: 55px; font-size: 24px; }
    .insight-text strong { font-size: 18px; }
}

.grafico-botoes { display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
.grafico-botoes button { flex: 1; border: 1px solid #ddd; border-radius: 8px; padding: 6px 12px; background: #fff; cursor: pointer; font-size: 12px; transition: 0.2s; min-width: 80px; }
.grafico-botoes button.ativo { background: #2196f3; color: white; border-color: #2196f3; }

/* INDICE LATERAL */
.indice-lateral { display: grid; grid-template-columns: 1fr; gap: 10px; }
.indice-item { background: #f5f5f5; border-radius: 10px; padding: 12px; text-align: center; font-size: 13px; }
.indice-item strong { display: block; font-size: 15px; margin-top: 4px; color: #333; }

/* MOBILE RESPONSIVO */
@media (max-width: 768px) {
  .dia-conteudo { grid-template-columns: 1fr; }
  .dia-header { flex-direction: column; align-items: flex-start; gap: 5px; }
  .indice-lateral { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .dia-resumo { grid-template-columns: repeat(2, 1fr); }
}

/* -- HEADER (Barra clicável) -- */
.dia-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    cursor: pointer;
    background: #fff;
    transition: background 0.2s;
}

.dia-header-row:hover {
    background: #f9f9f9;
}

.header-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    border-right: 1px solid #eee;
    padding-right: 15px;
    margin-right: 10px;
}
.header-date .date-num { font-size: 20px; font-weight: bold; color: #333; }
.header-date .date-week { font-size: 12px; text-transform: uppercase; color: #666; }

.header-icon { font-size: 28px; min-width: 40px; text-align: center; }

.header-temps {
    display: flex;
    gap: 10px;
    font-weight: bold;
    font-size: 16px;
    min-width: 80px;
}
.header-temps .temp-min { color: #1976d2; }
.header-temps .temp-max { color: #d32f2f; }

.header-rain {
    font-size: 14px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-desc {
    flex: 1;
    font-size: 14px;
    color: #666;
    margin-left: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-toggle { margin-left: 15px; }
.btn-toggle {
    background: #eee;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.dia-header-row:hover .btn-toggle { background: #ddd; }

/* -- CORPO EXPANSÍVEL -- */
.dia-body { padding: 0 20px 20px 20px; }
.dia-body.collapsed { display: none; }
.dia-body.expanded { display: block; animation: fadeIn 0.4s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .header-desc { display: none; }
    .dia-header-row { padding: 10px; }
    .header-rain { font-size: 12px; }
    .header-date { padding-right: 10px; margin-right: 5px; min-width: 40px;}
}

/* =========================================
   ESTILOS DE IMPRESSÃO (METEOGRAMA E CALENDÁRIO PDF)
   ========================================= */
#area-impressao { display: none; }

@media print {
    /* Configurações da Página A4 */
    @page { 
        margin: 1cm; 
        size: A4 portrait; 
    }

    /* Esconde elementos do site que não devem ser impressos */
    body * { visibility: hidden; height: 0; margin: 0; padding: 0; }
    
    /* Exibe apenas a área de impressão */
    #area-impressao, #area-impressao * { 
        visibility: visible; 
        height: auto; 
    }

    #area-impressao {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 19cm;
        background: white;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    .print-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 2.5px solid rgb(10, 63, 114);
        padding-bottom: 10px;
        margin-bottom: 15px;
    }

    .logo-box-print { width: 120px; text-align: center; }
    .logo-img-print { max-width: 100%; max-height: 70px; object-fit: contain; }

    .center-info { text-align: center; flex: 1; }
    .center-info h1 {
        font-size: 19px !important;
        color:  rgb(10, 63, 114) !important;
        text-transform: uppercase;
        margin: 0;
        letter-spacing: 1px;
    }

    .center-info p {
        font-size: 10px;
        margin: 2px 0;
        color: #333;
        font-weight: bold;
    }

    /* --- METEOGRAMA PRINT --- */
    .tabela-meteograma {
        width: 100%;
        border-collapse: collapse;
        font-size: 10.5px;
    }

    .tabela-meteograma th {
        background-color:  rgb(10, 63, 114) !important;
        color: white !important;
        border: 1px solid #000;
        padding: 8px 3px;
        text-transform: uppercase;
        -webkit-print-color-adjust: exact;
    }

    .tabela-meteograma td {
        border: 1px solid #999;
        padding: 6px 3px;
        text-align: center;
    }

    .tabela-meteograma tbody tr:nth-child(even) {
        background-color: #f2f2f2 !important;
        -webkit-print-color-adjust: exact;
    }

    .row-severo { background-color: #ffcdd2 !important; -webkit-print-color-adjust: exact; }
    .row-tempestade { background-color: #fff9c4 !important; -webkit-print-color-adjust: exact; }

    .alert-cell { font-weight: bold; text-align: left !important; padding-left: 8px !important; font-size: 9.5px; }

    .print-footer {
        margin-top: 20px;
        border-top: 1px solid #444;
        padding-top: 8px;
        font-size: 9px;
        text-align: center;
        color: #666;
        font-weight: bold;
        text-transform: uppercase;
    }

    /* --- ESTILOS DO CALENDÁRIO DE RISCO PARA IMPRESSÃO (NOVO VISUAL) --- */
    .tabela-calendario {
        width: 72%;
        border-collapse: collapse;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        table-layout: fixed;
    }

    .tabela-calendario th {
        border: 1px solid #d1d5db;
        padding: 10px 5px;
        text-align: center;
        background-color: #f3f4f6 !important;
        color: #374151 !important;
        font-size: 13px;
        text-transform: uppercase;
        font-weight: 700;
        letter-spacing: 0.5px;
        -webkit-print-color-adjust: exact;
    }

    .tabela-calendario td {
        border: 1px solid #e5e7eb;
        height: 85px;
        vertical-align: top;
        padding: 8px;
        position: relative;
    }

    .dia-num { 
        font-size: 18px; 
        color: #4b5563; 
        font-weight: bold;
        display: block;
    }

    .icones-risco {
        position: absolute;
        bottom: 5px;
        right: 5px;
        text-align: right;
        font-size: 11px;
        font-weight: bold;
        color: #1f2937;
        background: rgba(255, 255, 255, 0.5); /* Fundo translúcido para leitura fácil */
        padding: 3px 6px;
        border-radius: 4px;
        line-height: 1.4;
    }

    /* Cores de Condições do Calendário (Tons pastéis modernos) */
    .tabela-calendario td.vazio { background: #fff !important; border-color: #fff; }
    .tabela-calendario td.passado { background: #f9fafb !important; color: #9ca3af; -webkit-print-color-adjust: exact; } 
    .tabela-calendario td.bg-normal { background: #ffffff !important; -webkit-print-color-adjust: exact; } 
    .tabela-calendario td.bg-chuva { background: #bfdbfe !important; -webkit-print-color-adjust: exact; } 
    .tabela-calendario td.bg-calor { background: #ffedd5 !important; -webkit-print-color-adjust: exact; } 
    .tabela-calendario td.bg-frio { background: #cffafe !important; -webkit-print-color-adjust: exact; } 
    .tabela-calendario td.bg-vento { background: #e5e7eb !important; -webkit-print-color-adjust: exact; } 
    .tabela-calendario td.bg-seca { background: #fef08a !important; -webkit-print-color-adjust: exact; } 

    /* Legenda Lateral Modernizada */
    .legenda-calendario {
        width: 25%;
        border: 1px solid #e5e7eb;
        border-radius: 12px; /* Bordas arredondadas */
        padding: 20px;
        background: #ffffff !important;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05); /* Sombra suave */
        -webkit-print-color-adjust: exact;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    .legenda-calendario h3 {
        margin-top: 0;
        text-transform: uppercase;
        font-size: 15px;
        color: #2563eb; /* Azul elegante */
        border-bottom: 2px solid #bfdbfe;
        padding-bottom: 10px;
        margin-bottom: 15px;
        letter-spacing: 0.5px;
    }

    .legenda-calendario ul {
        list-style: none;
        padding: 0;
        margin: 0 0 15px 0;
    }

    .legenda-calendario li {
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        font-size: 13px;
        color: #4b5563;
        font-weight: 500;
    }

    .legenda-calendario .cor {
        width: 24px;
        height: 24px;
        border-radius: 6px; /* Quadrados da legenda mais arredondados */
        display: inline-block;
        margin-right: 12px;
        border: 1px solid rgba(0,0,0,0.1);
        -webkit-print-color-adjust: exact;
        flex-shrink: 0;
    }

    /* Cores da Legenda */
    .bg-chuva { background: #bfdbfe !important; }
    .bg-calor { background: #ffedd5 !important; }
    .bg-frio { background: #cffafe !important; }
    .bg-vento { background: #e5e7eb !important; }
    .bg-seca { background: #fef08a !important; }

    .icones-legenda {
        margin-top: 20px; 
        font-size: 11px; 
        color: #9ca3af;
        line-height: 1.5;
        border-top: 1px dashed #e5e7eb;
        padding-top: 15px;
    }
}


