
:root {
    --background: #08151d;
    --surface: #10232d;
    --surface-light: #19313c;
    --primary: #5ee5c1;
    --primary-dark: #167b69;
    --text: #f1f5f9;
    --muted: #a8bec9;
    --border: #29414b;
    --danger: #f87171;
    --success: #4ade80;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

[hidden] {
    display: none !important;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

/* HEADER */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    padding: 16px 5%;
    background: rgba(8, 21, 29, 0.95);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
}

.brand img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

nav {
    display: flex;
    gap: 30px;
}

nav a {
    color: var(--muted);
    font-size: 14px;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #eab308;
}

.server-status.online .status-dot {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.server-status.offline .status-dot {
    background: var(--danger);
}

/* CONTAINER */

.container {
    width: min(1200px, 90%);
    margin: auto;
}

/* HERO */

.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 50px;
    padding: 85px 0;
}

.eyebrow {
    color: var(--primary);
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
}

.hero h1 {
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.15;
    margin: 20px 0;
}

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

.hero p {
    color: var(--muted);
    margin-bottom: 30px;
    max-width: 500px;
}

.hero-video {
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 15px 50px #0005;
}

.hero-video video {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    display: block;
}

/* BOTÕES */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--primary);
    color: var(--background);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.button:hover:not(:disabled) {
    background: #8af3d6;
    transform: translateY(-2px);
}

.button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.button.secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

/* PAINEL */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 50px;
}

.section-heading {
    margin-bottom: 25px;
}

.section-heading h2 {
    font-size: 28px;
    margin: 5px 0;
}

.section-heading p,
.preview p {
    color: var(--muted);
    font-size: 14px;
}

/* UPLOAD */

.drop-zone {
    border: 2px dashed #397f78;
    background: rgba(94, 229, 193, 0.025);
    border-radius: 15px;
    padding: 45px 20px;
    text-align: center;
    transition: 0.2s;
}

.drop-zone.dragover {
    background: rgba(94, 229, 193, 0.12);
    border-color: var(--primary);
}

.upload-icon {
    color: var(--primary);
    font-size: 60px;
    line-height: 1;
    margin-bottom: 20px;
}

.drop-zone p {
    color: var(--muted);
    font-size: 13px;
    margin: 8px 0 20px;
}

.file-name {
    display: block;
    color: var(--primary);
    font-size: 13px;
    margin-top: 15px;
    overflow-wrap: anywhere;
}

/* PROGRESSO */

.progress-container {
    margin-top: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.progress-track {
    height: 8px;
    border-radius: 20px;
    background: var(--surface-light);
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.2s;
}

/* MENSAGENS */

.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message.success {
    background: #4ade8010;
    color: var(--success);
    border: 1px solid #4ade8050;
}

.message.error {
    background: #f8717110;
    color: var(--danger);
    border: 1px solid #f8717150;
}

/* RESULTADOS */

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 25px 0;
}

.stat-card {
    padding: 20px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.stat-card strong {
    display: block;
    color: var(--primary);
    font-size: 22px;
    margin-top: 8px;
    overflow-wrap: anywhere;
}

.extra-columns {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 20px;
    overflow-wrap: anywhere;
}

/* TABELA */

.preview h3 {
    margin-bottom: 5px;
}

.table-container {
    margin-top: 15px;
    overflow: auto;
    max-height: 450px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

th,
td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

th {
    position: sticky;
    top: 0;
    background: var(--surface-light);
    color: var(--primary);
}

tbody tr:hover {
    background: var(--surface-light);
}

.actions {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 25px;
}

.button.danger {
    color: var(--danger);
}

.field-grid,
.result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
}

.field-grid label,
.history-label,
#factorChoices label {
    display: grid;
    gap: 6px;
}

.panel select {
    width: 100%;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface-light);
    font: inherit;
}

.field-note {
    margin-top: 8px;
    color: var(--muted);
}

.panel details,
#factorChoices label {
    margin-top: 16px;
}

.panel summary {
    cursor: pointer;
}

.notice-list {
    margin-top: 16px;
    padding: 12px 12px 12px 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #facc77;
    overflow-wrap: anywhere;
}

.emission-chart {
    display: grid;
    gap: 8px;
    list-style: none;
    margin-top: 12px;
}

