/* ===== RESET & VARIABLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --container-bg: white;
    --text-primary: #263238;
    --text-secondary: #666;
    --panel-bg: #f8f9fa;
    --border-color: #c8e6c9;
    --success: #2e7d32;
    --success-light: #e8f5e9;
    --success-dark: #1b5e20;
    --info: #0288d1;
    --warning: #ff6f00;
    --danger: #c62828;
    --purple: #7b1fa2;
    --shadow: 0 20px 60px rgba(0,0,0,0.3);
    --card-bg: white;
    --grid-color: #e0e0e0;
    --footer-bg: #263238;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: background 0.3s;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    animation: slideDown 0.5s ease;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 25px;
    padding: 25px;
}

/* ===== PANEL KIRI ===== */
.panel-left {
    background: var(--panel-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: background 0.3s;
}

.panel-left h2 {
    color: var(--success);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--success);
}

.info-box {
    background: var(--success-light);
    border-left: 5px solid var(--success);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    transition: background 0.3s;
}

.info-box p {
    margin: 5px 0;
    color: var(--success-dark);
}

/* ===== INPUT CONTROLS ===== */
.input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.input-field {
    flex: 1;
    min-width: 120px;
}

.input-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--success);
}

.input-field input, .input-field select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border 0.3s, background 0.3s;
}

.input-field input:focus {
    border-color: var(--success);
    outline: none;
}

/* ===== TOMBOL ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255,255,255,0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn:active::after {
    animation: ripple 0.3s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(40, 40);
        opacity: 0;
    }
}

.btn-primary {
    background: var(--success);
    color: white;
}

.btn-primary:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46,125,50,0.3);
}

.btn-secondary {
    background: var(--info);
    color: white;
}

.btn-secondary:hover {
    background: #01579b;
}

.btn-success {
    background: var(--purple);
    color: white;
}

.btn-success:hover {
    background: #4a0072;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #b26500;
}

.button-group {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* ===== TITIK INPUT ===== */
.titik-container {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    transition: background 0.3s;
}

.titik-row {
    display: grid;
    grid-template-columns: 30px 1fr 1fr 20px;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    padding: 5px;
    background: var(--success-light);
    border-radius: 5px;
    transition: background 0.3s;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.titik-row span {
    font-weight: 600;
    color: var(--success-dark);
}

.titik-row input {
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text-primary);
}

.remove-btn {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.remove-btn:hover {
    background: #8e0000;
}

/* ===== PRESET ===== */
.preset-section {
    margin-top: 20px;
}

.preset-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--success);
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-btn {
    padding: 8px 12px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    color: var(--text-primary);
}

.preset-btn:hover {
    background: var(--success);
    color: white;
    border-color: var(--success);
    transform: scale(1.05);
}
.preset-btn.active {
    background: var(--success);
    color: white;
    border-color: var(--success);
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(46,125,50,0.3);
}
/* ===== FITUR LANJUTAN ===== */
.advanced-features {
    margin-top: 30px;
    padding: 20px;
    background: #f3e5f5;
    border-radius: 10px;
    transition: background 0.3s;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.feature-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s, background 0.3s;
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.feature-item label {
    display: block;
    font-weight: 600;
    color: var(--purple);
    margin-bottom: 8px;
}

.tooltip {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.info-interpolasi {
    margin-top: 15px;
    font-size: 12px;
    background: var(--purple);
    color: white;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
}

/* ===== PANEL KANAN ===== */
.panel-right {
    background: var(--container-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.panel-right h2 {
    color: var(--success);
    margin-bottom: 20px;
}

.canvas-container {
    background: var(--panel-bg);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
}

#lahanCanvas {
    max-width: 100%;
    height: auto;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background: var(--card-bg);
    transition: all 0.3s;
    cursor: grab;
}

#lahanCanvas:active {
    cursor: grabbing;
}

/* ===== CANVAS CONTROLS ===== */
.canvas-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 5px;
    z-index: 10;
}

.canvas-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--success);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    opacity: 0.8;
}

.canvas-btn:hover {
    background: var(--success-dark);
    transform: scale(1.1);
    opacity: 1;
}

/* ===== TABEL HASIL ===== */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    background: var(--success);
    color: white;
    padding: 12px;
}

td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-primary);
}

tr:nth-child(even) {
    background: var(--panel-bg);
}

.metode-polygon td:first-child {
    font-weight: bold;
}

.metode-polygon td {
    background: var(--success-light);
}

/* ===== KESIMPULAN ===== */
.kesimpulan {
    background: var(--success-light);
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    border-left: 5px solid var(--success);
    position: relative;
}

.kesimpulan h3 {
    color: var(--success-dark);
    margin-bottom: 10px;
}

.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    font-weight: bold;
}

/* ===== INFO METODE ===== */
.info-metode {
    margin-top: 20px;
    font-size: 12px;
    background: var(--success-light);
    padding: 10px;
    border-radius: 5px;
    color: var(--text-primary);
}

.info-metode ul {
    margin-left: 20px;
    margin-top: 5px;
}

