/* Cores dos gráficos: paleta categórica validada para daltonismo nos pares
   adjacentes (use na ordem) e cor de status crítico. Valores próprios por tema. */
:root {
    --viz-1: #2a78d6;
    --viz-2: #eb6834;
    --viz-3: #1baf7a;
    --viz-4: #eda100;
    --viz-5: #e87ba4;
    --viz-6: #008300;
    --viz-7: #6250d6;
    --viz-8: #e34948;
    --viz-others: #a6a49c;
    --status-critical: #d03b3b;

    --surface: #ffffff;
    --canvas: #f3f5f8;
}

:root[data-mantine-color-scheme="dark"] {
    --viz-1: #3987e5;
    --viz-2: #d95926;
    --viz-3: #199e70;
    --viz-4: #c98500;
    --viz-5: #d55181;
    --viz-6: #008300;
    --viz-7: #9085e9;
    --viz-8: #e66767;
    --viz-others: #6f7c8f;

    --surface: #253041;
    --canvas: #1c2533;
}

/*
 * Alturas de mapas e gráficos: acompanham a altura da janela (com mínimo e
 * máximo) para cada aba caber numa tela sem rolagem. Em telas largas os textos
 * quebram menos linhas e sobra mais altura para mapas e gráficos.
 */
:root {
    --water-map-height: clamp(280px, calc(100dvh - 450px), 700px);
    --water-variable-height: clamp(150px, calc(100dvh - 700px), 300px);
    --water-comparison-height: clamp(90px, calc((100dvh - 660px) / 2), 170px);
    --bio-map-height: clamp(260px, calc(100dvh - 500px), 640px);
    --dna-map-height: clamp(260px, calc(100dvh - 520px), 600px);
    --edna-chart-height: clamp(420px, calc(100dvh - 290px), 900px);
}

@media (min-width: 1600px) {
    :root {
        /* A coluna da direita da Água divide a altura entre o gráfico da variável
           e os dois de comparação, até o fim da tela */
        --water-variable-height: clamp(150px, calc((100dvh - 390px) * 0.42), 420px);
        --water-comparison-height: clamp(90px, calc((100dvh - 390px) * 0.29), 290px);
        --bio-map-height: clamp(260px, calc(100dvh - 447px), 700px);
        --dna-map-height: clamp(260px, calc(100dvh - 477px), 660px);
        --edna-chart-height: clamp(420px, calc(100dvh - 249px), 960px);
    }
}

html {
    background: var(--canvas);
}

.dashboard-main {
    background: var(--canvas);
}

.page-content {
    max-width: 2400px;
    margin-inline: auto;
}

/* Navegação lateral: só os ícones; ao passar o mouse, a faixa se expande
   sobre o conteúdo e mostra o nome das seções */
.section-link {
    border-radius: var(--mantine-radius-md);
}

@media (min-width: 48em) {
    .navbar {
        overflow: hidden;
        transition: width 200ms ease, box-shadow 200ms ease;
    }

    .navbar:hover {
        width: 240px;
        box-shadow: var(--mantine-shadow-lg);
    }

    .section-link {
        height: 48px;
        padding-inline: 10px;
    }

    .section-link .mantine-NavLink-body {
        opacity: 0;
        transition: opacity 150ms ease;
    }

    .navbar:hover .section-link .mantine-NavLink-body {
        opacity: 1;
    }
}

/* Botão de tema: mostra o ícone do tema atual */
[data-mantine-color-scheme="dark"] .color-scheme-toggle .icon-sun,
[data-mantine-color-scheme="light"] .color-scheme-toggle .icon-moon {
    display: none;
}

/* Mapas */
.map-container {
    position: relative;
    height: 460px;
}

@media (max-width: 48em) {
    .map-container {
        height: 340px;
    }
}

.map-caption:not(:empty) {
    position: absolute;
    top: 10px;
    left: 56px;
    right: 56px;
    z-index: 1000;
    width: fit-content;
    margin-inline: auto;
    padding: 4px 10px;
    border-radius: var(--mantine-radius-sm);
    background: var(--surface);
    box-shadow: var(--mantine-shadow-sm);
    font-size: var(--mantine-font-size-xs);
    pointer-events: none;
}

.raster-notice:not(:empty) {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
}

.map {
    width: 100%;
    height: 100%;
    z-index: 0;
}

.leaflet-interactive:focus {
    outline: none;
}

/* Botão de visão inicial (EasyButton) */
.easy-button-button {
    color: #333;
    cursor: pointer;
}

.easy-button-button .button-state {
    display: flex;
    align-items: center;
    justify-content: center;
}

.easy-button-button .icon {
    --icon-size: 16px;
}

.map-legend {
    position: absolute;
    left: 10px;
    bottom: 30px;
    z-index: 1000;
}

.map-notice:not(:empty) {
    position: absolute;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.edna-label {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0 4px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.edna-label::before {
    display: none;
}

/* Indicadores */
.indicator-block {
    background: var(--mantine-color-gray-0);
}

[data-mantine-color-scheme="dark"] .indicator-block {
    background: var(--mantine-color-dark-6);
}

.color-swatch {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.point-swatch {
    border-radius: 50%;
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.tabular-number,
.genetics-table td {
    font-variant-numeric: tabular-nums;
}

.genetics-table td:first-child {
    font-weight: 600;
}

/* Login */
.login {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 16px;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(42, 120, 214, 0.18), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(27, 175, 122, 0.14), transparent 60%),
        var(--canvas);
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-button {
    appearance: none;
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: var(--mantine-radius-md);
    font: inherit;
    font-size: var(--mantine-font-size-md);
    font-weight: 600;
    color: var(--mantine-color-white);
    background: var(--mantine-primary-color-filled);
    cursor: pointer;
    transition: background-color 150ms ease;
}

.login-button:hover {
    background: var(--mantine-primary-color-filled-hover);
}

.login-button:focus-visible {
    outline: 2px solid var(--mantine-primary-color-filled);
    outline-offset: 2px;
}
