:root {
    /* Color Palette - Light (Clean White & Electric Blue) */
    --primary: #0066ff;
    --primary-glow: rgba(0, 102, 255, 0.25);
    --secondary: #111111;
    --bg-color: #ffffff;
    --text-main: #000000;
    --text-muted: #666666;

    --card-bg: rgba(255, 255, 255, 0.85);
    /* More opaque for crisp look */
    --card-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    --input-bg: #f5f5f7;

    --accent-gradient: linear-gradient(135deg, #0066ff 0%, #00c6ff 100%);

    /* Effects */
    --blur-strength: 20px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="dark"] {
    /* Color Palette - Dark (Deep Black & Electric Blue) */
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.3);
    --secondary: #ffffff;
    --bg-color: #000000;
    --text-main: #ffffff;
    --text-muted: #888888;

    --card-bg: rgba(20, 20, 20, 0.8);
    --card-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.6);
    --input-bg: rgba(255, 255, 255, 0.1);

    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Background removed */

/* Layout */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100vh;
    padding-bottom: 100px;
    /* Space for footer */
}

/* Utilities */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

.icon-btn {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.icon-btn:hover {
    transform: scale(1.1);
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
}

.icon-btn.sm {
    width: 32px;
    height: 32px;
    font-size: 1rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.brand-icon {
    display: none;
    /* Hide old icon if present */
}

.brand-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.5px;
}

.badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    opacity: 0.8;
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.city-selector {
    position: relative;
    padding: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: var(--transition);
}

.city-selector:hover {
    border-color: var(--primary);
}

.city-selector select {
    width: 100%;
    appearance: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 18px 40px 18px 50px;
    cursor: pointer;
    outline: none;
}

.location-icon {
    position: absolute;
    left: 18px;
    font-size: 1.4rem;
    color: var(--primary);
    pointer-events: none;
}

.arrow-icon {
    position: absolute;
    right: 18px;
    font-size: 1.2rem;
    color: var(--text-muted);
    pointer-events: none;
}

/* Date Scroller */
.date-scroller-wrapper {
    overflow: hidden;
}

.date-scroller {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 6px 16px 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.date-scroller::-webkit-scrollbar {
    display: none;
}

.date-chip {
    flex: 0 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    min-width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.date-chip span.day-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-chip span.day-num {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.date-chip:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--glass-shadow);
    border-color: var(--primary);
}

.date-chip.active {
    background: var(--text-main);
    border-color: var(--text-main);
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.date-chip.active span.day-name {
    color: var(--bg-color);
    opacity: 0.7;
}

.date-chip.active span.day-num {
    color: var(--bg-color);
}

/* For Dark Mode specific active state override if needed */
[data-theme="dark"] .date-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

[data-theme="dark"] .date-chip.active span {
    color: #ffffff;
}


.quick-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.action-chip {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.action-chip:hover {
    background: var(--input-bg);
    color: var(--primary);
    border-color: var(--primary);
}

.action-chip.active {
    background: var(--text-main);
    color: var(--bg-color);
    border-color: var(--text-main);
}

[data-theme="dark"] .action-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Wrapper for Tabs + Content (Mobile & Desktop) */
.menu-main-wrapper {
    display: flex;
    flex-direction: column;
    gap: 25px;
    /* Distinct separation from content */
}

/* Meal Tabs */
.meal-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 6px;
    border-radius: 38px;
    /* 32px (inner btn) + 6px padding */
    gap: 6px;
}

.tab-btn {
    background: transparent;
    border: none;
    border-radius: 32px;
    /* Matches Food Card Radius */
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn i {
    font-size: 1.3rem;
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .tab-btn.active {
    background: #1e293b;
    color: var(--primary);
    box-shadow: none;
}

/* Menu Content */
.menu-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 200px;
}

.food-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    /* Much rounder */
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
    transform: translateY(15px);
    transition: var(--transition);
    text-decoration: none;
    /* Remove underline for links */
    color: inherit;
    /* Inherit text color */
    cursor: pointer;
}

.food-card:hover {
    transform: translateY(-3px) scale(1.01);
    border-color: var(--primary);
    box-shadow: 0 10px 30px -5px var(--glass-shadow);
}

.food-icon {
    min-width: 56px;
    /* Fixed width to prevent shrinking */
    height: 56px;
    background: var(--input-bg);
    border-radius: 24px;
    /* Rounder icon bg */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--text-main);
}

.food-info {
    flex: 1;
}

.food-name {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main);
}

.food-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.food-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.view-hint {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

.food-cal {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--card-border);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

[data-theme="dark"] .food-cal {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border-color: rgba(59, 130, 246, 0.3);
}

/* --- Image Support --- */
.visual-wrapper {
    min-width: 56px;
    height: 56px;
    border-radius: 20px;
    overflow: hidden;
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.food-card.has-img .visual-wrapper {
    min-width: 72px;
    /* Slightly larger for images */
    height: 72px;
}

.food-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.food-card:hover .food-img {
    transform: scale(1.1);
}

.food-icon.fallback {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.empty-state,
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-style: italic;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--card-border);
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 560px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    /* Dark contrast footer */
    backdrop-filter: blur(20px);
    border-radius: 50px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .app-footer {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: black;
}

[data-theme="dark"] .app-footer {
    background: rgba(30, 30, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

.footer-cal {
    color: var(--primary);
    font-weight: 800;
}

.separator {
    opacity: 0.3;
}

/* Animations */
@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--input-bg);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

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

@media (min-width: 768px) {
    /* Desktop & Tablet Layout Transformation */

    .app-container {
        max-width: 1000px;
        /* Wider container */
        padding: 40px;
        display: grid;
        grid-template-columns: 320px 1fr;
        /* Sidebar | Content */
        grid-template-rows: auto 1fr;
        gap: 30px;
        align-items: start;
    }

    /* Header -> Top Left Logo Area */
    .app-header {
        grid-column: 1 / -1;
        padding: 0;
        margin-bottom: 10px;
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
    }

    .brand-text h1 {
        font-size: 2rem;
    }

    /* Controls Section -> Sidebar */
    .controls-section {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        position: sticky;
        top: 40px;
        background: var(--card-bg);
        padding: 24px;
        border-radius: var(--radius-lg);
        border: 1px solid var(--card-border);
        backdrop-filter: blur(var(--blur-strength));
        box-shadow: var(--glass-shadow);
        height: fit-content;
    }

    /* City Selector within Sidebar */
    .city-selector {
        background: var(--input-bg);
        border-radius: var(--radius-sm);
        border: 1px solid transparent;
        margin-bottom: 20px;
    }

    .city-selector:hover {
        background: var(--bg-color);
        border-color: var(--card-border);
    }

    /* Date Scroller within Sidebar (Vertical List Style) */
    .date-scroller-wrapper {
        max-height: 400px;
        overflow-y: auto;
        margin-right: -10px;
        /* Pull scrollbar slightly to edge */
        padding-right: 10px;
        /* Add space for scrollbar */
    }

    .date-scroller {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding-bottom: 20px;
        /* Bottom padding within scroll */
    }

    .date-chip {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 14px 16px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.03);
        /* Subtle bg */
        border: 1px solid transparent;
        /* Prepare for border */
        cursor: pointer;
        transition: all 0.2s;
    }

    .date-chip span.day-num {
        font-size: 1.1rem;
        font-weight: 600;
    }

    .date-chip span.day-name {
        font-size: 0.95rem;
        color: var(--text-muted);
    }

    .date-chip:hover {
        background: rgba(255, 255, 255, 0.08);
        transform: translateX(2px);
    }

    /* Current Day Style */
    .date-chip.is-today {
        border-color: var(--primary);
        /* Highlight border for today */
        background: rgba(0, 102, 255, 0.08);
        /* Blue tint */
    }

    .date-chip.is-today .day-name {
        color: var(--primary);
        font-weight: 600;
    }

    /* Selected Day Style (Overrides Today if needed) */
    .date-chip.active {
        background: var(--primary);
        border-color: var(--primary);
        color: white;
        box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
    }

    .date-chip.active .day-name,
    .date-chip.active .day-num {
        color: white;
    }

    .quick-actions {
        flex-direction: column;
        margin-top: 20px;
        gap: 10px;
    }

    .action-chip {
        width: 100%;
        text-align: center;
        padding: 12px;
        border-radius: 12px;
    }

    /* Main Content Area */
    .menu-main-wrapper {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    /* Meal Tabs */
    .meal-tabs {
        grid-column: 2 / 3;
        /* Move above content */
        margin-bottom: 0;
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        backdrop-filter: blur(var(--blur-strength));
    }

    /* Menu Grid for Cards */
    .menu-content {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        /* Grid of cards */
        gap: 20px;
    }

    .food-card {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 10px;
        padding: 14px;
        /* Reduced padding */
        height: 100%;
        border-radius: 24px;
        /* Slightly tighter radius for smaller cards */
    }

    .food-icon {
        width: 48px;
        /* Smaller icon */
        height: 48px;
        font-size: 1.5rem;
        margin-bottom: 4px;
        border-radius: 18px;
    }

    .food-info {
        width: 100%;
    }

    .food-cal {
        align-self: flex-start;
        margin-top: auto;
        /* Push to bottom if flex column */
    }

    /* Footer - Static at bottom of content or page */
    .app-footer {
        position: static;
        /* Not fixed */
        transform: none;
        width: 100%;
        max-width: none;
        margin-top: 40px;
        grid-column: 2 / 3;
        border-radius: var(--radius-md);
    }

    /* Hide decorative globes on desktop or make them huge */
    .globe {
        opacity: 0.3;
        filter: blur(120px);
    }

    .globe-1 {
        width: 600px;
        height: 600px;
        right: -100px;
        top: -100px;
    }

    .globe-2 {
        width: 500px;
        height: 500px;
        left: -100px;
        bottom: -100px;
    }

}

/* Scrollbar tweaks for desktop */
@media (min-width: 768px) {
    ::-webkit-scrollbar {
        width: 8px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: var(--card-border);
        border-radius: 4px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-muted);
    }
}

/* Menu Sections & Grid */
.menu-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.8;
}

/* Default Mobile: Stacked */
.card-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Desktop: Grid */
@media (min-width: 768px) {
    .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));

        /* Narrower columns */
        /* Ensure footer doesn't shrink in flex container */
        .app-footer {
            flex-shrink: 0;
        }

        /* Smaller gap */
    }
}