/* ===== INTEGRAL SECTION ===== */
.integral-section {
    margin: 0 25px 25px 25px;
    background: var(--panel-bg);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.integral-header {
    background: var(--success);
    color: white;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.integral-header h3 {
    margin: 0;
    font-size: 16px;
}

.toggle-icon {
    font-size: 14px;
    transition: transform 0.3s;
}

.integral-content {
    padding: 20px;
    transition: max-height 0.3s;
}

.integral-content.collapsed {
    display: none;
}

.real-world-box {
    background: #fff3e0;
    border-left: 5px solid #ff6f00;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.real-world-box h4 {
    color: #b26500;
    margin-bottom: 10px;
}

.integral-explanation {
    background: var(--success-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.formula-box {
    background: var(--card-bg);
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin-bottom: 15px;
}

.formula-box p {
    margin: 5px 0;
}

.formula-box .small {
    font-size: 12px;
    color: var(--text-secondary);
}

.method-explanation {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.method-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.method-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.partisi-visualization {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
}

.partisi-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.partisi-controls input[type="range"] {
    flex: 1;
}

.btn-small {
    padding: 5px 10px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-small:hover {
    background: var(--success-dark);
}

.partisi-canvas-container {
    text-align: center;
    margin: 15px 0;
}

#partisiCanvas {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: white;
}

.caption {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.integral-role {
    background: #e1f5fe;
    padding: 12px;
    border-radius: 5px;
    margin-top: 15px;
}

.integral-role ul {
    margin-left: 20px;
    margin-top: 5px;
}

.integral-role li {
    font-size: 13px;
    margin: 3px 0;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--footer-bg);
    color: white;
    padding: 30px;
    text-align: center;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.footer-card {
    background: #37474f;
    padding: 15px;
    border-radius: 8px;
    transition: transform 0.3s;
}

.footer-card:hover {
    transform: translateY(-5px);
}

.footer-card h4 {
    color: #4caf50;
    margin-bottom: 10px;
}

.footer-card p {
    font-size: 13px;
    opacity: 0.9;
}

.badge {
    display: inline-block;
    background: #4caf50;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    margin-top: 8px;
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    box-sizing: border-box;
    max-width: 90vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
}

/* ===== ANIMATIONS ===== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .button-group {
        flex-direction: column;
    }
    .header h1 {
        font-size: 1.8em;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .btn, .preset-buttons, .advanced-features, .footer {
        display: none;
    }
    .container {
        box-shadow: none;
    }
}

/* ===== POPUP PANDUAN ===== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background: white;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.popup-overlay.show .popup-content {
    transform: translateY(0);
}

.popup-header {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.popup-close:hover {
    background: rgba(255,255,255,0.2);
}

.popup-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

/* ===== TOMBOL BANTUAN ===== */
.bantuan-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    font-size: 30px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    transition: all 0.3s;
    animation: pulse 2s infinite;
}

.bantuan-btn:hover {
    transform: scale(1.1);
    background: var(--success-dark);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(46, 125, 50, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0);
    }
}

/* ===== ROLLDOWN ANIMASI ===== */
.roll-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}

.roll-content.open {
    max-height: 2000px;
    transition: max-height 0.8s ease-in;
}

.roll-header {
    cursor: pointer;
    padding: 15px;
    background: var(--success-light);
    border-radius: 8px;
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--success-dark);
    transition: background 0.3s;
}

.roll-header:hover {
    background: #c8e6c9;
}

.roll-icon {
    transition: transform 0.3s;
}

.roll-icon.open {
    transform: rotate(90deg);
}

/* ===== TAB PERHITUNGAN ===== */
.perhitungan-tab {
    margin-top: 20px;
    background: var(--panel-bg);
    border-radius: 8px;
    overflow: hidden;
}

.perhitungan-header {
    background: var(--success);
    color: white;
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.perhitungan-body {
    padding: 20px;
    background: white;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.perhitungan-step {
    border-left: 3px solid var(--success);
    padding-left: 15px;
    margin: 10px 0;
    color: #333;
}

.perhitungan-step .formula {
    background: #f5f5f5;
    padding: 5px 10px;
    border-radius: 4px;
    margin: 5px 0;
    font-family: monospace;
}

.perhitungan-step .hasil {
    color: var(--success-dark);
    font-weight: bold;
}
/* ANIMASI HALUS UNTUK INTEGRAL CONTENT */
.integral-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
    background: var(--panel-bg);
}

.integral-content.show {
    max-height: 2000px;
    transition: max-height 0.6s ease-in;
}

/* Style untuk konten di dalam integral-content */
.integral-content .real-world-box,
.integral-content .integral-explanation,
.integral-content .partisi-visualization {
    margin: 20px;
}

.integral-content .real-world-box:first-child {
    margin-top: 20px;
}

.integral-content .partisi-visualization:last-child {
    margin-bottom: 20px;
}

/* ANIMASI HALUS UNTUK INTEGRAL CONTENT */
.integral-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
    background: var(--panel-bg);
    padding: 0 !important;  /* Hilangkan padding saat collapsed */
    margin: 0 !important;   /* Hilangkan margin saat collapsed */
}

.integral-content.show {
    max-height: 2000px;
    transition: max-height 0.6s ease-in;
    padding: 20px !important;  /* Padding hanya muncul saat terbuka */
}

/* Hilangkan margin pada child elements saat collapsed */
.integral-content .real-world-box,
.integral-content .integral-explanation,
.integral-content .partisi-visualization {
    margin: 20px;
}

/* Pastikan saat collapsed, margin child juga hilang */
.integral-content.collapsed .real-world-box,
.integral-content.collapsed .integral-explanation,
.integral-content.collapsed .partisi-visualization {
    margin: 0;
    padding: 0;
    display: none;
}

/* Atau jika menggunakan class 'show' (bukan collapsed) */
.integral-content:not(.show) .real-world-box,
.integral-content:not(.show) .integral-explanation,
.integral-content:not(.show) .partisi-visualization {
    margin: 0;
    padding: 0;
    display: none;
}

.integral-content.show .real-world-box,
.integral-content.show .integral-explanation,
.integral-content.show .partisi-visualization {
    margin: 20px;
    display: block;
}

/* Pastikan header tidak terpengaruh */
.integral-header {
    background: var(--success);
    color: white;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
    margin-bottom: 0; /* Hilangkan margin bottom */
}

.integral-section {
    margin: 0 25px 25px 25px;
    background: var(--panel-bg);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
/* ===== DARK MODE STYLES ===== */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

body.dark-mode .container {
    background: #1e1e2f;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

body.dark-mode .header {
    background: linear-gradient(135deg, #1b5e20, #0a2e0f);
}

body.dark-mode .panel-left,
body.dark-mode .panel-right {
    background: #2a2a3a;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

body.dark-mode .panel-left h2,
body.dark-mode .panel-right h2 {
    color: #81c784;
    border-bottom-color: #81c784;
}

body.dark-mode .info-box {
    background: #1e3a2f;
    border-left-color: #81c784;
}

body.dark-mode .info-box p {
    color: #c8e6c9;
}

body.dark-mode .input-field label {
    color: #81c784;
}

body.dark-mode .input-field input,
body.dark-mode .input-field select {
    background: #3a3a4a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}

body.dark-mode .input-field input:focus {
    border-color: #81c784;
}

body.dark-mode .titik-container {
    background: #2a2a3a;
    border-color: #4a4a5a;
}

body.dark-mode .titik-row {
    background: #1e3a2f;
}

body.dark-mode .titik-row span {
    color: #81c784;
}

body.dark-mode .titik-row input {
    background: #3a3a4a;
    border-color: #5a5a6a;
    color: #e0e0e0;
}

body.dark-mode .preset-btn {
    background: #3a3a4a;
    border-color: #5a5a6a;
    color: #e0e0e0;
}

body.dark-mode .preset-btn:hover {
    background: #81c784;
    color: #1a1a2e;
    border-color: #81c784;
}
body.dark-mode .preset-btn.active {
    background: #4caf50;  /* hijau terang agar kontras dengan background gelap */
    color: #1a1a2e;       /* teks gelap agar mudah dibaca */
    border-color: #4caf50;
    box-shadow: 0 2px 8px rgba(76,175,80,0.4);
}

body.dark-mode .advanced-features {
    background: #1e2a2f;
}

body.dark-mode .feature-item {
    background: #2a2a3a;
}

body.dark-mode .feature-item label {
    color: #81c784;
}

body.dark-mode .feature-item .tooltip {
    color: #aaa;
}

body.dark-mode .info-interpolasi {
    background: #1b5e20;
    color: white;
}

body.dark-mode .btn-primary {
    background: #1b5e20;
}

body.dark-mode .btn-primary:hover {
    background: #0a3a0f;
}

body.dark-mode .btn-secondary {
    background: #0277bd;
}

body.dark-mode .btn-secondary:hover {
    background: #01579b;
}

body.dark-mode .btn-success {
    background: #6a1b9a;
}

body.dark-mode .btn-success:hover {
    background: #4a0072;
}

body.dark-mode .btn-warning {
    background: #bf360c;
}

body.dark-mode .btn-warning:hover {
    background: #8d2c00;
}

body.dark-mode #lahanCanvas {
    background: #2a2a3a;
    border-color: #5a5a6a;
}

body.dark-mode .canvas-btn {
    background: #1b5e20;
}

body.dark-mode .canvas-btn:hover {
    background: #0a3a0f;
}

body.dark-mode table th {
    background: #1b5e20;
    color: white;
}

body.dark-mode td {
    border-bottom-color: #4a4a5a;
    color: #e0e0e0;
}

body.dark-mode tr:nth-child(even) {
    background: #2a2a3a;
}

body.dark-mode .metode-polygon td {
    background: #1e3a2f;
}

body.dark-mode .kesimpulan {
    background: #1e3a2f;
    border-left-color: #81c784;
    color: #e0e0e0;
}

body.dark-mode .kesimpulan h3 {
    color: #81c784;
}

body.dark-mode .kesimpulan p {
    color: #e0e0e0;
}

body.dark-mode .kesimpulan strong {
    color: #ff9800;
}

body.dark-mode .kesimpulan small {
    color: #aaa;
}

body.dark-mode .info-metode {
    background: #1e3a2f;
    color: #e0e0e0;
}

body.dark-mode .info-metode p {
    color: #e0e0e0;
}

body.dark-mode .info-metode ul {
    color: #e0e0e0;
}

body.dark-mode .info-metode li {
    color: #e0e0e0;
}

/* ===== INTEGRAL SECTION - DARK MODE ===== */
body.dark-mode .integral-section {
    background: #2a2a3a;
    border-color: #4a4a5a;
}

body.dark-mode .integral-header {
    background: #1b5e20;
    color: white;
}

body.dark-mode .integral-content {
    background: #2a2a3a;
}

body.dark-mode .real-world-box {
    background: #1e2a2f;
    border-left-color: #ff9800;
}

body.dark-mode .real-world-box h4 {
    color: #ff9800;
}

body.dark-mode .real-world-box p {
    color: #e0e0e0;
}

body.dark-mode .integral-explanation {
    background: #1e3a2f;
}

body.dark-mode .integral-explanation h4 {
    color: #81c784;
}

body.dark-mode .integral-explanation p {
    color: #e0e0e0;
}

body.dark-mode .integral-explanation ol {
    color: #e0e0e0;
}

body.dark-mode .integral-explanation li {
    color: #e0e0e0;
}

body.dark-mode .formula-box {
    background: #2a2a3a;
}

body.dark-mode .formula-box p {
    color: #e0e0e0;
}

body.dark-mode .formula-box .small {
    color: #aaa;
}

body.dark-mode .method-item {
    color: #e0e0e0;
}

body.dark-mode .partisi-visualization {
    background: #2a2a3a;
}

body.dark-mode .partisi-visualization h4 {
    color: #81c784;
}

body.dark-mode .partisi-visualization .caption {
    color: #aaa;
}

body.dark-mode .integral-role {
    background: #1e3a4a;
}

body.dark-mode .integral-role p {
    color: #e0e0e0;
}

body.dark-mode .integral-role ul {
    color: #e0e0e0;
}

body.dark-mode .integral-role li {
    color: #e0e0e0;
}

/* ===== DETAIL PERHITUNGAN - DARK MODE ===== */
body.dark-mode .perhitungan-tab {
    background: #2a2a3a;
    border: 1px solid #4a4a5a;
}

body.dark-mode .perhitungan-header {
    background: #1b5e20;
    color: white;
}

body.dark-mode .perhitungan-body {
    background: #1e1e2a;
    color: #e0e0e0;
}

body.dark-mode .perhitungan-step {
    border-left-color: #81c784;
    color: #e0e0e0;
}

body.dark-mode .perhitungan-step h4 {
    color: #81c784;
}

body.dark-mode .perhitungan-step p {
    color: #e0e0e0;
}

body.dark-mode .perhitungan-step .formula {
    background: #2a2a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a5a;
}

body.dark-mode .perhitungan-step .hasil {
    color: #81c784;
}

/* ===== METODE SECTION - DARK MODE ===== */
body.dark-mode .metode-section {
    background: #2a2a3a;
    border-color: #4a4a5a;
}

body.dark-mode .metode-section .roll-header {
    background: #1b5e20;
    color: white;
}

body.dark-mode .metode-section .roll-content > div {
    background: #2a2a3a;
}

body.dark-mode .metode-section h4 {
    color: #81c784;
}

body.dark-mode .metode-section p {
    color: #e0e0e0;
}

body.dark-mode .metode-section ul {
    color: #e0e0e0;
}

body.dark-mode .metode-section li {
    color: #e0e0e0;
}

/* Card putih di metode section */
body.dark-mode .metode-section div[style*="background: white"] {
    background: #1e1e2a !important;
}

body.dark-mode .metode-section div[style*="background: white"] h5 {
    color: #81c784 !important;
}

body.dark-mode .metode-section div[style*="background: white"] p {
    color: #e0e0e0 !important;
}

body.dark-mode .metode-section div[style*="background: white"] ul {
    color: #e0e0e0 !important;
}

body.dark-mode .metode-section div[style*="background: white"] li {
    color: #e0e0e0 !important;
}

/* Tabel perbandingan */
body.dark-mode .metode-section table {
    background: #2a2a3a;
}

body.dark-mode .metode-section th {
    background: #1b5e20;
    color: white;
}

body.dark-mode .metode-section td {
    border-bottom-color: #4a4a5a;
    color: #e0e0e0;
}

/* Catatan khusus */
body.dark-mode div[style*="background: #fff3e0"] {
    background: #2a2a3a !important;
    border-left: 3px solid #ff9800;
}

body.dark-mode div[style*="background: #f3e5f5"] {
    background: #2a2a3a !important;
    border-left: 3px solid #ce93d8;
}

body.dark-mode div[style*="background: #fff3e0"] h5,
body.dark-mode div[style*="background: #f3e5f5"] h5 {
    color: #ff9800 !important;
}

body.dark-mode div[style*="background: #fff3e0"] p,
body.dark-mode div[style*="background: #f3e5f5"] p {
    color: #e0e0e0 !important;
}
/* ===== PERBAIKAN 4 METODE PERHITUNGAN (di integral section) ===== */
body.dark-mode .integral-explanation > div > div[style*="background: #d5fbd7"],
body.dark-mode .integral-explanation > div > div[style*="background: #e8f5e9"] {
    background: #1e3a2f !important;
}
body.dark-mode .integral-explanation > div > div[style*="background: #e1f5fe"] {
    background: #1e3a4a !important;
}
body.dark-mode .integral-explanation > div > div[style*="background: #fff3e0"] {
    background: #3a2a1a !important;
}
body.dark-mode .integral-explanation > div > div[style*="background: #f3e5f5"] {
    background: #2a1e3a !important;
}
body.dark-mode .integral-explanation > div > div strong {
    color: #81c784 !important;
}
body.dark-mode .integral-explanation > div > div p {
    color: #e0e0e0 !important;
}

/* ===== PERBAIKAN BAB 5 DI METODE SECTION ===== */
body.dark-mode .metode-section .roll-content > div h4 {
    color: #81c784 !important;
}
body.dark-mode .metode-section .roll-content > div p {
    color: #e0e0e0 !important;
}
body.dark-mode .metode-section .roll-content > div ul {
    color: #e0e0e0 !important;
}
body.dark-mode .metode-section .roll-content > div li {
    color: #e0e0e0 !important;
}

/* ===== PERBAIKAN BACKGROUND METODE SECTION ===== */
body.dark-mode .metode-section .roll-content > div {
    background: #2a2a3a !important;
}
/* ===== FOOTER - DARK MODE ===== */
body.dark-mode .footer {
    background: #0a0a14;
}

body.dark-mode .footer-card {
    background: #1e1e2a;
}

body.dark-mode .footer-card h4 {
    color: #81c784;
}

body.dark-mode .footer-card p {
    color: #e0e0e0;
}

body.dark-mode .badge {
    background: #1b5e20;
}

/* ===== POPUP PANDUAN - DARK MODE ===== */
body.dark-mode .popup-content {
    background: #2a2a3a;
}

body.dark-mode .popup-header {
    background: linear-gradient(135deg, #1b5e20, #0a2e0f);
}

body.dark-mode .popup-body {
    color: #e0e0e0;
}

body.dark-mode .popup-body h3 {
    color: #81c784;
}

body.dark-mode .popup-body code {
    background: #1e1e2a;
    color: #ff9800;
}

/* ===== ROLLHEADER - DARK MODE ===== */
body.dark-mode .roll-header {
    background: #1e3a2f;
    color: #81c784;
}

body.dark-mode .roll-header:hover {
    background: #2a4a3a;
}

/* ===== LOADING - DARK MODE ===== */
body.dark-mode .loading {
    background: rgba(30, 30, 42, 0.9);
    color: #e0e0e0;
}
/* Perbaikan tampilan di integral section */
.integral-explanation {
    overflow-x: auto;
}

.integral-explanation > div > div {
    word-wrap: break-word;
}
/* ===== DARK MODE UNTUK CARD DI INTEGRAL SECTION ===== */
body.dark-mode .dark-mode-card {
    border: 1px solid #4a4a5a;
}

body.dark-mode .dark-mode-card strong {
    color: #81c784 !important;
}

body.dark-mode .dark-mode-card p {
    color: #e0e0e0 !important;
}

/* Warna background khusus untuk masing-masing card di integral section */
body.dark-mode .integral-explanation .dark-mode-card:nth-child(1) {
    background: #1e3a2f !important;
}
body.dark-mode .integral-explanation .dark-mode-card:nth-child(2) {
    background: #1e3a4a !important;
}
body.dark-mode .integral-explanation .dark-mode-card:nth-child(3) {
    background: #3a2a1a !important;
}
body.dark-mode .integral-explanation .dark-mode-card:nth-child(4) {
    background: #2a1e3a !important;
}

/* ===== DARK MODE UNTUK CARD DI METODE SECTION ===== */
body.dark-mode .metode-section .dark-mode-card {
    background: #1e1e2a !important;
    border: 1px solid #4a4a5a;
}

body.dark-mode .metode-section .dark-mode-card h5 {
    color: #81c784 !important;
}

body.dark-mode .metode-section .dark-mode-card p {
    color: #e0e0e0 !important;
}

body.dark-mode .metode-section .dark-mode-card ul {
    color: #e0e0e0 !important;
}

body.dark-mode .metode-section .dark-mode-card li {
    color: #e0e0e0 !important;
}

body.dark-mode .metode-section .dark-mode-card em {
    color: #aaa !important;
}
/* ===== PERBAIKAN KONSISTENSI BACKGROUND 4 METODE ===== */
body.dark-mode .integral-explanation .dark-mode-card {
    border: 1px solid #4a4a5a;
}

/* Poligon - hijau gelap */
body.dark-mode .integral-explanation .dark-mode-card:nth-child(1) {
    background: #295e48 !important;
}

/* Riemann - biru gelap */
body.dark-mode .integral-explanation .dark-mode-card:nth-child(2) {
    background: #1e3a4a !important;
}

/* Trapezoida - orange gelap */
body.dark-mode .integral-explanation .dark-mode-card:nth-child(3) {
    background: #3a2a1a !important;
}

/* Simpson - ungu gelap */
body.dark-mode .integral-explanation .dark-mode-card:nth-child(4) {
    background: #2a1e3a !important;
}

/* Teks di dalam card */
body.dark-mode .integral-explanation .dark-mode-card strong {
    color: #81c784 !important;
}

body.dark-mode .integral-explanation .dark-mode-card p {
    color: #e0e0e0 !important;
}
/* ===== PERBAIKAN TEKS VISUALISASI PARTISI - DARK MODE ===== */
body.dark-mode .partisi-controls label {
    color: #e0e0e0 !important;
}

body.dark-mode .partisi-controls span {
    color: #e0e0e0 !important;
}

body.dark-mode .partisi-controls input {
    background: #3a3a4a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .partisi-controls .btn-small {
    background: #1b5e20 !important;
    color: white !important;
}

body.dark-mode .caption {
    color: #aaa !important;
}
/* ===== PERBAIKAN TEKS FITUR CSV - DARK MODE ===== */
body.dark-mode .feature-item input[type="file"] {
    background: #3a3a4a !important;
    color: #e0e0e0 !important;
    border-color: #5a5a6a !important;
}

body.dark-mode .feature-item input[type="file"]::file-selector-button {
    background: #ffffff !important;
    color: rgb(0, 0, 0) !important;
    border: none !important;
    padding: 5px 10px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
}

body.dark-mode .feature-item input[type="file"]::file-selector-button:hover {
    background: #0a3a0f !important;
}
/* ===== PERBAIKAN POPUP PANDUAN - DARK MODE (DENGAN WARNA) ===== */

/* Background utama popup */
body.dark-mode .popup-body {
    background: #2a2a3a !important;
    color: #e0e0e0 !important;
}

/* Judul utama */
body.dark-mode .popup-body h3 {
    color: #81c784 !important;
}

/* Sub judul fitur */
body.dark-mode .popup-body h4 {
    color: #81c784 !important;
}

/* Teks paragraf */
body.dark-mode .popup-body p {
    color: #e0e0e0 !important;
}

/* List dan item */
body.dark-mode .popup-body ul,
body.dark-mode .popup-body ol {
    color: #e0e0e0 !important;
}

body.dark-mode .popup-body li {
    color: #e0e0e0 !important;
}

/* Strong/bold text */
body.dark-mode .popup-body strong {
    color: #ff9800 !important;
}

/* Kode contoh */
body.dark-mode .popup-body code {
    background: #1e1e2a !important;
    color: #ff9800 !important;
}

/* ===== CARD FITUR LANJUTAN (TETAP BERWARNA, VERSI GELAP) ===== */
/* Interpolasi - hijau gelap */
body.dark-mode .popup-body div[style*="background: #e8f5e9"] {
    background: #1e3a2f !important;
    border: 1px solid #2a5a3f;
}

/* Skala Gambar - biru gelap */
body.dark-mode .popup-body div[style*="background: #e1f5fe"] {
    background: #1e3a4a !important;
    border: 1px solid #2a5a6a;
}

/* Presisi - orange gelap */
body.dark-mode .popup-body div[style*="background: #fff3e0"] {
    background: #3a2a1a !important;
    border: 1px solid #5a4a2a;
}

/* Partisi - ungu gelap */
body.dark-mode .popup-body div[style*="background: #f3e5f5"] {
    background: #2a1e3a !important;
    border: 1px solid #4a2e5a;
}

/* Jenis Riemann - biru muda gelap */
body.dark-mode .popup-body div[style*="background: #e0f2fe"] {
    background: #1e3a4a !important;
    border: 1px solid #2e5a6a;
}

/* Jenis Simpson - pink gelap */
body.dark-mode .popup-body div[style*="background: #fce4ec"] {
    background: #3a1e2a !important;
    border: 1px solid #5a2e3a;
}

/* Trapezoida - biru keunguan gelap */
body.dark-mode .popup-body div[style*="background: #e8eaf6"] {
    background: #1e1e3a !important;
    border: 1px solid #2e2e5a;
}

/* ===== CARD METODE PERHITUNGAN ===== */
/* Poligon - hijau gelap */
body.dark-mode .popup-body div[style*="background: #e8f5e9"] h4,
body.dark-mode .popup-body div[style*="background: #e8f5e9"] p {
    color: #e0e0e0 !important;
}

/* Riemann - biru gelap */
body.dark-mode .popup-body div[style*="background: #e1f5fe"] h4,
body.dark-mode .popup-body div[style*="background: #e1f5fe"] p {
    color: #e0e0e0 !important;
}

/* Trapezoida - orange gelap */
body.dark-mode .popup-body div[style*="background: #fff3e0"] h4,
body.dark-mode .popup-body div[style*="background: #fff3e0"] p {
    color: #e0e0e0 !important;
}

/* Simpson - ungu gelap */
body.dark-mode .popup-body div[style*="background: #f3e5f5"] h4,
body.dark-mode .popup-body div[style*="background: #f3e5f5"] p {
    color: #e0e0e0 !important;
}

/* Teks heading di dalam card metode */
body.dark-mode .popup-body div[style*="background: #e8f5e9"] h4,
body.dark-mode .popup-body div[style*="background: #e1f5fe"] h4,
body.dark-mode .popup-body div[style*="background: #fff3e0"] h4,
body.dark-mode .popup-body div[style*="background: #f3e5f5"] h4 {
    color: #81c784 !important;
}

/* Footer panduan */
body.dark-mode .popup-body div[style*="border-top: 1px solid #ddd"] {
    border-top-color: #4a4a5a !important;
}

body.dark-mode .popup-body div[style*="border-top: 1px solid #ddd"] p {
    color: #aaa !important;
}
/* Responsive table */
.metode-section .roll-content {
    overflow-x: auto;
}

.metode-section table {
    width: 100%;
    border-collapse: collapse;
}

@media (max-width: 768px) {
    .metode-section th,
    .metode-section td {
        padding: 6px 4px;
        font-size: 11px;
    }
}
/* ===== PERBAIKAN KHUSUS METODE SECTION ===== */
.metode-section {
    margin: 0 25px 25px 25px !important;
}

.metode-section .roll-content {
    overflow-x: visible !important;
}

.metode-section .roll-content > div {
    padding: 20px !important;
}
/* ===== TABEL PERBANDINGAN AKURASI - VERSI STABIL ===== */

/* Container utama - bisa scroll horizontal jika terlalu sempit */
.comparison-grid {
    width: 100%;
    overflow-x: auto;
    margin-top: 10px;
}

/* Baris tabel - menggunakan grid, bukan flex wrap */
.comparison-row {
    display: grid;
    grid-template-columns: 2fr 0.8fr 0.8fr 1.5fr;
    gap: 8px;
    padding: 10px 8px;
    border-bottom: 1px solid #ddd;
    align-items: center;
}

/* Header tabel */
.comparison-row.header {
    background: #c8e6c9;
    border-radius: 8px;
    font-weight: bold;
    border-bottom: none;
    margin-bottom: 5px;
}

/* Sel tabel */
.comparison-cell {
    padding: 0 4px;
}

/* Kolom Error dan Kecepatan di tengah */
.comparison-row:not(.header) .comparison-cell:nth-child(2),
.comparison-row:not(.header) .comparison-cell:nth-child(3) {
    text-align: center;
}

/* Responsive untuk layar kecil - ubah grid menjadi 2 baris */
@media (max-width: 650px) {
    .comparison-row {
        grid-template-columns: 1fr 0.7fr 0.7fr 1.2fr;
        gap: 5px;
        font-size: 12px;
        padding: 8px 5px;
    }
}

@media (max-width: 550px) {
    .comparison-row {
        display: flex;
        flex-direction: column;
        padding: 12px 10px;
        border-bottom: 1px solid #ddd;
        background: #f9f9f9;
        margin-bottom: 5px;
        border-radius: 8px;
    }
    
    .comparison-row.header {
        display: none; /* Sembunyikan header di HP */
    }
    
    .comparison-cell {
        width: 100%;
        padding: 4px 0;
    }
    
    .comparison-cell:before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 100px;
    }
    
    .comparison-row:not(.header) .comparison-cell:nth-child(2),
    .comparison-row:not(.header) .comparison-cell:nth-child(3) {
        text-align: left;
    }
}
/* Memastikan MathJax merender dengan benar */
mjx-container {
    display: inline-block;
    margin: 0 2px;
}

mjx-container[jax="CHTML"][display="true"] {
    display: block;
    margin: 1em 0;
    text-align: center;
}
/* ===== PETA INTERAKTIF ===== */
.map-container {
    margin: 0 25px 25px 25px;
}

#lahanMap {
    z-index: 1;
}

/* Dark mode untuk peta */
body.dark-mode #lahanMap {
    filter: brightness(0.8);
}

/* Marker popup di dark mode */
body.dark-mode .leaflet-popup-content-wrapper {
    background: #2a2a3a;
    color: #e0e0e0;
}

body.dark-mode .leaflet-popup-tip {
    background: #2a2a3a;
}
/* ===== KALKULATOR KONVERSI SATUAN ===== */
.konversi-satuan {
    transition: background 0.3s, border-color 0.3s;
}

body.dark-mode .konversi-satuan {
    background: #2a2a3a !important;
    border-color: #4a4a5a !important;
}

body.dark-mode .konversi-satuan label {
    color: #aaa !important;
}

body.dark-mode .konversi-satuan input,
body.dark-mode .konversi-satuan select {
    background: #3a3a4a !important;
    border-color: #5a5a6a !important;
    color: #e0e0e0 !important;
}

body.dark-mode #konversiHasil {
    background: #1e3a2f !important;
    color: #81c784 !important;
}
#konversiHasil {
    word-break: break-word;
    font-size: 0.9em;
}
/* Dark mode untuk estimasi pagar */
body.dark-mode .estimasi-pagar {
    background: #2a2a3a !important;
    border-color: #4a4a5a !important;
}

body.dark-mode .estimasi-pagar h4 {
    color: #ff9800 !important; /* warna oranye tetap terang */
}

body.dark-mode .estimasi-pagar label {
    color: #aaa !important;
}

body.dark-mode .estimasi-pagar input {
    background: #3a3a4a !important;
    border-color: #5a5a6a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .estimasi-pagar input:focus {
    border-color: #ff9800 !important;
    outline: none;
}

body.dark-mode #kelilingValue {
    color: #ff9800 !important; /* oranye */
}

body.dark-mode #totalBiaya {
    color: #81c784 !important; /* hijau muda untuk dark */
}

