/* CSS Reset and Global Styles */
:root {
    /* ====== Palette Utama (Sawit) ====== */
    --primary: #2F7D3A;
    --primary-600: #256B2A;
    --accent: #A7D129;

    --bg: #F7FAF7;
    --surface: #FFFFFF;
    --border: #E5EEE7;

    --text-strong: #0F2D1E;
    --text: #344E41;
    --text-muted: #6B7D75;
    --text-inverse: #FFFFFF;

    /* Sidebar */
    --sidebar-bg: #113B2C;
    --sidebar-text: #CFE7D5;
    --sidebar-hover-bg: #184A37;
    --sidebar-active-bg: #DFF3E1;
    --sidebar-active-text: #0F5132;

    /* Lainnya */
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --focus-ring: 0 0 0 2px #2F7D3A;

    --sidebar-width-lg: 280px;
    --sidebar-width-sm: 90px;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.dashboard-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ================== SIDEBAR ================== */
.sidebar {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 2rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width-lg);
    flex-shrink: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    position: relative;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 3rem;
    min-width: 40px;
}

.sidebar .logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-inverse);
}

.sidebar .main-nav ul {
    list-style: none;
}

.sidebar .main-nav li a {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative;
}

.sidebar .main-nav li a:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--text-inverse);
}

.sidebar .main-nav li a.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left: 3px solid var(--primary);
}

/* Login/Logout btn di sidebar */
.login-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 1rem 1.5rem;
    margin-top: auto;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.login-btn:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--text-inverse);
}

.login-btn:hover svg path {
    fill: var(--text-inverse);
    stroke: var(--text-inverse);
    transition: stroke 0.2s ease;
}

/* ================== MAIN ================== */
.main-content {
    flex-grow: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
    width: calc(100% - var(--sidebar-width-lg));
    transition: width 0.3s ease;
    background: var(--bg);
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.menu-btn,
.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
}

/* ================== USER ================== */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text);
}

.user-profile .user-name {
    white-space: nowrap;
    color: var(--text-strong);
}

/* ================== GRID & CARD ================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.card {
    position: relative;
    background-color: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    color: var(--text);
}

.card .card-title {
    color: var(--text-strong);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card .card-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ================== UTILITIES ================== */
a {
    color: var(--primary);
}

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

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    border: 1px solid var(--primary);
    padding: 0.6rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-600);
    border-color: var(--primary-600);
}

.badge-success {
    background: #E9F6EC;
    color: #1B5E20;
    padding: .25rem .5rem;
    border-radius: .5rem;
}

.badge-warning {
    background: #FFF4E0;
    color: #7C4A03;
    padding: .25rem .5rem;
    border-radius: .5rem;
}

.badge-danger {
    background: #FDEBEC;
    color: #7A1217;
    padding: .25rem .5rem;
    border-radius: .5rem;
}

.predictive-analysis h3 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.predictive-analysis .chart-container {
    width: 100%;
}

.predictive-analysis img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.spraying-info h3 {
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.spraying-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.spraying-stats p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.spraying-stats p strong {
    display: block;
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 600;
}

.spraying-stats div:first-child {
    margin-bottom: 1rem;
}

@media (max-width: 1200px) {
    .sidebar {
        width: var(--sidebar-width-sm);
        padding: 2rem 1rem 1rem;
    }

    .sidebar.sidebar-open {
        width: var(--sidebar-width-lg);
    }

    .main-content {
        width: calc(100% - var(--sidebar-width-sm));
    }

    .logo {
        justify-content: center;
    }

    .logo-text,
    .nav-text,
    .login-text {
        display: none;
    }

    .sidebar .main-nav li a,
    .login-btn {
        justify-content: center;
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
        width: var(--sidebar-width-lg);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }

    .sidebar.sidebar-open .logo-text,
    .sidebar.sidebar-open .nav-text,
    .sidebar.sidebar-open .login-text {
        display: block;
    }

    .sidebar.sidebar-open .logo {
        justify-content: flex-start;
    }

    .sidebar.sidebar-open .main-nav li a,
    .sidebar.sidebar-open .login-btn {
        justify-content: flex-start;
        padding: 1rem 1.5rem;
    }

    .main-content {
        width: 100%;
        padding: 1.5rem;
    }

    .menu-btn,
    .sidebar-close-btn {
        display: block;
    }

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

    .main-header {
        flex-wrap: wrap;
    }

    .user-profile .user-name {
        display: none;
    }
}

/* login.css */

.login-popup {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    font-family: 'Poppins', sans-serif;
}

.login-content {
    background-color: #fff;
    padding: 40px;
    border-radius: 15px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    position: relative;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease-in-out;
}

/* Animation for the popup */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.close-login-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #aaa;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-login-btn:hover,
.close-login-btn:focus {
    color: #333;
    text-decoration: none;
}

.login-content .input-container {
    position: relative;
    margin-bottom: 20px;
}

.login-content .input-container i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

.login-content input[type="text"],
.login-content input[type="email"],
.login-content input[type="password"] {
    width: 100%;
    padding: 15px 20px 15px 50px;
    /* Padding for icon */
    border: 1px solid #ddd;
    border-radius: 30px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s;
}

.login-content input[type="text"]:focus,
.login-content input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
}

