/*
 * Halaman Analisis
 * Navigasi: dasar, navbar, struktur halaman, formulir, pilihan model,
 * tombol, footer, validasi, hasil analisis, tabel, dan responsif.
 */

/* 01. Variabel dan gaya dasar */

:root {
    --green-dark: #0a2f20;
    --green: #1e7448;
    --green-pale: #eef8f1;
    --text: #17251d;
    --white: #ffffff;
    --cream: #f7f8f2;
    --line: #dbe5dd;
    --container: 1180px;
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    margin: 0;
    background: var(--cream);
    color: var(--text);
    font-family: "Inter", sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 999;
    padding: 9px 14px;
    border-radius: 8px;
    background: var(--white);
    color: var(--green-dark);
    font-weight: 700;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

/* 02. Navigasi utama */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.95);
}

.navbar-content {
    width: min(calc(100% - 40px), var(--container));
    min-height: 68px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    max-width: 430px;
    color: var(--green-dark);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.25;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    padding: 9px 14px;
    border-radius: 999px;
    color: #405248;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-links a:hover {
    background: var(--green-pale);
    color: var(--green);
}

.nav-links .nav-cta {
    margin-left: 5px;
    padding-inline: 18px;
    background: var(--green-dark);
    color: var(--white);
}

.nav-links .nav-cta:hover, .nav-links .nav-cta-active {
    background: var(--green);
    color: var(--white);
}

/* 03. Responsif navigasi */

@media (max-width: 700px) {
    .navbar-content {
        width: 100%;
        min-height: auto;
        padding: 10px 14px;
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .navbar .brand {
        max-width: none;
        font-size: 0.7rem;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
    }

}

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

}

/* 04. Struktur dan heading halaman */

:root {
    --muted: #617068;
    --danger: #a93434;
    --shadow: 0 18px 45px rgba(16, 60, 40, 0.1);
}

button, input, textarea {
    font: inherit;
}

.container {
    width: min(calc(100% - 40px), var(--container));
    margin: 0 auto;
    padding: 72px 0 30px;
}

.section {
    margin-bottom: 95px;
    scroll-margin-top: 90px;
}

.section-heading {
    margin-bottom: 32px;
    display: grid;
    grid-template-columns: 1fr 0.7fr;
    align-items: end;
    gap: 50px;
}

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--green);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.section-kicker::before {
    content: "";
    width: 24px;
    height: 2px;
    background: currentColor;
}

.section-title {
    margin: 9px 0 0;
    color: var(--green-dark);
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.section-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

/* 05. Pembungkus formulir dan petunjuk */

.analysis-container .ner-section {
    margin-bottom: 65px;
}

.ner-card {
    padding: 45px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.form-intro {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.form-intro h3 {
    margin: 0;
    color: var(--green-dark);
    font-size: 1rem;
}

.form-rules {
    margin: 24px 0;
    padding: 18px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    border: 1px solid #cfe4d6;
    border-radius: 14px;
    background: var(--green-pale);
}

.form-rules-mark {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--green-dark);
    color: #c8f2d5;
    font-weight: 800;
}

.form-rules h3 {
    margin: 0 0 7px;
    color: var(--green-dark);
    font-size: 0.84rem;
}

.form-rules ul {
    margin: 0;
    padding-left: 17px;
    color: var(--muted);
    font-size: 0.7rem;
}

/* 06. Kolom input */

.form-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 0.55fr;
    gap: 16px;
}

.field-group {
    min-width: 0;
}

.field-group label, .model-fieldset legend {
    color: #2b4034;
    font-size: 0.76rem;
    font-weight: 700;
}

.required-mark {
    color: var(--danger);
}

.label-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.label-row > span {
    color: #8a978f;
    font-size: 0.65rem;
}

input[type="text"], textarea {
    width: 100%;
    margin: 7px 0 16px;
    border: 1px solid #cedbd1;
    border-radius: 12px;
    outline: none;
    background: #fbfcfa;
    color: var(--text);
    font-size: 0.86rem;
}

input[type="text"] {
    min-height: 48px;
    padding: 0 14px;
}

textarea {
    min-height: 200px;
    padding: 14px;
    resize: vertical;
    line-height: 1.6;
}

input[type="text"]:focus, textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(30, 116, 72, 0.12);
}

.field-hint {
    display: block;
    margin: -9px 0 15px;
    color: #849087;
    font-size: 0.64rem;
}

/* 07. Pilihan model prediksi */

.model-fieldset {
    margin: 4px 0 22px;
    padding: 0;
    border: 0;
}

.model-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 13px;
}

.model-option {
    position: relative;
    padding: 16px;
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfcfa;
    cursor: pointer;
}

.model-option:has(input:checked) {
    border-color: var(--green);
    background: var(--green-pale);
}

.model-option input {
    position: absolute;
    opacity: 0;
}

.radio-indicator {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 2px solid #adc0b2;
    border-radius: 50%;
    background: var(--white);
}

.model-option input:checked + .radio-indicator {
    border: 5px solid var(--green);
}

.model-option-copy, .model-option-copy > span {
    display: block;
}

.model-option-top {
    display: flex !important;
    justify-content: space-between;
    gap: 10px;
}

.model-option-top strong {
    color: var(--green-dark);
    font-size: 0.84rem;
}

