/* ============================================
   MealWeek — Sunny Theme (feliz, cálido, vivo)
   Mobile-first, responsive
   ============================================ */

:root {
    --bg-page: #FFF9F0;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FFF3E6;
    --bg-input: #FFF9F0;
    --border: #F0E4D0;
    --text-primary: #3D2E1E;
    --text-secondary: #7A6552;
    --text-muted: #B5A48F;
    --accent: #FF7043;
    --accent-light: #FFAB91;
    --accent-dark: #E64A19;
    --highlight: #FFD54F;
    --highlight-light: #FFECB3;
    --success: #66BB6A;
    --success-light: #C8E6C9;
    --error: #EF5350;
    --info: #42A5F5;
    --info-light: #BBDEFB;
    --shadow: rgba(120, 80, 30, 0.08);
    --shadow-strong: rgba(120, 80, 30, 0.16);

    --font-ui: 'Nunito', 'Quicksand', system-ui, -apple-system, sans-serif;
    --font-dish: 'Nunito', Georgia, serif;

    --radius-card: 20px;
    --radius-btn: 999px;
    --radius-tag: 8px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;

    --nav-height: 72px;
    --header-height: 60px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

#app {
    min-height: 100dvh;
    padding-bottom: var(--nav-height);
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    min-height: calc(100dvh - var(--nav-height));
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* ===== HEADER ===== */
.app-header {
    background: linear-gradient(135deg, #FF7043 0%, #FF8A65 100%);
    color: white;
    padding: var(--space-xl) var(--space-lg) var(--space-xl);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(255, 112, 67, 0.3);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.header-subtitle {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 2px;
    font-weight: 500;
}

.header-nav {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--nav-height);
    box-shadow: 0 -4px 20px var(--shadow);
    z-index: 1000;
    border-top: 2px solid var(--border);
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, transform 0.15s;
    border-radius: 16px;
    min-width: 64px;
}

.nav-tab.active {
    color: var(--accent);
    transform: translateY(-2px);
}

.nav-tab:active {
    transform: scale(0.92);
}

.nav-tab svg {
    transition: transform 0.2s;
}

.nav-tab.active svg {
    transform: scale(1.15);
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: var(--space-lg);
    box-shadow: 0 2px 12px var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    border: 1.5px solid var(--border);
}

.card:hover, .card:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--shadow-strong);
    background: var(--bg-card-hover);
}

/* ===== TAGS ===== */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-tag);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-halal  { background: #FFE0B2; color: #E65100; }
.tag-vegetariano { background: #C8E6C9; color: #2E7D32; }
.tag-legumbres { background: #D7CCC8; color: #5D4037; }
.tag-pasta   { background: #FFCDD2; color: #C62828; }
.tag-verdura { background: #C8E6C9; color: #388E3C; }
.tag-snack   { background: #FFF9C4; color: #F57F17; }
.tag-default { background: var(--highlight-light); color: #5D4037; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    border-radius: var(--radius-btn);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 112, 67, 0.35);
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: 0 2px 6px rgba(255, 112, 67, 0.25);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:active {
    background: var(--bg-page);
    transform: scale(0.97);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    border: none;
    color: white;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.4);
}

.icon-btn:active {
    transform: scale(0.9);
}

/* ===== PLANNER ===== */
#planner-grid {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.day-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.day-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
}

.day-emoji {
    font-size: 1.8rem;
    line-height: 1;
}

.day-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.day-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.meal-slots {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.meal-slot {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-radius: 16px;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    cursor: pointer;
    transition: all 0.2s;
    gap: var(--space-md);
}

.meal-slot.filled {
    border-style: solid;
    border-color: transparent;
    background: var(--bg-card);
    box-shadow: 0 2px 8px var(--shadow);
}

.meal-slot:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.meal-slot-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    min-width: 50px;
}

.meal-slot-dish {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.meal-slot-empty {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 500;
}

.add-meal-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-light);
    border: none;
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-weight: 700;
    transition: background 0.2s, transform 0.15s;
}

.add-meal-btn:hover { background: var(--accent); }
.add-meal-btn:active { transform: scale(0.88); }

/* ===== WEEK NAV ===== */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-md);
}

.week-nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-btn);
    background: white;
    border: 2px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-ui);
}

.week-nav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.week-label {
    font-weight: 800;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* ===== RECIPES ===== */
#recipes-grid {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.recipe-search {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-btn);
    padding: 10px 16px;
    margin-bottom: var(--space-sm);
}

.recipe-search input {
    flex: 1;
    border: none;
    background: none;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
}

.recipe-search input::placeholder {
    color: var(--text-muted);
}

.recipe-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: var(--space-lg);
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    box-shadow: 0 2px 8px var(--shadow);
}