.emission-chart li {
    display: grid;
    grid-template-columns: minmax(50px, auto) minmax(25px, 1fr) minmax(80px, auto);
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.emission-chart meter {
    width: 100%;
    accent-color: var(--primary);
}

.emission-chart data {
    text-align: right;
    overflow-wrap: anywhere;
}

.inventory-steps,
.result-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.inventory-steps {
    list-style: none;
}

.inventory-steps li,
.result-tabs button {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface-light);
}

.inventory-steps li[aria-current],
.result-tabs button[aria-selected="true"] {
    border-color: var(--primary);
    color: var(--primary);
}

.inventory-steps small {
    color: var(--muted);
}

.result-tabs {
    margin-top: 16px;
}

.result-tabs button {
    cursor: pointer;
}

#speciationTables {
    margin-top: 24px;
}

#temporalTables,
#temporalCharts,
#spatialTables,
#spatialCharts {
    margin-top: 24px;
}

#spatialMap img, #spatialMap svg {
    display: block;
    width: 100%;
    max-height: 75vh;
    object-fit: contain;
    margin-top: 12px;
}

#spatialMap svg {
    background: #132337;
    touch-action: none;
    cursor: grab;
}

#spatialDialog {
    margin: auto;
    padding: 12px;
    max-width: min(96vw, 1100px);
    background: var(--surface);
}

#spatialDialog img {
    display: block;
    max-width: 100%;
    max-height: 83vh;
}

.spatial-checkbox {
    align-self: end;
}

.spatial-layers,
.spatial-ranking {
    margin: 12px 0;
    padding: 8px 16px;
}
.spatial-layers label {
    display: inline-block;
    margin: 4px 12px 4px 0;
}
.spatial-ranking {
    list-style: none;
}
.spatial-ranking button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
    margin: 4px 0;
    text-align: left;
}
.spatial-ranking meter {
    max-width: 30%;
}
#spatialMap:fullscreen {
    background: #132337;
    display: grid;
    place-items: center;
}
#spatialMap svg [role="button"] {
    cursor: pointer;
}
.spatial-legend-band {
    display: block;
    width: min(320px, 100%);
    height: 10px;
    border-radius: 4px;
}

#temporalPreview svg {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 12px;
}

@media print {
    body.temporal-print *:not(#temporalPreview):not(#temporalPreview *):not(:has(#temporalPreview)) {
        display: none !important;
    }

    body.temporal-print,
    body.temporal-print *:has(#temporalPreview) {
        background: white;
        border: 0;
        margin: 0;
        padding: 0;
        width: 100%;
    }

    body.temporal-print #temporalPreview {
        width: 100%;
        print-color-adjust: exact;
    }
}

@media (max-width: 850px) {
    .header nav {
        display: flex;
    }

    .header nav a:not([href="#calculationResults"]) {
        display: none;
    }
}

@media (max-width: 650px) {
    .field-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }
}

/* FOOTER */

footer {
    text-align: center;
    padding: 25px;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
}

/* RESPONSIVIDADE */

@media (max-width: 850px) {
    nav {
        display: none;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 45px 0;
    }

    .hero-content {
        text-align: center;
    }

    .hero p {
        margin-inline: auto;
    }

    .panel {
        padding: 20px;
    }
}

@media (max-width: 550px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .actions .button {
        width: 100%;
    }

    .section-heading h2 {
        font-size: 23px;
    }

    .drop-zone {
        padding: 30px 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        transition: none !important;
    }
}
/* ========================================
   VÍDEO ANIMADO DA NAVBAR
======================================== */

.brand-video {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    border: none;
}


/* ========================================
   VÍDEO PRINCIPAL DO PEGA
======================================== */

.hero-video {
    width: min(100%, 350px);
    max-width: 350px;
    aspect-ratio: 1 / 1;

    justify-self: center;

    background: transparent;
    border: none;
    border-radius: 35px;

    overflow: hidden;

    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.hero-video video {
    width: 100%;
    height: 100%;

    aspect-ratio: 1 / 1;
    object-fit: contain;

    border-radius: inherit;
    display: block;
}


/* RESPONSIVIDADE */

@media (max-width: 850px) {
    .hero-video {
        max-width: 300px;
    }
}

@media (max-width: 550px) {
    .hero-video {
        max-width: 260px;
    }
}

#figurePreview { margin: 1rem 0; }
#figureImage, #figureDialog img { display: block; width: 100%; height: auto; }
#figureDialog { max-width: min(95vw, 1200px); }
#figureCategory { margin-bottom: 1rem; }
.figure-selection-only .field-grid > label:not(:first-child),
.figure-selection-only details { display: none; }
#spatialMapStatus { min-height: 2.5em; }