body.dark-mode .estimasi-pagar p {
    color: #aaa !important;
}
/* Dark mode untuk estimasi bibit */
body.dark-mode .estimasi-bibit {
    background: #2a2a3a !important;
    border-color: #4a4a5a !important;
}
body.dark-mode .estimasi-bibit h4 {
    color: #81c784 !important;
}
body.dark-mode .estimasi-bibit label {
    color: #aaa !important;
}
body.dark-mode .estimasi-bibit input {
    background: #3a3a4a !important;
    border-color: #5a5a6a !important;
    color: #e0e0e0 !important;
}
body.dark-mode #jumlahBibit {
    color: #81c784 !important;
}
body.dark-mode .estimasi-bibit p {
    color: #aaa !important;
}
/* Perbaikan teks small (keterangan) di estimasi pagar dan bibit saat dark mode */
body.dark-mode .estimasi-pagar small,
body.dark-mode .estimasi-bibit small {
    color: #aaa !important;
}
/* ============================================ */
/* PERBAIKAN KHUSUS UNTUK HP (≤ 768px) - TIDAK MENGGANGGU DESKTOP */
/* ============================================ */

@media only screen and (max-width: 768px) {
    /* Cegah overflow horizontal */
    body, .container, .main-content, .panel-left, .panel-right {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Main content jadi 1 kolom */
    .main-content {
        grid-template-columns: 1fr !important;
        gap: 15px;
        padding: 10px;
    }

    /* Panel dalam bisa scroll jika perlu */
    .panel-left, .panel-right {
        padding: 12px;
        overflow-x: auto;
    }

    /* Canvas - bisa di-scroll horizontal */
    .canvas-container {
        overflow-x: auto;
        text-align: center;
    }
    #lahanCanvas {
        max-width: 100%;
        height: auto;
    }

    /* Tabel hasil - scroll horizontal */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table {
        min-width: 500px; /* biar bisa digeser */
        font-size: 12px;
    }
    th, td {
        padding: 6px 4px;
    }

    /* Peta interaktif */
    .map-container {
        margin: 0 0 15px 0 !important;
    }
    #lahanMap {
        height: 250px !important;
    }
    .map-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    .map-header button {
        font-size: 10px;
        padding: 4px 8px;
    }

    /* Preset tombol - wrap rapi */
    .preset-buttons {
        justify-content: center;
    }
    .preset-btn {
        font-size: 10px;
        padding: 5px 8px;
    }

    /* Fitur grid jadi 1 kolom */
    .feature-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    /* Info interpolasi */
    .info-interpolasi {
        font-size: 10px;
        white-space: normal;
        word-break: break-word;
    }

    /* Konversi satuan & estimasi - susun vertikal */
    .konversi-satuan > div,
    .estimasi-pagar > div,
    .estimasi-bibit > div {
        flex-direction: column;
        gap: 8px;
    }
    .konversi-satuan input,
    .konversi-satuan select,
    .estimasi-pagar input,
    .estimasi-bibit input {
        width: 100% !important;
    }

    /* Detail perhitungan */
    .perhitungan-body {
        font-size: 11px;
        padding: 10px;
    }
    .formula {
        font-size: 10px;
        overflow-x: auto;
        white-space: pre-wrap;
        word-break: break-all;
    }

    /* Integral & metode section */
    .integral-section, .metode-section {
        margin: 0 10px 15px 10px !important;
    }
    .integral-header h3, .roll-header span {
        font-size: 13px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    /* Tombol bantuan lebih kecil */
    .bantuan-btn {
        width: 45px;
        height: 45px;
        font-size: 24px;
        bottom: 15px;
        right: 15px;
    }
}
/* ===== TOMBOL NAVIGASI MOBILE (KIRI ATAS, FLOATING) ===== */
.nav-mobile-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    font-size: 28px;
    font-weight: bold;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 1000;
    transition: 0.2s;
    display: none;
}
.nav-mobile-btn:hover {
    transform: scale(1.05);
    background: var(--success-dark);
}

.nav-mobile-menu {
    position: fixed;
    top: 80px;
    left: 20px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    padding: 8px 0;
    display: none;
    flex-direction: column;
    z-index: 1000;
    min-width: 220px;
}
.nav-mobile-menu button {
    background: none;
    border: none;
    padding: 12px 20px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s;
}
.nav-mobile-menu button:hover {
    background: var(--success-light);
}
.nav-mobile-menu.show {
    display: flex;
}

/* Sembunyikan di desktop (lebar > 768px) */
@media (min-width: 769px) {
    .nav-mobile-btn, .nav-mobile-menu {
        display: none !important;
    }
}

/* Dark mode untuk menu */
body.dark-mode .nav-mobile-menu {
    background: #2a2a3a;
    border: 1px solid #4a4a5a;
}
body.dark-mode .nav-mobile-menu button {
    color: #e0e0e0;
}
body.dark-mode .nav-mobile-menu button:hover {
    background: #1e3a2f;
}