/* App Promo Card */
.app-promo-card {
    margin-top: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    border-radius: 24px;
    background: linear-gradient(145deg, var(--card-bg) 0%, var(--bg-color) 100%);
    border: 1px solid var(--card-border);
}

.promo-text h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main);
}

.promo-text p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.app-store-btn {
    display: inline-block;
    transition: transform 0.2s ease;
}

.app-store-btn img {
    height: 40px;
    display: block;
}

/* Legal Footer */
.legal-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    margin-bottom: 20px;
}

.legal-footer a,
.legal-footer span,
.legal-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.7;
}

.legal-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.legal-footer .copyright {
    margin-left: 10px;
    font-weight: 500;
}


@media (min-width: 768px) {

    /* Promo card is in sidebar now, let it stack */
    .app-promo-card {
        margin-top: 20px;
    }

    /* Legal footer at bottom full width */
    .legal-footer {
        grid-column: 1 / -1;
        grid-row: 3;
        margin-top: 40px;
    }
}

/* Dual Promo Section */
.dual-promo-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 40px;
    margin-bottom: 20px;
}

@media (min-width: 600px) {
    .dual-promo-section {
        grid-template-columns: 1fr 1fr;
    }
}

.promo-glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}

.promo-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.wa-bg {
    background: rgba(37, 211, 102, 0.15);
    color: #25D366;
}

