/* --- Root Variables & Reset --- */
:root {
    --primary: #3d2b1f; 
    --secondary: #634832; 
    --accent-orange: #e67e22; 
    --bg-light: #fdfaf7; 
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

* { 
    margin: 0; padding: 0; 
    box-sizing: border-box; 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    -webkit-tap-highlight-color: transparent;
}

body { 
    background-color: var(--bg-light); 
    color: var(--primary); 
    padding-bottom: 50px; 
}

/* --- 1. HEADER (Diperbaiki agar tidak terpotong) --- */
.app-header {
    background: linear-gradient(135deg, var(--primary), #634832);
    color: white; 
    /* Padding atas ditambah agar tidak mepet browser */
    padding: 3rem 1rem 2rem 1rem; 
    text-align: center;
    border-bottom-left-radius: 30px; 
    border-bottom-right-radius: 30px;
    box-shadow: var(--shadow); 
    margin-bottom: 30px; /* Jarak normal ke search bar */
    width: 100%;
}

.app-header h1 { 
    font-size: 1.6rem; 
    margin-bottom: 8px; 
    font-weight: 800; 
}

.header-contact {
    font-size: 0.9rem; 
    opacity: 0.9; 
    font-weight: 500;
}

/* --- 2. SEARCH BAR --- */
.search-wrapper {
    padding: 0 20px;
    margin-bottom: 30px;
}

.search-container {
    max-width: 600px;
    margin: 0 auto; /* Posisi Center */
    text-align: center;
}

#searchInput {
    width: 100%;
    padding: 16px 24px;
    border-radius: 50px;
    border: 2px solid #eee;
    background: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    font-size: 16px;
    outline: none;
    margin-bottom: 15px;
    transition: 0.3s;
}

#searchInput:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.2);
}

.category-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 8px 18px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    transition: 0.2s;
}

.btn-filter:hover { background: #f5f5f5; }
.btn-filter.active {
    background: var(--accent-orange);
    color: white;
    border-color: var(--accent-orange);
}

/* --- 3. CONTAINER GRID --- */
.container { 
    padding: 0 20px; 
    max-width: 900px; /* Lebar maksimal konten */
    margin: 0 auto; /* PENTING: Agar konten di tengah */
}

.resep-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); /* Responsif otomatis */
    gap: 20px;
    justify-content: center;
}

/* Responsif untuk Tablet/Desktop agar lebih lebar */
@media (min-width: 600px) {
    .resep-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* --- 4. KARTU RESEP --- */
.resep-card {
    background: white; 
    border-radius: 16px;
    overflow: hidden; 
    box-shadow: var(--shadow);
    display: flex; 
    flex-direction: column;
    transition: transform 0.2s;
    border: 1px solid #f0f0f0;
}
.resep-card:hover { transform: translateY(-3px); }

.card-image { height: 160px; background: #eee; position: relative; }
.card-image img { width: 100%; height: 100%; object-fit: cover; }

.badge-harga {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,0.7); 
    color: white;
    padding: 4px 10px; border-radius: 8px;
    font-size: 0.7rem; font-weight: 700;
}

/* --- TAMBAHKAN BAGIAN INI --- */

.card-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-info h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: var(--primary);
    
    /* INI YANG MEMBUAT RATA TENGAH */
    text-align: center;
    font-weight: 800;
}

/* --------------------------- */

/* --- GANTI BAGIAN INI DI STYLE.CSS --- */

.card-info p { 
    font-size: 0.85rem; 
    color: #666; 
    margin-bottom: 15px; 
    
    /* AGAR KARTU RATA & BISA SCROLL */
    height: 80px;        /* Tinggi tetap untuk area teks */
    overflow-y: auto;    /* Munculkan scroll jika teks kepanjangan */
    display: block;      /* Pastikan blok normal */
    line-height: 1.5;    /* Jarak antar baris enak dibaca */
    padding: 0 8px;  /* Memberi jarak 8px di kiri dan kanan */
}

/* --- TAMBAHAN: MEMPERCANTIK SCROLLBAR (Opsional biar rapi) --- */
.card-info p::-webkit-scrollbar {
    width: 4px; /* Scrollbar tipis */
}
.card-info p::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
.card-info p::-webkit-scrollbar-thumb {
    background: #ccc; 
    border-radius: 4px;
}
.card-info p::-webkit-scrollbar-thumb:hover {
    background: #aaa; 
}
.card-info button {
    background: var(--primary); color: white; border: none; 
    padding: 12px; border-radius: 10px; font-size: 0.85rem; 
    font-weight: 700; width: 100%; cursor: pointer;
}

/* --- 5. MODAL / POPUP --- */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(2px);
}
.modal-content {
    position: relative; background: white;
    width: 100%; max-width: 500px; max-height: 90vh; 
    display: flex; flex-direction: column; 
    border-radius: 20px; overflow: hidden;
}
.modal-header {
    padding: 15px 20px; border-bottom: 1px solid #eee;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { font-size: 1.1rem; color: var(--primary); }
.close-btn {
    background: #f5f5f5; border: none; width: 30px; height: 30px;
    border-radius: 50%; font-size: 1.2rem; cursor: pointer;
}
.modal-body {
    padding: 20px; overflow-y: auto; flex: 1;
}

/* Style Bahan & Cara */
.bahan-list { list-style: none; margin-bottom: 20px; }
.bahan-list li { 
    padding: 8px 0; border-bottom: 1px dashed #eee; font-size: 0.9rem; 
    display: flex; align-items: flex-start; 
}
.bahan-list li::before { content: "•"; color: var(--accent-orange); margin-right: 10px; font-weight: bold; }
.btn-youtube {
    display: block; width: 100%; padding: 15px;
    background: #cc0000; color: white; text-align: center;
    border-radius: 12px; font-weight: bold; text-decoration: none;
    margin-bottom: 20px;
}
.hidden { display: none !important; }
