:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --accent: #f43f5e;
    --accent-green: #10b981;
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-main: #0f172a;
    --text-muted: #64748b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    justify-content: flex-start;
    flex-direction: column;
    padding: 2rem;
    gap: 2.5rem; /* Space between the two dashboards */
    overflow-x: hidden; /* Evita rolagem fantasma na pagina */
}

/* Container padrão para os blocos */
.dashboard-container {
    width: 98%;
    max-width: 1600px;
    margin: 0 auto 2.5rem auto; /* Centraliza horizontalmente e adiciona espaço (gap) em baixo */
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px -10px rgba(14, 165, 233, 0.15), 
                0 10px 20px -5px rgba(14, 165, 233, 0.1);
    transition: all 0.3s ease;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

h1 span {
    color: var(--primary);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 400;
}

.logo-apac {
    max-width: 100%;
    height: auto;
    max-height: 70px;
}

.tendencia-title span {
    color: var(--primary);
}

.tendencia-subtitle {
    font-size: 16px;
    color: #444;
    margin: 10px 0 10px 5px;
    font-weight: 600;
}

/* TENDENCIA STYLES */
.linha-verde {
    width: 100%;
    height: 6px;
    background-color: #2E7D32;
    margin: 20px 0;
    border-radius: 2px;
}

.main-table-site {
    width: 100%;
    min-width: 700px; /* Garante que a tabela gere um scroll lateral em invés de espremer o texto */
    border-collapse: collapse;
    table-layout: fixed;
    background-color: #fff;
}

.main-table-site th {
    border: 1px solid #e0e0e0;
    padding: 12px;
    background: #f8f9fa;
    color: #333;
    font-size: 15px;
    font-weight: 700;
}

.main-table-site td {
    border: 1px solid #e0e0e0;
    padding: 0 !important;
    height: 45px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.region-name-site {
    text-align: center !important;
    font-weight: 800 !important;
    background: #f8f9fa;
    width: 250px;
    padding: 10px !important;
    color: #333;
}

.tendencia-wrapper {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    align-items: flex-start;
}

.bloco-tabela-obs {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    display: block; /* Usar block evita o 'stretching' forçado por conteúdos grandes (tabelas) em layouts flex. */
}

.tabela-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-radius: 8px 8px 0 0;
}

.observacoes-site {
    padding: 15px;
    font-size: 13px;
    background: #fff;
    border-top: 2px solid #ddd;
    text-align: center;
    border-radius: 0 0 8px 8px;
    width: 100%;
}

.legenda-header {
    display: flex;
    justify-content: flex-start;
    font-weight: bold;
    margin-bottom: 15px;
    color: #0b193d;
    font-size: 14px;
    border-bottom: 2px solid #0ea5e9; /* Linha azul clara/secundária */
    padding-bottom: 8px;
}

.legenda-header span:first-child {
    width: 170px;
    text-align: center;
}

.legenda-header span:last-child {
    width: 120px;
    margin-left: 15px;
    text-align: center;
    white-space: nowrap;
}

.coluna-legenda {
    width: 350px;
    flex-shrink: 0;
}

.leg-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.leg-box-site {
    width: 170px;
    height: 32px;
    line-height: 30px;
    text-align: center;
    border-radius: 50px;
    font-weight: bold;
    font-size: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    color: #000;
    background-image: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0.05) 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08); /* Sombra parecida com a maré */
}

.leg-valor {
    font-weight: 800;
    color: #333;
    font-size: 14px;
    margin-left: 15px; 
    width: 120px;      
    text-align: center;  
}

/* MARE STYLES */
.legenda-mare {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.leg-mare-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 14px;
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid rgba(226, 232, 240, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.controles-tide {
    display: flex;
    justify-content: center;
    width: 100%;
}

.btn-toggle-labels {
    background: #fff;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 10px 24px;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-toggle-labels:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(14, 165, 233, 0.2);
}

.btn-toggle-labels.active {
    background: #0369a1; /* Um azul mais escuro para indicar ativo */
    border-color: #0369a1;
    color: #fff;
}

.btn-toggle-labels:active {
    transform: scale(0.98);
}

.cor-curva {
    width: 20px;
    height: 6px;
    background: var(--primary);
    border-radius: 4px;
    display: inline-block;
}

.cor-preamar {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
}

.cor-baixamar {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-green);
    display: inline-block;
}
.chart-wrapper {
    width: 100%;
    overflow-x: auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.chart-scroll-area {
    position: relative;
    height: 650px;
    width: 100%;
    min-width: 800px;
}

.status-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    transition: opacity 0.3s;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary);
    animation: pulse 1.5s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.status-text {
    font-size: 0.95rem;
    color: var(--primary-dark);
    font-weight: 600;
}

.status-error .status-text { color: var(--accent); }
.status-error .status-dot { 
    background-color: var(--accent); 
    animation: none; 
}

/* BOTOES DE ACAO */
.botoes-acao-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    width: 98%;
    max-width: 1600px;
    margin: 0 auto 3rem auto;
    flex-wrap: wrap;
}

.btn-acao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    border-radius: 50px;
    box-shadow: 0 10px 20px -5px rgba(14, 165, 233, 0.4);
    transition: all 0.3s ease;
    text-align: center;
    border: 2px solid transparent;
}

.btn-acao:hover {
    background: #fff;
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -5px rgba(14, 165, 233, 0.3);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(1.2); }
}

@media (max-width: 1024px) {
    .tendencia-wrapper {
        flex-direction: column;
    }
    .coluna-legenda {
        width: 100%;
    }
}

@media (max-width: 768px) {
    body { padding: 0.5rem; }
    .dashboard-container { padding: 1.2rem; width: 100%; border-radius: 12px; }
    h1 { font-size: 1.6rem; }
    .tendencia-title { font-size: 1.4rem; }
    .tendencia-subtitle { font-size: 13px; text-align: center; margin: 10px 0; }
    .chart-wrapper { padding: 0.5rem; }
    .chart-scroll-area { 
        height: 350px; 
        min-width: 1200px; 
    }
    .region-name-site { width: 110px; font-size: 11px; padding: 5px !important; }
    .coluna-legenda { width: 100%; padding-left: 0; }
    .main-table-site th, .main-table-site td { font-size: 11px; padding: 6px; }
    .leg-item { flex-direction: row; justify-content: space-between; align-items: center; margin-bottom: 12px; }
    .leg-box-site { width: 60%; margin-bottom: 0; }
    .leg-valor { width: 35%; text-align: center; margin-left: 0; font-size: 13px; }
    .legenda-header { justify-content: space-between; align-items: center; gap: 0; }
    .legenda-header span:first-child { width: 60%; text-align: center; }
    .legenda-header span:last-child { width: 35%; margin-left: 0; text-align: center; white-space: nowrap; }
    
    .botoes-acao-container {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        padding: 0 1rem;
    }
    .btn-acao {
        width: 100%;
        padding: 1.2rem;
        font-size: 1.1rem;
    }
}
