:root {
    --primary-color: #ff6f61;
    --secondary-color: #2c3e50;
    --background-color: #f9f9f9;
    --card-bg-color: #ffffff;
    --text-color: #333;
    --light-text-color: #777;
    --shadow: 0 10px 20px rgba(0,0,0,0.1);
    --border-radius: 12px;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html {
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.hidden { 
    display: none !important; 
}

/* Header Section */
.header { 
    text-align: center; 
    margin-bottom: 3rem; 
}
.header h1 { 
    font-size: 3rem; 
    color: var(--secondary-color); 
    margin-bottom: 0.5rem; 
}
.header h1 span { 
    color: var(--primary-color); 
}
.header p { 
    font-size: 1.1rem; 
    color: var(--light-text-color); 
}

/* Quiz Section */
#quiz-container {
    background-color: var(--card-bg-color);
    padding: 2rem 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.quiz-step h2 {
    font-size: 1.8rem;
    color: var(--secondary-color);
    margin-bottom: 2rem;
}
.options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}
.option-btn {
    padding: 1.5rem 1rem;
    background-color: #f0f0f0;
    color: var(--secondary-color);
    border: 2px solid #eee;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.option-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-5px);
}

/* Ingredient input style */
.ingredient-input-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
}
#ingredient-input {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}
#find-recipes-btn {
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Main Content Section */
#start-over-btn {
    display: block;
    margin: 0 auto 3rem;
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}
#start-over-btn:hover {
    background-color: #e65a4f;
    transform: translateY(-2px);
}

/* Results Section */
#results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}
#message-container { 
    text-align: center; 
    font-size: 1.2rem; 
    color: var(--light-text-color); 
    margin-top: 2rem; 
    margin-bottom: 2rem; 
}
.recipe-card {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}
.recipe-card:hover { 
    transform: translateY(-10px); 
    box-shadow: 0 15px 30px rgba(0,0,0,0.15); 
}
.recipe-card img { 
    width: 100%; 
    height: 200px; 
    object-fit: cover; 
}
.recipe-card-content { 
    padding: 1.5rem; 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
}
.recipe-card-content h3 { 
    font-size: 1.25rem; 
    color: var(--secondary-color); 
    margin-bottom: auto; 
}

/* Modal Styling */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0, 0, 0, 0.7); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.3s, visibility 0.3s; 
    z-index: 1000; 
}
.modal-overlay.show { 
    opacity: 1; 
    visibility: visible; 
}
.modal-container { 
    background: var(--card-bg-color); 
    padding: 2.5rem; 
    border-radius: var(--border-radius); 
    width: 90%; 
    max-width: 700px; 
    max-height: 90vh; 
    overflow-y: auto; 
    position: relative; 
    transform: scale(0.9); 
    transition: transform 0.3s; 
}
.modal-overlay.show .modal-container { 
    transform: scale(1); 
}
#modal-close-btn { 
    position: absolute; 
    top: 1.5rem; 
    right: 1.5rem; 
    background: none; 
    border: none; 
    font-size: 2rem; 
    cursor: pointer; 
    color: var(--light-text-color); 
    transition: color 0.3s; 
}
#modal-close-btn:hover { 
    color: var(--primary-color); 
}
#modal-content h2 { 
    font-size: 2rem; 
    color: var(--secondary-color); 
    margin-bottom: 1rem; 
}
#modal-content h3 { 
    font-size: 1.2rem; 
    color: var(--primary-color); 
    margin-top: 1.5rem; 
    margin-bottom: 0.5rem; 
    border-bottom: 2px solid #eee; 
    padding-bottom: 0.5rem; 
}
#modal-content ul { 
    list-style-position: inside; 
    padding-left: 0; 
}
#modal-content li { 
    margin-bottom: 0.5rem; 
}
#modal-content p { 
    white-space: pre-wrap; 
    line-height: 1.8; 
    margin-bottom: 1.5rem; 
}
#modal-content a { 
    display: inline-block; 
    margin-top: 1rem; 
    padding: 0.75rem 1.5rem; 
    background-color: var(--primary-color); 
    color: white; 
    text-decoration: none; 
    border-radius: var(--border-radius); 
    transition: background-color 0.3s; 
}
#modal-content a:hover { 
    background-color: #e65a4f; 
}

/* Footer Styling */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--light-text-color);
    width: 100%;
}
footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .header h1 { 
        font-size: 2.5rem; 
    }
    .ingredient-input-container {
        flex-direction: column;
    }
    #ingredient-input {
        max-width: 100%;
    }
}

@media (min-width: 992px) {
    .options-container {
        grid-template-columns: repeat(4, 1fr);
    }
}