.app-bg {
    background: rgba(0, 102, 255, 0.15);
    color: #0066FF;
}

.promo-details h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.promo-details p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.promo-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: transform 0.2s, background 0.2s;
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    color: var(--text-main);
}

.promo-glass-card.whatsapp-card .promo-action-btn:hover {
    background: #25D366;
    color: white;
    border-color: #25D366;
}

.promo-glass-card.app-card .promo-action-btn:hover {
    background: #0066FF;
    color: white;
    border-color: #0066FF;
}

.promo-action-btn:hover {
    transform: translateY(-2px);
}

/* --- Fixes for Layout & Overlap --- */

/* Store Badge */
.store-badge-link {
    display: inline-block;
    transition: transform 0.2s;
    text-decoration: none;
    line-height: 0;
}

.store-badge-link:hover {
    transform: translateY(-2px);
}

.store-badge-img {
    height: 48px;
    width: auto;
    display: block;
}

@media (min-width: 768px) {

    /* Explicit Rows to Prevent Overlap */
    .app-container {
        /* Sidebar/Content | (gap) | Promo | Footer */
        grid-template-rows: auto 1fr auto auto;
    }

    /* Sidebar controls: Stay in Row 2, don't overlap others */
    .controls-section {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        top: 24px;
        z-index: 10;
        /* Ensure it behaves within its container */
        position: sticky;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
    }

    /* Main Content */
    .menu-main-wrapper {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
        z-index: 5;
    }

    /* Promo Section: Explicitly in Row 3 */
    /* Promo Section: Explicitly in Row 3, BUT in Content Column to avoid overlap */
    .dual-promo-section {
        grid-column: 2 / 3;
        grid-row: 3;
        margin-top: 60px;
        z-index: 1;
        position: relative;
    }

    /* Legal Footer: Explicitly in Row 4, Content Column */
    .legal-footer {
        grid-column: 2 / 3;
        grid-row: 4;
        margin-top: 20px;
        z-index: 1;
        position: relative;
        justify-content: flex-start;
        padding-left: 10px;
    }
}