.recipe-card:hover, .recipe-card:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-strong);
    border-color: var(--accent-light);
}

.recipe-icon {
    font-size: 2.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.recipe-info {
    flex: 1;
    min-width: 0;
}

.recipe-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.recipe-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.new-recipe-btn {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px);
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(255, 112, 67, 0.45);
    border: none;
    cursor: pointer;
    z-index: 200;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 700;
    line-height: 1;
}

.new-recipe-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(255, 112, 67, 0.5);
}

/* ===== SHOPPING ===== */
#shopping-grid {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.shopping-actions {
    display: flex;
    gap: var(--space-sm);
}

.shopping-category {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    overflow: hidden;
    border: 1.5px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
}

.shopping-cat-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card-hover);
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.shopping-item:hover { background: var(--bg-card-hover); }
.shopping-item.checked { opacity: 0.5; text-decoration: line-through; }

.shopping-check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.75rem;
}

.shopping-item.checked .shopping-check {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.shopping-qty {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent);
    min-width: 60px;
}

.shopping-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== SETTINGS ===== */
#settings-grid {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.settings-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: var(--space-lg);
    border: 1.5px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border);
    gap: var(--space-md);
}

.settings-row:last-child { border-bottom: none; }

.settings-label {
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== CLEANING SCREEN ===== */
#cleaning-grid {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.cleaning-hero {
    background: linear-gradient(135deg, #26C6DA 0%, #4DD0E1 100%);
    border-radius: var(--radius-card);
    padding: var(--space-xl);
    color: white;
    text-align: center;
    box-shadow: 0 4px 16px rgba(38, 198, 218, 0.3);
}

.cleaning-hero-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
}

.cleaning-hero h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.cleaning-hero p {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
}

.cleaning-progress-ring {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    padding: var(--space-lg);
    background: white;
    border-radius: var(--radius-card);
    box-shadow: 0 2px 12px var(--shadow);
    margin-top: var(--space-lg);
}

.progress-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(var(--success) 0% var(--pct, 0%), var(--border) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-inner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.progress-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.progress-stat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.progress-dot.done   { background: var(--success); }
.progress-dot.pending { background: var(--border); }

.cleaning-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.section-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.task-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: var(--space-md) var(--space-lg);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: var(--space-sm);
    user-select: none;
}

.task-card:hover {
    transform: translateX(4px);
    border-color: var(--accent-light);
    box-shadow: 0 4px 16px var(--shadow-strong);
}

.task-card.done {
    opacity: 0.6;
    background: var(--success-light);
    border-color: var(--success);
}

.task-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2.5px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
    background: white;
}

.task-card.done .task-check {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.task-info { flex: 1; }
.task-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.task-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.task-freq {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: var(--radius-tag);
    flex-shrink: 0;
}

.freq-diario  { background: #FFE0B2; color: #E65100; }
.freq-semanal { background: #BBDEFB; color: #1565C0; }
.freq-mensual { background: #E1BEE7; color: #6A1B9A; }

.today-tasks {
    background: linear-gradient(135deg, #FF7043 0%, #FF8A65 100%);
    border-radius: var(--radius-card);
    padding: var(--space-xl);
    color: white;
    box-shadow: 0 4px 16px rgba(255, 112, 67, 0.3);
}

.today-tasks h3 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.today-task-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.today-task-item span:first-child {
    font-size: 1.2rem;
}

/* ===== MODALS ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.open { display: flex; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 90dvh;
    overflow-y: auto;
    padding: var(--space-xl);
    animation: slideUp 0.3s ease;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
}

.modal-sm {
    max-width: 360px;
    border-radius: 24px;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-page);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.modal-close:hover { background: var(--border); }

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: var(--space-lg);
    padding-right: 40px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--bg-input);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--accent);
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--bg-input);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    appearance: none;
    cursor: pointer;
}

.ingredient-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-sm);
}

.ingredient-row input[type="text"]  { flex: 2; }
.ingredient-row input[type="number"] { flex: 1; }

.confirm-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    margin-top: var(--space-xl);
}

/* ===== CLONE WEEK ===== */
.clone-info {
    text-align: center;
    padding: var(--space-lg);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 400px) {
    .app-header h1 { font-size: 1.3rem; }
    .recipe-card { flex-direction: column; align-items: flex-start; }
}

@media (min-width: 720px) {
    #planner-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: var(--space-md);
        align-items: start;
    }

    .day-column { gap: var(--space-sm); }
    .meal-slots { gap: var(--space-sm); }
    .meal-slot { min-height: 48px; }

    #recipes-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .recipe-card { flex-direction: column; }
    .recipe-meta { text-align: center; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
