/* -- IMPORT FONT & PENGATURAN DASAR -- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --secondary-color: #17a2b8;
    --background-color: #f4f7fc;
    --surface-color: #ffffff;
    --text-color: #343a40;
    --heading-color: #1e3a5f;
    --border-color: #e9ecef;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

/* -- CONTAINER & LAYOUT UTAMA -- */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    color: var(--heading-color);
    font-weight: 700;
}

.back-link {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--primary-dark);
}

.simulation-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

/* --- PERUBAHAN KUNCI UNTUK LAYOUT --- */
/* Aturan ini akan membuat kolom menjadi vertikal JIKA class 'full-width-mode' ada */
.simulation-layout.full-width-mode {
    flex-direction: column;
}

.left-column, .right-column {
    flex: 1;
    min-width: 300px;
}

/* Tambahkan ini di mana saja di dalam file style.css */

.code-comparison .highlight {
    background-color: #fff3cd; /* Warna kuning lembut untuk sorotan */
    border-left: 4px solid #ffe082;
    border-radius: 4px;
    padding: 2px 4px;
    display: block; /* Agar highlight memenuhi satu baris penuh */
    transition: background-color 0.3s ease;
}

/* -- GAYA PEMILIH SIMULASI -- */
.simulation-switcher {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.simulation-switcher button {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    background: var(--surface-color);
    color: var(--primary-dark);
    border: 2px solid var(--border-color);
    box-shadow: none;
    border-radius: 8px; /* Tambahkan border-radius */
    cursor: pointer; /* Tambahkan cursor pointer */
}

.simulation-switcher button:hover:not(.active) {
    background-color: #e9ecef;
    transform: none;
    box-shadow: none;
}

.simulation-switcher button.active {
    background: linear-gradient(45deg, var(--primary-color) 0%, #00aaff 100%);
    color: white;
    border-color: transparent;
}

/* -- TAMPILAN PANEL -- */
.panel {
    background-color: var(--surface-color);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.04), 0 10px 20px rgba(0,0,0,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.05), 0 12px 24px rgba(0,0,0,0.08);
}

.panel h2 {
    color: var(--heading-color);
    margin-top: 0;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    font-size: 1.25em;
    font-weight: 600;
}

.panel-visualisasi {
    position: sticky;
    top: 20px;
}

pre {
    background-color: var(--border-color);
    border: 1px solid #dee2e6;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    white-space: pre-wrap;
    overflow-x: auto; /* Jaga-jaga jika ada scroll */
}

/* -- INPUT & TOMBOL -- */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

input[type="text"], input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

input[type="text"]:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

button {
    width: 100%;
    padding: 15px 20px;
    border: none;
    background: linear-gradient(45deg, var(--primary-color) 0%, #00aaff 100%);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.3s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 123, 255, 0.3);
}

button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-secondary {
    margin-top: 10px;
    background: #6c757d;
}
.button-secondary:hover:not(:disabled) {
    background: #5a6268;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

/* -- GAYA KHUSUS KODE -- */
.code-label {
    display: block;
    margin-top: 20px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.realtime-code {
    background-color: #2d3748;
    color: #f7fafc;
    border: 1px solid #4a5568;
    margin-bottom: 20px;
}

.code-comparison {
    display: flex;
    gap: 20px;
}
.code-comparison > div {
    flex: 1;
}
.code-comparison h4 {
    margin-top: 0;
    text-align: center;
}
.code-comparison .bad { color: #dc3545; }
.code-comparison .good { color: #28a745; }

/* -- PANEL PENJELASAN -- */
#panel-penjelasan ul {
    list-style: none;
    padding-left: 0;
    counter-reset: step-counter; 
}

#panel-penjelasan li {
    position: relative;
    background-color: #f8f9fa;
    border-left: 4px solid var(--secondary-color);
    padding: 15px 15px 15px 60px;
    margin-bottom: 12px;
    border-radius: 0 8px 8px 0;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#panel-penjelasan li::before {
    counter-increment: step-counter;
    content: counter(step-counter);
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background-color: var(--secondary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
}

#panel-penjelasan li:last-child {
    border-left-color: #28a745;
}

#panel-penjelasan li:last-child::before {
    background-color: #28a745;
    content: '✔';
    font-size: 18px;
}

/* -- RESPONSIVITAS -- */
@media (max-width: 992px) {
    .panel-visualisasi {
        position: static;
    }
}

@media (max-width: 768px) {
    .simulation-layout {
        flex-direction: column; /* Semua layout jadi vertikal di layar kecil */
    }
    .code-comparison {
        flex-direction: column; /* Perbandingan kode juga jadi vertikal */
    }
}