.login-submit-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 30px;
    background: var(--primary);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--primary-600);
}

.forgot-password {
    display: block;
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--primary);
    text-decoration: none;
}

.signup-link {
    margin-top: 25px;
    font-size: 0.9rem;
    color: #888;
}

.signup-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.login-content p {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 15px;
}

/* ADD THESE STYLES TO THE BOTTOM OF login.css */

.terms-agreement {
    margin-top: 20px;
    margin-bottom: 20px;
    font-size: 0.8rem;
    color: #555;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.terms-agreement input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.terms-agreement a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #aaa;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover,
.close-btn:focus {
    color: #333;
    text-decoration: none;
}

#terms-popup {
    z-index: 1002;
    /* Ensures it appears on top of the other pop-ups */
}

.terms-content {
    text-align: left;
}

.terms-content h2 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.terms-content p {
    line-height: 1.6;
    color: #555;
    font-size: 0.9rem;
}

/* === UPLOAD FILE === */

.upload-container {
    margin-top: 1.5rem;
    background-color: #ffffff;
}

.upload-form {
    margin-top: 0;
}

/* Properti penting untuk menata dan menengahkan konten */
.upload-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    background-color: #f9fafb;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.upload-area:hover,
.upload-area.drag-over {
    background-color: #eef2ff;
    border-color: #6b7280;
}

