/* General Body and Container */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* --- HEADER STYLES --- */
/* Target elemen <header> dengan kelas .navbar untuk spesifisitas tinggi */
header.navbar {
    background-color: #002D62 !important;
    color: white !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1000 !important;
    padding: 10px 0 !important;
    
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    min-height: auto !important;
    height: auto !important;
    border-bottom: none !important;
}

/* Target container di dalam navbar dengan selektor yang SANGAT spesifik */
header.navbar > .nav-container { /* Selektor ini menargetkan anak langsung dari header.navbar */
    max-width: 1850px !important;
    width: 100% !important; /* INI KUNCI UNTUK MEMBUATNYA TERSEBAR */
    margin: 0 auto !important;
    padding: 0 1.5rem !important;
    
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important; /* Logo kiri, navigasi kanan */
    align-items: center !important;
    flex-wrap: nowrap !important;

    background-color: transparent !important;
    box-sizing: border-box !important;
    /* HAPUS INI: border: 3px dashed blue !important; */ /* Debugging border dihapus */
}

/* Target logo wrapper untuk menghilangkan kotak putih */
.logo-wrapper {
    background-color: white !important; /* Mengubah background menjadi putih */
    padding: 5px 10px !important; /* Menambah padding di sekitar logo */
    border-radius: 6px !important; /* Menambahkan sedikit sudut membulat */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important; /* Menambah sedikit bayangan */
    margin: 0 !important;

    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
    height: auto !important;
}

/* Gaya untuk gambar logo */
.logo-img {
    height: 40px !important;
    width: auto !important;
    margin-right: 0 !important;
}

/* Gaya untuk teks di dalam logo wrapper (span) */
.logo-wrapper span { /* TARGET SPAN SECARA LANGSUNG */
    font-size: 1.5em !important;
    font-weight: bold !important;
    color: #333 !important; /* Mengubah warna teks menjadi hitam/gelap */
    line-height: normal !important;
    vertical-align: middle !important;
    margin: 0 !important;
}

/* Navigasi */
nav {
    display: flex !important;
    flex-direction: row !important;
    flex-grow: 1 !important;
    justify-content: flex-end !important;
    align-items: center !important;
}

nav ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 20px !important;
    justify-content: flex-end !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
}

nav a {
    color: white !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    padding: 5px 10px !important;
    border-radius: 6px !important;
    transition: color 0.3s ease, background-color 0.3s ease !important;
    font-size: 1rem !important;
}

nav a:hover {
    background-color: rgba(255,255,255,0.2) !important;
    color: #007bff !important;
}

nav a.active {
    background-color: #ffffff !important;
    color: #002147 !important;
    font-weight: bold !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1) !important;
}
/* --- END HEADER STYLES --- */

/* Report Header (Back Button & Title) */
.report-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.back-button {
    font-size: 1.5em;
    color: #007bff;
    margin-right: 15px;
    text-decoration: none;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-button:hover {
    color: #0056b3;
}

.report-title {
    flex-grow: 1;
    text-align: center;
    margin: 0;
    color: #004085;
    font-size: 1.8em;
    font-weight: 600;
}

/* Report Layout (Two Columns) */
.report-layout {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    flex-grow: 1;
    min-height: 0;
}

.left-panel, .right-panel {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    
    display: flex;
    flex-direction: column;
    min-height: 0;
    
    height: 100%; /* Biarkan panel mengisi 100% tinggi dari report-layout */
}

.left-panel {
    flex: 1; /* Mengambil 2/3 dari ruang */
    gap: 20px;
    min-width: 300px;
    overflow-y: auto; 
}

.right-panel {
    flex: 2; /* Mengambil 1/3 dari ruang */
    gap: 20px;
    min-width: 250px;

    overflow-y: scroll;
    padding-right: 15px;
}

/* Panel Sections */
.panel-section {
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 6px;
    background-color: #fdfdfd;
    
    flex-shrink: 0;
    flex-grow: 1; /* <--- PASTIKAN INI ADA */

    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-section h2 {
    color: #004085;
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 15px;
    flex-shrink: 0;
}

/* Chart Section */
.chart-section {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.panel-section.chart-section { /* <--- PASTIKAN INI ADA */
    width: 100%;
    /* Jika ada masalah, coba tambahkan !important: */
    /* width: 100% !important; */
}


.chart-control-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 10px;
}

.chart-control label {
    margin-right: 10px;
    font-weight: bold;
    color: #555;
}

.chart-control select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
    font-size: 0.5em;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.chart-control select:hover {
    border-color: #007bff;
}

.chart-buttons {
    display: flex;
    gap: 5px;
}

.chart-buttons button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-buttons button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.chart-buttons button i {
    margin-right: 5px;
}

/* START: STYLES UNTUK PEMBUNGKUS CANVAS */
.chart-canvas-wrapper {
  position: relative;
  height: 400px; /* Atur tinggi default yang Anda inginkan */
  width: 100%;
  margin: 0 auto;
  flex-grow: 1;
  min-height: 0;
  overflow: hidden;
}

/* Pastikan elemen canvas mengisi penuh div pembungkusnya */
.chart-canvas-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}
/* END: STYLES UNTUK PEMBUNGKUS CANVAS */

/* Fullscreen mode for chart */
.chart-section.is-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fff;
    z-index: 1000;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
}

