/* --- VARIABLES & RESET --- */
:root {
    --font-family: 'Poppins', sans-serif;
    --primary-color: #20c997; /* Teal */
    --primary-color-dark: #1baa80;
    --background-color: #f8f9fa;
    --text-color: #343a40;
    --card-background: #ffffff;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --shadow-color-hover: rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 2rem;
}

/* --- MAIN CONTAINER & HEADER --- */
.container {
    width: 100%;
    max-width: 800px;
    text-align: center;
}

header {
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

header p {
    font-size: 1.1rem;
    color: #6c757d;
}

/* --- ZIP CODE INPUT --- */
.zip-code-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

#zip-code-input {
    font-family: var(--font-family);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    width: 250px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#zip-code-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.2);
}

#submit-zip-code {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

#submit-zip-code:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-color-hover);
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* --- RESULTS & CARDS --- */
.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    text-align: left;
}

.card {
    background-color: var(--card-background);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 25px var(--shadow-color);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px var(--shadow-color-hover);
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.card h2 .material-symbols-outlined {
    color: var(--primary-color);
}

.card p {
    font-size: 1rem;
    color: #495057;
}


#meal-recommendations-container {
    grid-column: 1 / -1;
}

#meal-recommendations {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.meal-item {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 25px var(--shadow-color);
    border: 1px solid var(--border-color);
    text-align: left;
    width: 220px;
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.meal-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px var(--shadow-color-hover);
}

.meal-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.meal-item .meal-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

.view-recipe-btn {
    font-family: var(--font-family);
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: auto; /* Pushes button to the bottom */
    align-self: flex-start; /* Aligns button to the left */
}

.view-recipe-btn:hover {
    background-color: var(--primary-color-dark);
}

.meal-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.meal-details h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.meal-details .recipe-text {
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.ingredients-list {
    list-style: none;
    padding: 0;
}

.ingredients-list li {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.ingredients-list li span:last-child {
    font-weight: 500;
    color: var(--text-color);
}

.meal-item-placeholder p {
    font-size: 1rem;
    color: #495057;
    text-align: center;
    width: 100%;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    #meal-recommendations {
        gap: 1rem;
    }
    .meal-item {
        width: calc(50% - 0.5rem);
    }
}

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .zip-code-container {
        flex-direction: column;
        align-items: stretch;
    }

    #zip-code-input {
        width: 100%;
    }

    .meal-item {
        width: 100%;
    }
}