/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Base styles */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f2f5; /* Latar belakang terang yang lebih lembut */
    color: #333;
    transition: background-color 0.5s ease, color 0.5s ease;
    line-height: 1.6;
}

.container {
    background-color: #ffffff;
    border-radius: 15px; /* Sudut lebih bulat */
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08); /* Bayangan yang lebih halus dan modern */
    transition: background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

h1 {
    color: #2c3e50; /* Warna judul utama yang lebih elegan */
    font-weight: 600;
}

h2 {
    color: #34495e; /* Warna sub-judul */
    font-weight: 600;
}

/* Form elements styling */
.form-label {
    font-weight: 500;
    color: #555;
    margin-bottom: 0.5rem;
}

.custom-input,
.custom-select {
    border-radius: 8px;
    border: 1px solid #dce4f0;
    padding: 0.85rem 1.1rem; /* Padding sedikit lebih besar */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fdfdff;
}

.custom-input::placeholder {
    color: #a0aec0; /* Warna placeholder yang lebih lembut */
}

.custom-input:focus,
.custom-select:focus {
    border-color: #7b68ee; /* Warna fokus ungu yang lembut */
    box-shadow: 0 0 0 0.2rem rgba(123, 104, 238, 0.2);
    outline: none;
}

/* Button styling */
.custom-btn {
    background: linear-gradient(45deg, #7b68ee, #5d4ae0); /* Gradien untuk tombol utama */
    border: none;
    color: white;
    padding: 0.85rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(123, 104, 238, 0.3);
}

.custom-btn:hover {
    background: linear-gradient(45deg, #6a5acd, #4c39cf);
    transform: translateY(-3px); /* Efek angkat saat hover */
    box-shadow: 0 6px 16px rgba(123, 104, 238, 0.4);
}

#toggleDarkMode { /* Tombol Dark Mode */
    border-radius: 8px;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    border-width: 1px;
}

/* Menggunakan style Bootstrap outline untuk light mode */
body:not(.dark-mode) #toggleDarkMode {
    border-color: #7b68ee;
    color: #7b68ee;
}
body:not(.dark-mode) #toggleDarkMode:hover {
    background-color: #7b68ee;
    color: white;
}


/* Result display styling & animation */
.result-hidden { /* */
    opacity: 0;
    transform: translateY(25px);
    height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, height 0.6s ease-out, margin-top 0.6s ease-out;
}

.result-visible { /* */
    opacity: 1;
    transform: translateY(0);
    height: auto;
    visibility: visible;
    margin-top: 2.5rem !important; /* Spasi yang lebih jelas untuk hasil */
}

#result h2 {
    color: #7b68ee; /* Warna ungu untuk judul hasil */
    margin-bottom: 1rem;
}

.calories-value { /* */
    font-weight: 700;
    font-size: 1.75em; /* Ukuran font lebih besar untuk hasil kalori */
    color: #2ecc71; /* Warna hijau untuk nilai kalori */
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #171c28; /* Latar belakang gelap yang lebih kaya */
    color: #c8cde0;
}

body.dark-mode .container {
    background-color: #202738; /* Warna kontainer gelap */
    border: 1px solid #2a3145;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

body.dark-mode h1 {
    color: #e0e7ff;
}
body.dark-mode h2 {
    color: #d0d9f0;
}

body.dark-mode .form-label {
    color: #a0aec0;
}

body.dark-mode .custom-input,
body.dark-mode .custom-select {
    background-color: #252c3f;
    border-color: #3b435e;
    color: #e0e7ff;
}

body.dark-mode .custom-input::placeholder {
    color: #6a738f;
}

body.dark-mode .custom-input:focus,
body.dark-mode .custom-select:focus {
    border-color: #bb86fc; /* Aksen ungu terang untuk dark mode */
    box-shadow: 0 0 0 0.2rem rgba(187, 134, 252, 0.2);
}

body.dark-mode .custom-btn { /* Tombol utama di dark mode */
    background: linear-gradient(45deg, #bb86fc, #9a67f8);
    box-shadow: 0 4px 12px rgba(187, 134, 252, 0.25);
    color: #121212; /* Teks gelap agar kontras dengan tombol ungu terang */
}

body.dark-mode .custom-btn:hover {
    background: linear-gradient(45deg, #a062f8, #894ef6);
    box-shadow: 0 6px 16px rgba(187, 134, 252, 0.35);
}

body.dark-mode #toggleDarkMode { /* Tombol Dark Mode di dark mode */
    background-color: #384059;
    border-color: #bb86fc;
    color: #bb86fc;
}

body.dark-mode #toggleDarkMode:hover {
    background-color: #bb86fc;
    border-color: #bb86fc;
    color: #121212;
}

body.dark-mode #result h2 {
    color: #bb86fc; /* Aksen ungu terang untuk judul hasil di dark mode */
}

body.dark-mode .calories-value {
    color: #66bb6a; /* Hijau yang lebih terang untuk nilai kalori di dark mode */
}

/* Dark Mode Wipe Animation (dari CSS asli pengguna, dengan transisi yang disesuaikan) */ /* */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%; 
    height: 100%;
    background-color: #1f2023; /* Warna tirai wipe yang netral */
    z-index: 9999;
    pointer-events: none;
    transform: translateX(-100%); /* Mulai dari luar layar kiri */
    transition: transform 0.7s cubic-bezier(0.65, 0.05, 0.36, 1); /* Transisi yang lebih halus */
}

body.dark-mode-active::before { /* */
    transform: translateX(0%); /* Tirai masuk menutupi layar */
}

/* Footer styling */
footer {
    padding: 2rem 0;
    opacity: 0.8;
}

footer p { /* */
    color: #6c757d; 
    font-size: 0.9rem;
    transition: color 0.3s ease-in-out;
}

body.dark-mode footer p { /* */
    color: #888da8; /* Warna teks footer yang diredam untuk dark mode */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        margin-top: 1.5rem;
        padding: 1.5rem;
        border-radius: 10px;
    }
    h1 {
        font-size: 1.75rem;
    }
    .custom-btn {
        width: 80%;
        padding: 0.8rem 1rem;
    }
}