/* Tambahkan ini di baris paling atas agar padding tidak merusak lebar layar */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: #eef2f5; 
    color: #2c3e50;
    margin: 0;
    padding: 40px 20px;
    min-height: 100vh; /* Memastikan background menutupi seluruh tinggi layar HP */
    /* display: flex; dan justify-content: center; DIHAPUS */
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 500px;
    border-top: 6px solid #4a90e2;
    margin: 0 auto; /* Ini yang bertugas membuat kotak berada tepat di tengah layar */
}

/* ... (BIAKAN KODE CSS LAINNYA DI BAWAH SINI SEPERTI .header, .input-group, DLL) ... */


.header {
    text-align: center;
    margin-bottom: 25px;
}

h2 { 
    color: #2c3e50; 
    margin: 0 0 5px 0; 
    font-weight: 800;
    font-size: 28px;
}

p.subtitle { 
    color: #7f8c8d; 
    font-size: 15px; 
    margin: 0; 
    font-weight: 600;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

input[type="number"], select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    background-color: #f8fafc;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Nunito', sans-serif;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

input[type="number"] { text-align: center; font-size: 20px; }

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: #4a90e2;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.1);
}

button {
    width: 100%;
    padding: 16px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.3s;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

button:hover { 
    background-color: #357abd; 
    transform: translateY(-2px);
}

button:active {
    transform: translateY(1px);
}

.result-box {
    margin-top: 30px;
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-title {
    font-size: 16px;
    font-weight: 800;
    color: #95a5a6;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- TAMPILAN PAPAN HITUNG (KHUSUS ANGKA) --- */
.math-board-wrapper {
    background-color: #fffde7; /* Warna kuning pucat ala kertas memo */
    border: 2px solid #ffe082;
    border-radius: 12px;
    padding: 25px 20px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.02);
    /* Motif garis buku tulis */
    background-image: repeating-linear-gradient(transparent, transparent 31px, #ffecb3 31px, #ffecb3 32px);
}

.math-board {
    /* FONT KHUSUS ANGKA AGAR SEJAJAR */
    font-family: 'Roboto Mono', monospace;
    font-size: 28px; /* Angka diperbesar agar sangat jelas */
    font-weight: 700;
    color: #1a252f;
    text-align: right;
    letter-spacing: 8px; /* Jarak antar angka dilonggarkan */
    line-height: 32px; /* Disesuaikan dengan motif garis buku */
}

.border-bottom {
    border-bottom: 3px solid #34495e; /* Garis bawah yang lebih tegas */
    position: relative;
}

.operator-symbol {
    position: absolute;
    bottom: 0px;
    left: 10px;
    color: #e74c3c; /* Operator warna merah terang */
    font-weight: 800;
}

.carry-text {
    color: #e74c3c;
    font-size: 16px; /* Angka simpanan sedikit lebih kecil */
    font-weight: 600;
}

/* --- TAMPILAN PENJELASAN (TEKS) --- */
.explanation {
    background-color: #f8fafc;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    padding: 15px 20px;
    font-size: 15px;
    line-height: 1.6;
    color: #34495e;
}

.step-item { 
    margin-bottom: 12px; 
    padding-bottom: 12px;
    border-bottom: 1px dashed #dcdde1;
}

.step-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.highlight { 
    color: #e74c3c; /* Warna merah penegas */
    font-weight: 800; 
    background-color: #fad390; /* Stabilo kuning */
    padding: 2px 6px;
    border-radius: 4px;
}
/* --- DESAIN MENU DROPDOWN --- */
.dropdown-container {
    position: relative;
    max-width: 500px;
    margin: 10px auto 20px auto;
    z-index: 999;
}

.menu-toggle-btn {
    width: 100%;
    padding: 16px 20px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 800;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
    transition: background-color 0.2s;
}

.menu-toggle-btn:active { transform: scale(0.98); }

.dropdown-menu {
    display: none; /* Disembunyikan dulu */
    flex-direction: column;
    background-color: #ffffff;
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    overflow: hidden;
    border: 1px solid #e1e8ed;
    
    /* Agar bisa menumpuk di atas konten di bawahnya */
    position: absolute; 
    width: 100%;
}

.dropdown-menu.show { display: flex; } /* Class pemicu menu terbuka */

.dropdown-menu .tab-btn {
    border-radius: 0;
    margin: 0;
    border: none;
    border-bottom: 1px solid #f1f3f4;
    padding: 16px 20px;
    text-align: left;
    background-color: transparent;
    color: #333;
    font-size: 15px;
    justify-content: flex-start;
}

.dropdown-menu .tab-btn:last-child { border-bottom: none; }
.dropdown-menu .tab-btn.active { background-color: #e8f0fe; color: #1a73e8; font-weight: 800; }

/* Dukungan Dark Mode untuk Menu */
body.dark-mode .dropdown-menu { background-color: #1e1e1e; border-color: #333; box-shadow: 0 8px 25px rgba(0,0,0,0.6); }
body.dark-mode .dropdown-menu .tab-btn { border-bottom: 1px solid #333; color: #e0e0e0; }
body.dark-mode .dropdown-menu .tab-btn.active { background-color: #2a2a2a; color: #63b3ed; }


.tab-btn {
    flex: 0 0 auto;             /* Mencegah tombol menyusut/gepeng */
    /* ... (biarkan properti warna/border/padding yang lama tetap ada) ... */
    padding: 15px;
    background-color: transparent;
    color: #95a5a6;
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: none; /* Menimpa efek shadow dari tombol utama */
    transition: all 0.3s ease;
}

.tab-btn.active {
    background-color: #4a90e2;
    color: white;
}

.tab-btn:hover:not(.active) {
    background-color: #f8fafc;
    transform: none; /* Mematikan efek loncat saat dihover */
}

/* Logika Menyembunyikan Kontainer */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}
/* --- DESAIN KALKULATOR SAINTIFIK 7-KOLOM --- */
.calculator-grid-sci {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    background-color: #f8fafc;
    padding: 12px 8px;
    border-radius: 16px;
    border: 2px solid #e1e8ed;
}

.calc-screen {
    grid-column: span 7;
    background-color: #ffffff;
    color: #202124;
    font-family: 'Roboto Mono', monospace;
    font-size: 32px;
    text-align: right;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #dadce0;
    margin-bottom: 8px;
    overflow-x: auto;
    white-space: nowrap;
    min-height: 45px;
}

.calc-btn {
    padding: 12px 0;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    border: none;
    border-radius: 20px; /* Tombol membulat khas Google */
    background-color: #f1f3f4;
    color: #3c4043;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 0.2s, transform 0.1s;
}

.calc-btn:active {
    transform: scale(0.95);
}

/* Tombol Fungsi Saintifik (Biru Muda Soft) */
.btn-sci, .btn-mode {
    background-color: #e8f0fe;
    color: #1a73e8;
}

/* Mode Aktif (Deg/Rad) */
.btn-mode {
    font-weight: 800;
}

/* Tombol Operator (+, -, x, ÷) */
.btn-operator {
    background-color: #e8f0fe;
    color: #1a73e8;
    font-size: 16px;
}

.btn-clear {
    background-color: #fce8e6;
    color: #d93025;
}

/* Tombol Sama Dengan (=) Biru Pekat */
.btn-equal {
    background-color: #1a73e8;
    color: white;
    font-size: 18px;
}
/* --- TEMA DARK MODE --- */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode .container {
    background-color: #1e1e1e;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

body.dark-mode h2 { color: #ffffff; }
body.dark-mode p.subtitle { color: #a0a0a0; }

body.dark-mode .tab-menu { background-color: #1e1e1e; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
body.dark-mode .tab-btn { color: #a0a0a0; }
body.dark-mode .tab-btn.active { background-color: #4a90e2; color: white; }
body.dark-mode .tab-btn:hover:not(.active) { background-color: #2a2a2a; }

body.dark-mode input[type="number"], 
body.dark-mode select {
    background-color: #2a2a2a;
    border-color: #444;
    color: #ffffff;
}

body.dark-mode .math-board-wrapper {
    background-color: #262626;
    border-color: #444;
    background-image: repeating-linear-gradient(transparent, transparent 31px, #333 31px, #333 32px);
}
body.dark-mode .math-board { color: #e0e0e0; }
body.dark-mode .border-bottom { border-bottom-color: #555; }

body.dark-mode .explanation {
    background-color: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}
body.dark-mode .step-item { border-bottom-color: #444; }
body.dark-mode .highlight { background-color: #4a90e2; color: white; }

/* Dark Mode untuk Kalkulator Saintifik */
body.dark-mode .calculator-grid-sci { background-color: #1e1e1e; border-color: #444; }
body.dark-mode .calc-screen { background-color: #121212; color: #ffffff; border-color: #333; }
body.dark-mode .calc-btn { background-color: #2a2a2a; color: #e0e0e0; }
body.dark-mode .btn-sci, 
body.dark-mode .btn-mode, 
body.dark-mode .btn-operator { background-color: #2d3748; color: #63b3ed; }
body.dark-mode .btn-clear { background-color: #4a1c1c; color: #fc8181; }
body.dark-mode .btn-equal { background-color: #3182ce; color: white; }

/* --- ANIMASI KUIS --- */
@keyframes popBenar {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shakeSalah {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

.anim-pop { animation: popBenar 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; color: #27ae60 !important; }
.anim-shake { animation: shakeSalah 0.4s ease forwards; color: #e74c3c !important; }

/* --- FAB DARK MODE (Kanan Bawah) --- */
.fab-darkmode {
    position: fixed;
    bottom: 20px;
    right: 20px; /* <-- UBAH left MENJADI right DI SINI */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 2px solid #e1e8ed;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: transform 0.2s, background-color 0.3s;
}

.fab-darkmode:hover { transform: scale(1.1); }
body.dark-mode .fab-darkmode { background-color: #2a2a2a; border-color: #444; }

/* Dukungan Kuis untuk Dark Mode */
body.dark-mode #teksSoal { 
    color: #ffffff !important; /* <-- TAMBAHKAN !important AGAR TERANG */
    text-shadow: 0 2px 4px rgba(0,0,0,0.5); /* Tambahan bayangan agar teks lebih tegas */
}
/* --- FAB DOWNLOAD PNG (Kiri Bawah) --- */
.fab-download {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 2px solid #e1e8ed;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: transform 0.2s, background-color 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fab-download:hover { transform: scale(1.1); }
body.dark-mode .fab-download { background-color: #2a2a2a; border-color: #444; }
/* --- DESAIN BUKU MATERI (ACCORDION) --- */
.materi-btn {
    background-color: #f1f3f4;
    color: #1a73e8;
    cursor: pointer;
    padding: 15px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 16px;
    font-weight: 800;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: 0.3s;
    display: flex;
    justify-content: space-between;
}

.materi-btn:hover, .materi-btn.active {
    background-color: #e8f0fe;
}

.materi-btn::after {
    content: '▼';
    font-size: 14px;
    color: #1a73e8;
    transition: 0.3s transform;
}
.materi-btn.active::after { transform: rotate(-180deg); }

.materi-panel {
    padding: 0 15px;
    background-color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    border-radius: 0 0 8px 8px;
    margin-bottom: 10px;
}

/* Dukungan Dark Mode untuk Materi */
body.dark-mode .dropdown-menu div[style*="border-top"] { border-color: #333 !important; }
body.dark-mode .materi-btn { background-color: #2a2a2a; color: #63b3ed; }
body.dark-mode .materi-btn:hover, body.dark-mode .materi-btn.active { background-color: #1e1e1e; }
body.dark-mode .materi-panel { background-color: #1e1e1e; color: #e0e0e0; }
body.dark-mode .materi-panel hr { border-color: #444 !important; }
