/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: white;
    opacity: 0.8;
}

footer a {
    color: #4fd1c7;
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* Sections */
section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2d3748;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #4fd1c7;
    color: white;
}

.btn-secondary:hover {
    background: #38b2ac;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid #e2e8f0;
    color: #4a5568;
}

.btn-outline:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

/* Meal Grid */
.meal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.day-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.day-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.day-card h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 600;
}

.meal-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.meal-option {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.meal-option:hover {
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

.meal-option.selected {
    border-color: #4fd1c7;
    background: #f0fdfa;
    box-shadow: 0 0 0 1px rgba(79, 209, 199, 0.1);
}

.meal-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.select-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #4a5568;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.select-btn.selected {
    background: #4fd1c7;
    border-color: #4fd1c7;
    color: white;
}

.meal-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.meal-item:last-child {
    margin-bottom: 0;
}

.meal-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.meal-ingredients {
    font-size: 0.9rem;
    color: #718096;
}

.no-meal {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Shopping List */
.shopping-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.shopping-items {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
}

.shopping-category {
    margin-bottom: 25px;
}

.shopping-category h4 {
    color: #2d3748;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e2e8f0;
}

.ingredient-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.ingredient-item {
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #4fd1c7;
    font-size: 0.95rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.empty-state {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    margin-top: 50px;
}

/* Meals Management */
.meals-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.meal-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.meal-card:hover {
    border-color: #4fd1c7;
}

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

.meal-card h4 {
    color: #2d3748;
    font-size: 1.2rem;
    font-weight: 600;
}

.meal-card-ingredients {
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.5;
}

.meal-card-ingredients ul {
    list-style: none;
    padding-left: 0;
}

.meal-card-ingredients li {
    padding: 2px 0;
    padding-left: 15px;
    position: relative;
}

.meal-card-ingredients li::before {
    content: '•';
    color: #4fd1c7;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 600;
}

.close {
    color: #a0aec0;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #718096;
}

.modal form {
    padding: 25px 30px 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2d3748;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .meal-grid {
        grid-template-columns: 1fr;
    }
    
    .meals-list {
        grid-template-columns: 1fr;
    }
    
    .ingredient-list {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* Print styles for shopping list */
@media print {
    body * {
        visibility: hidden;
    }
    
    .shopping-list,
    .shopping-list * {
        visibility: visible;
    }
    
    .shopping-list {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
        box-shadow: none;
        padding: 20px;
    }
    
    .section-header button {
        display: none;
    }
}