.upload-icon {
    font-size: 3rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.upload-area h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.upload-details {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
    margin-bottom: 1.5rem;
}

.browse-btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    border-radius: 6px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.browse-btn:hover {
    background-color: #f9fafb;
}

.file-name {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 500;
}

.upload-submit-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.1rem;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.upload-submit-btn:hover {
    opacity: 0.9;
}

/* Style untuk Custom Alert Pop-up */
.alert-popup {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 30, 30, 0.6);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.alert-content {
    background-color: white;
    border-radius: 16px;
    padding: 15px 25px;
    width: 90%;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease-in-out;
}

.alert-message {
    font-size: 1.25rem;
    font-weight: 500;
    color: #374151;
    line-height: 1.6;
    margin-bottom: 10px;
}

.alert-close-btn {
    background-color: #22c55e;
    color: white;
    border: none;
    padding: 8px 25px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.alert-close-btn:hover {
    background-color: #16a34a;
}

.preview-container {
    position: relative;
    margin-top: 12px;
    border: 1px dashed #999;
    border-radius: 8px;
    padding: 8px;
    background: #0b0b0b14;
}

.preview-img {
    max-width: 100%;
    max-height: 260px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.remove-file-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    border: none;
    border-radius: 999px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-weight: bold;
    background: #ffeded;
}

.remove-file-btn:hover {
    background: #ffd5d5;
}

.upload-hint {
    display: block;
    margin-top: 6px;
    opacity: .8;
}

.upload-area.drag-over {
    outline: 2px dashed #888;
    outline-offset: 6px;
}

.preview-step .preview-card {
    position: relative;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.close-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    background: #ffeded;
}

.close-preview:hover {
    background: #ffd5d5;
}

.preview-meta {
    margin: 8px 32px 12px 6px;
}

.preview-name {
    font-weight: 600;
}

.preview-size {
    opacity: .7;
    font-size: .9rem;
}

.preview-image-wrap {
    border: 1px dashed #cfcfcf;
    border-radius: 8px;
    padding: 8px;
    background: #fafafa;
}

.preview-img {
    max-width: 100%;
    max-height: 360px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.preview-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.secondary-btn {
    background: #f3f3f3;
    border: 1px solid #ddd;
    padding: 8px 12px;
    margin-top: 0.1rem;
    border-radius: 8px;
    cursor: pointer;
}

.secondary-btn:hover {
    background: #e9e9e9;
}

.upload-area.drag-over {
    outline: 2px dashed #888;
    outline-offset: 6px;
}

/* ====== Loading Overlay ====== */
.loading-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.loading-card {
    background: #fff;
    border-radius: 16px;
    padding: 22px 28px;
    width: min(92vw, 360px);
    text-align: center;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(0, 0, 0, 0.06);
    animation: fadeIn .18s ease-out;
}

.spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px auto;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.loading-message {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.loading-subtext {
    font-size: 0.85rem;
    color: #6b7280;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==== Results Card Reveal ==== */
.results-card {
    will-change: opacity, transform;
    transition: opacity 1.30s ease, transform 1.30s ease;
}

.results-card.is-hidden {
    opacity: 0;
    transform: translateX(-56px);
    /* start agak kiri */
    visibility: hidden;
    pointer-events: none;
}

.results-card.is-visible {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}

/* Tabs */
.results-card .tabs {
    display: flex;
    gap: .5rem;
    margin: .75rem 0 1rem;
    border-bottom: 1px solid var(--border-color, #eaeaea);
}

.results-card .tab-btn {
    border: 0;
    background: transparent;
    padding: .5rem .9rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary, #666);
    border-bottom: 2px solid transparent;
}

.results-card .tab-btn.active {
    color: var(--dark-green, #1E463A);
    border-bottom-color: var(--light-green, #D4EE7F);
}

.results-card .tab-panels .tab-panel {
    display: none;
    animation: fadeSlideRight .25s ease both;
}

.results-card .tab-panels .tab-panel.active {
    display: block;
}

/* animasi halus */
@keyframes fadeSlideRight {
    from {
        opacity: 0;
        transform: translateX(8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Tabel Koordinat Pohon --- */
.coords-table-wrap {
    margin-top: .75rem;
    border: 0px;
    overflow: hidden;
}

.coords-table-scroll {
    /* kira-kira 10 baris x 40px + header */
    max-height: 420px;
    overflow: auto;
}

.coords-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
}

.coords-table thead th {
    position: sticky;
    top: 0;
    background: var(--card-background, #fff);
    z-index: 1;
    border-bottom: 1px solid var(--border-color, #eaeaea);
    text-align: middle;
    padding: .6rem .75rem;
    font-weight: 700;
    color: var(--text-dark, #333);
}

.coords-table tbody td {
    padding: .55rem .35rem;
    border-bottom: 1px solid var(--border-color, #f1f1f1);
    white-space: nowrap;
    text-align: center;
}

.coords-table tbody tr:hover {
    background: #fafafa;
}

.badge-conf {
    display: inline-block;
    padding: .15rem .45rem;
    border-radius: .35rem;
    background: var(--light-green, #D4EE7F);
    color: #1a1a1a;
    font-weight: 600;
    font-size: .85rem;
}

/* --- INFO TAB TABLE STYLE --- */
#prediction-results-card .info-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

#prediction-results-card .info-table th,
#prediction-results-card .info-table td {
    padding: .6rem .8rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
    vertical-align: top;
}

/* Label (kiri) */
#prediction-results-card .info-table th {
    width: 50%;
    text-align: left;
    font-weight: 500;
    color: var(--muted, #6b7280);
}

/* Nilai (kanan) */
#prediction-results-card .info-table td {
    text-align: right;
    font-weight: 600;
    color: var(--text, #111827);
    word-break: break-word;
}

/* Baris penekanan (opsional) */
#prediction-results-card .info-table tr.emph td {
    font-weight: 800;
}

/* Responsif kecil: jadikan stacked */
@media (max-width: 520px) {

    #prediction-results-card .info-table th,
    #prediction-results-card .info-table td {
        display: block;
        text-align: left;
        padding: .45rem .5rem;
        border-bottom: none;
    }

    #prediction-results-card .info-table tr {
        border-bottom: 1px solid var(--border, #e5e7eb);
    }
}

/* ====== HISTORY PAGE STYLES (ringan) ====== */
.history-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.summary-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
}

.summary-title {
    font-size: 12px;
    color: #6b7280;
    margin: 0 0 6px;
}

.summary-value {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    margin: 12px 0;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

input[type="search"] {
    width: 100%;
    max-width: 220px;
    padding: .5rem .75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

button.btn {
    padding: .5rem .75rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
}

button.btn:hover {
    background: #f9fafb;
}

button.btn-danger {
    border-color: #fecaca;
    color: #b91c1c;
}

button.btn-danger:hover {
    background: #fef2f2;
}

.table-wrap {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

table.history {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table.history thead th {
    text-align: left;
    font-size: 12px;
    color: #6b7280;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
}

table.history tbody td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.item-title {
    font-weight: 600;
}

.item-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.badge {
    display: inline-block;
    padding: .15rem .45rem;
    font-size: 11px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    color: #374151;
}

.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 12px;
}

.pagination button {
    padding: .4rem .65rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
}

.pagination button[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

.page-info {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

@media (max-width:768px) {
    .history-summary {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .toolbar-right {
        width: 100%;
    }
}

/* grid dua kolom: kiri tabel, kanan panel hasil */
.history-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 16px;
    align-items: start
}

/* Jika result card hidden, jadikan grid 1 kolom penuh */
.history-grid:has(#prediction-results-card.is-hidden) {
    grid-template-columns: 1fr;
}

/* Fallback: kalau JS menambahkan .single pada history-grid */
.history-grid.single {
    grid-template-columns: 1fr !important;
}

@media (max-width: 1024px) {
    .history-grid {
        grid-template-columns: 1fr
    }
}

/* biar kartu hasil konsisten */
.results-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px
}

.results-card.is-hidden {
    display: none
}

.results-card.is-visible {
    display: block
}

.history tr.is-active {
    background: #f3f4f6;
}

.history tr:hover {
    cursor: pointer;
    background: #f3f4f69f;
}

.result-history #prediction-results-card #save-prediction-btn {
    display: none !important; 
}

.result-history .coords-table #th-mse,
.result-history .coords-table #td-mse{
    display: none !important;
}

/* ukuran container peta pada card dashboard */
#result-map {
    width: 100%;
    height: 420px;
    border-radius: 12px;
    overflow: hidden;
}

.map-legend {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: .9rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

/* kontrol legenda ala Leaflet */
.leaflet-control.map-legend-control {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: .9rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

.map-legend-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.capture-controls select:invalid {
    color: #9ca3af;
}

.upload-submit-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Mengatur layout flex untuk filter-group */
.map-filters .filter-group {
    flex: 1;
    /* Membuat setiap grup filter mengambil ruang yang sama */
    min-width: 180px;
    /* Lebar minimum sebelum pindah baris */
}

/* Memberi style pada label (seperti "Periode" / "Status Pohon") */
.map-filters .filter-group label {
    font-size: 0.8rem;
    display: block;
    margin-bottom: 2px;
    color: #757575;
    /* Warna abu-abu seperti di gambar */
}

/* Memberi style pada select box */
.map-filters .filter-group select {
    /* Menghapus style bawaan dan inline */
    border: none;
    border-radius: 0;
    background-color: transparent;
    padding: 0;
    /* Hapus padding lama */

    /* Style baru (hanya garis bawah) */
    border: 0.5px solid #ccccccb1;
    border-radius: 4px;
    /* Garis bawah abu-abu tipis */
    padding-bottom: 0.5rem;
    /* Memberi jarak di bawah teks */
    padding-top: 0.3rem;
    /* Memberi jarak di atas teks */

    /* Ukuran dan tampilan */
    width: 100%;
    /* Penuhi lebar container */
    font-size: 1rem;
    /* Ukuran font di dalam box */
    color: #333;
    /* Warna teks di dalam box */
}

.info-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    z-index: 10;
}

.info-btn:hover {
    color: #374151;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    box-sizing: border-box;
}

.modal-content {
    background: #ffffff;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 100%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: modal-fade-in 0.3s ease-out;
}

.modal-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-close-btn:hover {
    color: #1f2937;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #111827;
}

.modal-content p,
.modal-content ol,
.modal-content small {
    line-height: 1.6;
    color: #4b5563;
}

.modal-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal-content ol li {
    margin-bottom: 0.5rem;
}

.modal-content small {
    display: block;
    margin-top: 1.5rem;
    font-style: italic;
    color: #6b7280;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-results-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    z-index: 10;
}

.close-results-btn:hover {
    color: #333;
}

.confirm-popup {
    display: none;
    /* Sembunyi by default */
    position: fixed;
    z-index: 1001;
    /* Di atas loading, di bawah alert? Sesuaikan */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
}

.confirm-content {
    background-color: #ffffff;
    margin: auto;
    padding: 24px;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.confirm-content h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.25rem;
    color: #333;
}

.confirm-content p {
    margin-bottom: 16px;
    color: #555;
    line-height: 1.5;
}

.confirm-input-field {
    display: none;
    /* Sembunyi by default, tampil via JS */
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    /* Penting */
    font-size: 1rem;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Style tombol dari CSS Anda (btn, btn-danger) */
.confirm-actions .btn {
    /* Menggunakan style .btn Anda yang ada */
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
}

.confirm-actions .btn-secondary {
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    color: #555;
}

.confirm-actions .btn-secondary:hover {
    background-color: #e9e9e9;
}