/* ===== CSS (diperluas) ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body {
    background: #f0f2f5;
    padding: 20px;
}
.app-container {
    max-width: 2000px;
    margin: 0 auto;
    display: grid;
    grid-template-areas: 
        "header header header"
        "sidebar main right"
        "footer footer footer";
    grid-template-columns: 320px 1fr 500px;
    grid-template-rows: auto 1fr auto;
    gap: 20px;
    background: transparent;
}
.header {
    grid-area: header;
    background: white;
    padding: 20px 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: -0.02em;
}
.header .badge {
    background: #e2e8f0;
    color: #334155;
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
}
.sidebar {
    grid-area: sidebar;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
.sidebar .card {
    background: #f8fafc;
    border-radius: 14px;
    padding: 16px;
}
.card-title {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 15px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: #475569;
    transition: all 0.2s;
    cursor: pointer;
}
.upload-area:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}
.upload-area input {
    display: none;
}
.info-well {
    background: white;
    border-radius: 12px;
    padding: 12px;
    font-size: 0.9rem;
}
.info-well p {
    margin: 6px 0;
    color: #1e293b;
}
.param-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.param-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.param-item label {
    color: #334155;
    font-weight: 500;
}
.param-item input, .param-item select {
    width: 100px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}
.summary-box {
    background: #e6f0ff;
    border-radius: 14px;
    padding: 16px;
    margin-top: 10px;
}
.summary-box h4 {
    color: #1e40af;
    margin-bottom: 8px;
}
.main {
    grid-area: main;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.log-viewer {
    width: 100%;
    height: 550px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e9eef2;
}
.right {
    grid-area: right;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
}
.right-section {
    background: #f8fafc;
    border-radius: 14px;
    padding: 16px;
}
.matrix-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.matrix-plot {
    width: 100%;
    height: 150px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.histogram-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.histogram-plot {
    width: 100%;
    height: 120px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.footer {
    grid-area: footer;
    background: white;
    border-radius: 20px;
    padding: 20px 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.zone-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.zone-table th {
    text-align: left;
    background: #f1f5f9;
    padding: 10px 12px;
    color: #0f172a;
}
.zone-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
}
.zone-table tr:hover {
    background: #f8fafc;
}
.badge-zone {
    background: #22c55e20;
    color: #15803d;
    padding: 4px 8px;
    border-radius: 20px;
    font-weight: 500;
}
.status-message {
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.9rem;
}
.status-message.error {
    background: #fee2e2;
    color: #b91c1c;
}
.status-message.success {
    background: #dcfce7;
    color: #166534;
}
.loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s;
}
.btn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.btn:hover {
    background: #2563eb;
}
.btn-secondary {
    background: #64748b;
}
.btn-secondary:hover {
    background: #475569;
}
.flex-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.additional-plots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}
.additional-plot {
    width: 100%;
    height: 200px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* ===== PERBAIKAN RESPONSIF ===== */
@media screen and (max-width: 1400px) {
    .app-container {
        grid-template-columns: 280px 1fr 400px;
    }
}
@media screen and (max-width: 1200px) {
    .app-container {
        grid-template-columns: 250px 1fr 350px;
    }
    .log-viewer {
        height: 500px;
    }
}
@media screen and (max-width: 1024px) {
    .app-container {
        grid-template-areas: 
            "header"
            "sidebar"
            "main"
            "right"
            "footer";
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .sidebar, .main, .right {
        max-height: none;
        overflow-y: visible;
    }
    .log-viewer {
        height: 450px;
    }
    .matrix-plot, .histogram-plot, .additional-plot {
        height: 180px;
    }
}
@media screen and (max-width: 768px) {
    .header h1 {
        font-size: 1.4rem;
    }
    .header .badge {
        margin-top: 8px;
    }
    .param-item {
        flex-wrap: wrap;
    }
    .param-item input, .param-item select {
        width: 100%;
        margin-top: 4px;
    }
    .matrix-container, .histogram-container, .additional-plots {
        grid-template-columns: 1fr;
    }
    .matrix-plot, .histogram-plot, .additional-plot {
        height: 200px;
    }
    .log-viewer {
        height: 500px;
    }
    .zone-table {
        font-size: 0.8rem;
    }
    .zone-table th, .zone-table td {
        padding: 6px 8px;
    }
}
@media screen and (max-width: 480px) {
    body {
        padding: 10px;
    }
    .header h1 {
        font-size: 1.2rem;
    }
    .btn {
        width: 100%;
        text-align: center;
    }
    .flex-row {
        flex-direction: column;
        align-items: stretch;
    }
    .log-viewer {
        height: 550px;
    }
}