:root {
    --primary: #ff6b6b;
    --primary-hover: #fa5252;
    --dark: #2c3e50;
    --text-grey: #636e72;
    --light: #f8f9fa;
    --white: #ffffff;
    --shadow: 0 10px 20px rgba(0,0,0,0.05);
    --radius: 12px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--light);
    margin: 0;
    color: var(--dark);
    line-height: 1.6;
}

/* --- HEADER --- */
header {
    background: var(--white);
    padding: 1.2rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo { 
    font-size: 1.6rem; 
    font-weight: 700; 
    color: var(--primary);
    letter-spacing: -0.5px;
}

#menu-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
    padding: 5px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

.btn-primary:hover { 
    background: var(--primary-hover); 
    transform: translateY(-2px);
}

/* --- LAYOUT --- */
.main-container {
    display: flex;
    padding: 3rem 5%;
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 280px;
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    height: fit-content;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.02);
}

.sidebar h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--dark);
}

.sidebar label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.sidebar input[type="text"], .sidebar select {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    background: #fdfdfd;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border 0.3s;
}

.sidebar input:focus, .sidebar select:focus {
    outline: none;
    border-color: var(--primary);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 1rem;
}

/* --- RECIPE GRID --- */
#recipe-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* --- RECIPE CARD --- */
.recipe-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.02);
}

.recipe-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.card-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background-color: #eee;
}

.card-content { 
    padding: 1.8rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.card-header h3 { 
    margin: 0; 
    font-size: 1.4rem; 
    line-height: 1.3;
}

.fa-heart { 
    cursor: pointer; 
    color: #dfe6e9; 
    font-size: 1.4rem;
    transition: color 0.2s; 
}
.fa-heart.active { color: var(--primary); }

.category-tag {
    display: inline-block;
    background: #fff0f0;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.portion-control {
    background: #f1f3f5;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 15px 0 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text-grey);
}

.portion-control input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
}

h4 { margin-bottom: 10px; color: var(--dark); }

.ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-grey);
}

.ingredients-list li { 
    border-bottom: 1px solid #f1f1f1; 
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
}

.ing-amount { 
    font-weight: bold; 
    color: var(--dark); 
}

/* --- MODAL --- */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}
.hidden { display: none; }

.modal-content {
    background: var(--white);
    padding: 2.5rem;
    width: 90%;
    max-width: 550px;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

.close-btn {
    position: absolute; top: 20px; right: 25px;
    font-size: 1.8rem; cursor: pointer; color: var(--text-grey);
}

.form-row { display: flex; gap: 15px; }
input, textarea, select {
    width: 100%; 
    padding: 12px; 
    margin-bottom: 15px;
    border: 1px solid #ddd; 
    border-radius: 8px; 
    box-sizing: border-box;
    font-family: inherit;
}
textarea { height: 100px; resize: vertical; }

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    #menu-btn { display: block; }
    
    .main-container {
        flex-direction: column;
        padding: 1.5rem;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 200;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    .sidebar.active { left: 0; }

    .overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 150;
    }
    .overlay.active { display: block; }

    #recipe-container {
        grid-template-columns: 1fr; 
    }
    
    .modal-content {
        padding: 1.5rem;
        max-height: 85vh;
        overflow-y: auto;
    }

    header { padding: 1rem; }
}