/* Reset dan Pengaturan Dasar */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto Mono', monospace;
    background-color: #1e1e1e; /* Warna latar belakang gelap */
    color: #d4d4d4; /* Warna teks terang */
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden; /* Mencegah scroll di body utama */
}

header {
    padding: 1rem;
    background-color: #252526;
    border-bottom: 1px solid #333;
    text-align: center;
}

h1 {
    font-size: 1.5rem;
}

/* Kontainer Utama */
.container {
    display: flex;
    flex-grow: 1; /* Mengisi sisa ruang vertikal */
}

/* Kolom Editor dan Preview */
.editor-container, .preview-container {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem; /* Jarak antar elemen */
    width: 50%;
}

.preview-container {
    border-left: 2px solid #333;
}

/* Area Editor Kode */
.code-editor {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

label {
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #4fc1ff;
}

textarea {
    width: 100%;
    height: 100%; /* Mengisi ruang yang tersedia */
    flex-grow: 1;
    background-color: #2d2d2d;
    border: 1px solid #3c3c3c;
    border-radius: 8px;
    color: #cccccc;
    padding: 1rem;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    resize: none; /* Menonaktifkan resize manual */
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

textarea:focus {
    border-color: #4fc1ff;
    box-shadow: 0 0 5px rgba(79, 193, 255, 0.5);
}

/* Frame untuk Preview */
iframe {
    width: 100%;
    height: 100%;
    background-color: #ffffff; /* Latar belakang putih untuk preview */
    border: none;
    border-radius: 8px;
}

/* Aturan Responsif untuk Layar Kecil (Mobile) */
@media (max-width: 800px) {
    .container {
        flex-direction: column; /* Ubah layout jadi vertikal */
        height: auto;
        overflow-y: auto; /* Aktifkan scroll */
    }

    .editor-container, .preview-container {
        width: 100%;
        height: 60vh; /* Beri tinggi agar tidak terlalu kecil */
    }

    .preview-container {
        border-left: none;
        border-top: 2px solid #333;
    }
}