/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

/* === Header & Progress === */
header {
    text-align: center;
    margin-bottom: 32px;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #2d3436;
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.progress-step {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ddd;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.progress-step.active {
    background: #6c5ce7;
    color: #fff;
}

.progress-step.done {
    background: #00b894;
    color: #fff;
}

.progress-line {
    width: 40px;
    height: 3px;
    background: #ddd;
}

/* === Steps === */
.step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: #2d3436;
}

.step-hint {
    color: #636e72;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* === Form Elements === */
textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: #6c5ce7;
}

select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

/* === Counter === */
.counter {
    display: flex;
    align-items: center;
    gap: 16px;
}

.counter span {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}

.btn-counter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Checkboxes === */
.checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #6c5ce7;
}

/* === Buttons === */
.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: #6c5ce7;
    color: #fff;
    margin-top: 20px;
}

.btn-primary:hover {
    background: #5a4bd1;
}

.btn-secondary {
    background: #fff;
    color: #6c5ce7;
    border: 2px solid #6c5ce7;
    margin-top: 20px;
}

.btn-secondary:hover {
    background: #f0edff;
}

.btn-text {
    background: none;
    color: #636e72;
    text-decoration: underline;
    padding: 8px;
    margin-top: 20px;
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.1rem;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn-danger {
    background: #ff7675;
    color: #fff;
}

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

/* === Loading === */
.loading-container {
    text-align: center;
    padding: 60px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #ddd;
    border-top-color: #6c5ce7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

.spinner-small {
    width: 24px;
    height: 24px;
    border: 3px solid #ddd;
    border-top-color: #6c5ce7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 10px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    text-align: center;
    padding: 20px;
    color: #d63031;
}

/* === Tabs === */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #ddd;
}

.tab {
    padding: 10px 24px;
    cursor: pointer;
    font-weight: 600;
    color: #636e72;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab:hover {
    color: #6c5ce7;
}

.tab.active {
    color: #6c5ce7;
    border-bottom-color: #6c5ce7;
}

/* === Meal Cards === */
.meals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.meal-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s;
}

.meal-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.meal-card-day {
    font-size: 0.8rem;
    color: #6c5ce7;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.meal-card-name {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #2d3436;
}

.meal-card-desc {
    font-size: 0.85rem;
    color: #636e72;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meal-card-meta {
    font-size: 0.8rem;
    color: #b2bec3;
    margin-bottom: 10px;
}

.meal-card-actions {
    display: flex;
    gap: 8px;
}

.meal-card-actions .btn {
    margin-top: 0;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    max-width: 560px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #636e72;
}

.modal h3 {
    margin-bottom: 12px;
    padding-right: 30px;
}

.modal-section {
    margin-top: 16px;
}

.modal-section h4 {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: #6c5ce7;
}

.modal-section ul,
.modal-section ol {
    padding-left: 20px;
}

.modal-section li {
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.modal-meta {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #636e72;
}

/* === Export === */
.export-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

/* === Day labels === */
.day-label {
    grid-column: 1 / -1;
    font-weight: 700;
    font-size: 1rem;
    color: #2d3436;
    margin-top: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

/* === Responsive === */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    .meals-grid {
        grid-template-columns: 1fr;
    }

    .export-buttons {
        flex-direction: column;
        align-items: center;
    }

    .modal {
        width: 95%;
        padding: 20px;
    }

    .tabs {
        overflow-x: auto;
    }
}