.chart-section.is-fullscreen .chart-control-wrapper {
    margin-bottom: 20px;
    width: 100%;
    justify-content: center;
}

/* Sesuaikan ukuran canvas fullscreen agar sesuai dengan viewport */
.chart-section.is-fullscreen .chart-canvas-wrapper {
    height: calc(100vh - 150px);
    width: calc(100vw - 40px);
}

/* Statistics Table */
.stat-section {
    margin-top: 20px;
}

.stat-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.95em;
}

.stat-table th, .stat-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.stat-table th {
    background-color: #e9ecef;
    font-weight: bold;
    color: #495057;
}

.stat-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.stat-table tbody tr:hover {
    background-color: #e2e6ea;
}

.stat-section p {
    margin-top: 15px;
    font-size: 1.1em;
}

.stat-section p strong {
    color: #004085;
}

.standard-label {
    font-size: 1em;
    color: #333;
}

.standard-detail {
    font-size: 0.9em;
    color: #666;
}

.status-ok {
    color: #28a745;
    font-weight: bold;
}

.status-not-ok {
    color: #dc3545;
    font-weight: bold;
}

/* Recommendation and Calculation Content */
#recommendationContent, #calculationContent {
    margin-top: 15px;
    line-height: 1.6;
    color: #444;
    
    flex-grow: 1;
    min-height: 0;
}

#recommendationContent p, #calculationContent p {
    margin-bottom: 10px;
    text-align: justify;
}


/* Responsive Design */
@media (max-width: 992px) {
    .report-layout {
        flex-direction: column;
        max-height: unset; 
        overflow: unset;
    }
    .left-panel, .right-panel {
        flex: 1 1 100%;
        min-width: unset;
        max-height: unset;
        height: unset;
        overflow-y: auto;
        padding-right: 20px;
    }
    .panel-section {
        /* flex-grow: unset; */
        /* flex-shrink: unset; */
    }
    .chart-canvas-wrapper {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    .report-title {
        font-size: 1.5em;
    }
    .back-button {
        font-size: 1.2em;
    }
    .chart-control-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .chart-buttons {
        margin-top: 5px;
        width: 100%;
        justify-content: flex-start;
    }
    .chart-buttons button {
        flex-grow: 1;
    }
    .chart-canvas-wrapper {
        height: 250px;
    }
}

@media (max-width: 576px) {
    .report-title {
        font-size: 1.3em;
    }
    .report-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .back-button {
        margin-bottom: 10px;
    }
    .chart-canvas-wrapper {
        height: 200px;
    }
}
/* --- FOOTER STYLES --- */
footer { /* Asumsi footer Anda menggunakan tag <footer> */
    background-color: #002D62; /* Biru gelap, cocok dengan header */
    color: white;
    text-align: center;
    padding: 15px 0; /* Padding vertikal untuk teks di dalam footer */
    margin-top: 30px; /* Jarak antara konten dan footer */
    width: 100%; /* Memastikan footer membentang lebar penuh */
    flex-shrink: 0; /* Mencegah footer menyusut */
}
/* --- END FOOTER STYLES --- */