.model-option-top small {
    color: var(--green);
    font-size: 0.58rem;
    font-weight: 800;
}

.model-option-copy > span:last-child {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.72rem;
}

/* 08. Tombol kirim */

.button-submit {
    min-height: 50px;
    padding: 0 9px 0 19px;
    display: inline-flex;
    align-items: center;
    gap: 18px;
    border: 0;
    border-radius: 999px;
    background: var(--green-dark);
    color: var(--white);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
}

.button-arrow {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.13);
}

/* 09. Footer */

.footer {
    padding: 44px 20px;
    background: var(--green-dark);
    color: var(--white);
}

.footer-inner {
    width: min(100%, var(--container));
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    align-items: center;
    gap: 28px;
}

.footer-inner > div {
    display: flex;
    align-items: center;
    gap: 9px;
}

.footer p, .footer small {
    margin: 0;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.72rem;
}

/* 10. Responsif formulir dan footer */

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

    .form-grid .field-group:first-child {
        grid-column: 1 / -1;
    }

    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }

    .footer small {
        grid-column: 1 / -1;
    }

}

@media (max-width: 700px) {
    .section-heading, .model-options {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 520px) {
    .container {
        width: min(calc(100% - 28px), var(--container));
        padding-top: 52px;
    }

    .section {
        margin-bottom: 70px;
    }

    .ner-card {
        padding: 24px;
        border-radius: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .field-group:first-child {
        grid-column: auto;
    }

    .form-rules, .model-info {
        grid-template-columns: 1fr;
    }

    .button-submit {
        width: 100%;
        justify-content: space-between;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-inner > div {
        justify-content: center;
    }

    .footer small {
        grid-column: auto;
    }

}

/* 11. Kondisi validasi formulir */

.form-error-summary {
    margin-bottom: 22px;
    padding: 15px;
    border-left: 4px solid var(--danger);
    border-radius: 10px;
    background: #fff5f5;
    color: var(--danger);
}

.form-error-summary strong {
    font-size: 0.8rem;
}

.form-error-summary p {
    margin: 2px 0 0;
    font-size: 0.7rem;
}

.field-error {
    display: block;
    margin: -9px 0 15px;
    color: var(--danger);
    font-size: 0.64rem;
}

input[aria-invalid="true"], textarea[aria-invalid="true"] {
    border-color: #cc6c6c;
    background: #fffafa;
}

.field-has-error .field-hint {
    margin-bottom: 3px;
}

.field-has-error .field-error {
    margin-top: 0;
    font-weight: 700;
}

/* 12. Hasil analisis dan legenda entitas */

.model-info-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--green-dark);
    color: #c8f2d5;
    font-size: 0.65rem;
    font-weight: 800;
}

.result-section {
    margin-top: 50px;
    padding-top: 42px;
    border-top: 1px solid var(--line);
}

.result-heading {
    margin-bottom: 20px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.result-heading h2 {
    margin: 7px 0 0;
    color: var(--green-dark);
    font-size: 2rem;
}

.result-status, .model-badge, .entity-label {
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--green-pale);
    color: var(--green);
    font-size: 0.62rem;
    font-weight: 800;
}

.model-info {
    padding: 20px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    border: 1px solid #cfe4d6;
    border-radius: 14px;
    background: var(--green-pale);
}

.model-info p {
    margin: 4px 0 9px;
    color: var(--muted);
    font-size: 0.78rem;
}

.result-block {
    margin-top: 28px;
}

.result-block h3 {
    margin: 0 0 10px;
    color: var(--green-dark);
    font-size: 0.95rem;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.legend span, .output-box [class^="highlight-"] {
    padding: 4px 7px;
    border-radius: 6px;
    font-weight: 800;
}

.highlight-HERB {
    background: #c7ebd1;
    color: #14532d;
}

.highlight-BODY_PART {
    background: #d2e9f8;
    color: #194f70;
}

.highlight-DISEASE {
    background: #f8d6d6;
    color: #7c2525;
}

.highlight-COMPOUND {
    background: #fae9b7;
    color: #714f0a;
}

.highlight-EFFECT {
    background: #eadcf3;
    color: #623678;
}

.highlight-TREATMENT {
    background: #dfebbd;
    color: #496019;
}

.highlight-METHOD {
    background: #d5eef2;
    color: #245b65;
}

.highlight-POPULATION {
    background: #f8dfc2;
    color: #75461c;
}

.output-box {
    margin-top: 20px;
    padding: 24px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green);
    border-radius: 12px;
    background: #fbfcfa;
    color: #35463c;
    font-size: 0.88rem;
    line-height: 1.9;
}

/* 13. Tabel hasil */

.table-scroll {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
}

table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
}

th, td {
    padding: 12px 14px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 0.74rem;
}

th {
    background: var(--green-pale);
    color: var(--green-dark);
}

td {
    color: #4d5e54;
}

th:last-child, td:last-child {
    border-right: 0;
}

tr:last-child th, tr:last-child td {
    border-bottom: 0;
}

.journal-table th {
    width: 30%;
}

.empty-value {
    color: #87938b;
    font-style: italic;
}

/* 14. Responsif hasil analisis */

@media (max-width: 520px) {
    .result-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .model-info {
        grid-template-columns: 1fr;
    }

}
