:root {
    /* Brand Colors */
    --primary: #EA1D2C;
    /* iFood Red - High Energy */
    --primary-hover: #b60f1b;
    --secondary: #FEF3F3;
    /* Light Red BG */

    /* Neutrals */
    --bg-body: #FAFAFA;
    /* Ultra Light Gray - cleaner than pure white */
    --bg-surface: #FFFFFF;
    --text-main: #1F1F1F;
    /* Softer black */
    --text-secondary: #717171;
    --border-subtle: #F2F2F2;

    /* Metrics */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    /* Super rounded modern feel */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-display: 'Inter', -apple-system, sans-serif;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    max-width: 100vw;
}

body {
    background-color: var(--bg-body);
    font-family: var(--font-display);
    color: var(--text-main);
    padding-bottom: 120px;
    padding-top: 70px;
    /* Explicit space for header */
    -webkit-font-smoothing: antialiased;

    /* Premium Background */
    background-image:
        linear-gradient(to bottom, rgba(250, 250, 250, 0.85), rgba(250, 250, 250, 0.95)),
        url('https://images.unsplash.com/photo-1550547660-d9450f859349?q=80&w=1920');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------------- HEADER ---------------- */
.app-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 0;
    transition: all 0.3s ease;
}

.header-inner {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-text {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.status-capsule {
    background: #E6F7E9;
    color: #00A000;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-capsule.closed {
    background: #FEE2E2;
    color: #DC2626;
}

.dot {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
}

/* Search Bar (Apple Style) */
.search-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    background: #F2F2F2;
    border: none;
    padding: 14px 14px 14px 44px;
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.2s;
}

.search-input:focus {
    background: #fff;
    box-shadow: 0 0 0 2px var(--primary);
    outline: none;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1rem;
}

/* ---------------- CONTENT AREA ---------------- */
.main-wrapper {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Banner Carousel */
.carousel-frame {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
    transform: translateZ(0);
    /* Fix Safari radius clipping */
}

.carousel {
    width: 100%;
    height: 160px;
    position: relative;
    background: #eee;
}

@media (min-width: 400px) {
    .carousel {
        height: 200px;
    }
}

.slide {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.slide.active {
    opacity: 1;
}

/* Metrics Bar */
.metrics-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    /* Hide scrollbar spacing */
    scrollbar-width: none;
    margin-bottom: 24px;
}

.metric-card {
    background: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.metric-card b {
    color: var(--text-main);
}

.metric-link {
    color: var(--primary);
    cursor: pointer;
}

/* Sticky Categories - STABILIZED */
.category-wrapper {
    position: sticky;
    top: 130px;
    z-index: 90;
    background: rgba(250, 250, 250, 0.98);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 10px 0;
    margin-bottom: 10px;
    /* Clean box, no negative margins to cause horizontal scroll */
    width: 100%;
}

/* Ensure header doesn't overflow */
.app-header {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.category-sticky {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 0 20px;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
}

.category-sticky::-webkit-scrollbar {
    display: none;
}

/* Desktop Navigation Arrows */
.cat-nav-btn {
    display: none;
    /* Hidden on mobile */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-subtle);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.cat-nav-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.cat-nav-btn.left {
    left: 10px;
}

.cat-nav-btn.right {
    right: 10px;
}

@media (min-width: 768px) {
    .cat-nav-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.cat-pill {
    background: #fff;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    flex-shrink: 0;
    /* Prevent shrinking */
}

.cat-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(234, 29, 44, 0.3);
}

/* ---------------- MENU GRID ---------------- */
.menu-section {
    margin-top: 32px;
    animation: fadeInUp 0.6s ease backwards;
}

.section-header {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

/* Product Card - The "Wow" Factor */
.product-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 16px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(0, 0, 0, 0.05);
}

.product-card:active {
    transform: scale(0.98);
}

.prod-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.prod-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.prod-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prod-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.prod-price-old {
    text-decoration: line-through;
    color: #ccc;
    font-size: 0.8rem;
    margin-left: 6px;
}

.prod-image-box {
    width: 110px;
    height: 110px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

.prod-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* Featured List - Horizontal Scroll (Carousel) */
#featured-list {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px;
    /* Space for border animation */
    /* Hide scrollbar */
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    margin: 0 -20px;
    /* Bleed to edge */
    padding-left: 20px;
    /* Restore padding */
    padding-right: 20px;
}

#featured-list::-webkit-scrollbar {
    display: none;
}

/* Header Cart Icon */
.cart-icon-box {
    position: relative;
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-main);
    transition: 0.2s;
}

.cart-icon-box:hover {
    background: #e0e0e0;
}

.cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid white;
}

/* Featured Product Card - Clean */
.feat-card {
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    position: relative;
    /* Fixed width for carousel */
    min-width: 160px;
    width: 160px;
    flex-shrink: 0;
}

/* RGB Fire Border Effect */
@keyframes fireBorder {
    0% {
        background-position: 0 0;
    }

    50% {
        background-position: 400% 0;
    }

    100% {
        background-position: 0 0;
    }
}

.feat-img-box {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #fff;
    padding: 3px;
    /* Space for the RGB border */
}

/* RGB Fire Border Effect - ONLY AROUND IMAGE */
.feat-img-box::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #ff7300, #ff0000);
    z-index: 0;
    border-radius: 12px;
    background-size: 400%;
    animation: fireBorder 3s linear infinite;
}

.feat-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.feat-card:hover .feat-img {
    transform: scale(1.1);
}

.feat-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feat-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feat-price {
    color: #EA1D2C;
    font-weight: 800;
    font-size: 1rem;
}

.float-bar {
    background: var(--primary);
    color: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 40px rgba(234, 29, 44, 0.4);
    pointer-events: auto;
    /* Re-enable clicks */
    cursor: pointer;
    transform: translateY(150%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.float-bar.visible {
    transform: translateY(0);
}

.float-info {
    display: flex;
    flex-direction: column;
}

.float-label {
    font-size: 0.75rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.float-total {
    font-size: 1.1rem;
    font-weight: 700;
}

.float-btn {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------------- MODALS ---------------- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 900;
    display: none;
    align-items: flex-end;
    /* Mobile Sheet */
    justify-content: center;
}

@media(min-width: 600px) {
    .modal-backdrop {
        align-items: center;
    }
}

.modal-sheet {
    background: #fff;
    width: 100%;
    max-width: 550px;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    max-height: 90vh;
    animation: slideUp 0.3s ease;
    overflow-y: auto;
    position: relative;
}

@media(min-width: 600px) {
    .modal-sheet {
        border-radius: 20px;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sheet-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.close-btn {
    background: #f2f2f2;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    color: #555;
}

/* Form Elements */
.input-group {
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.app-input {
    width: 100%;
    padding: 14px;
    background: #FAFAFA;
    border: 1px solid #E6E6E6;
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text-main);
    transition: 0.2s;
}

.app-input:focus {
    background: #fff;
    border-color: var(--primary);
    outline: none;
}

.primary-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(234, 29, 44, 0.3);
    transition: transform 0.1s;
}

.primary-btn:active {
    transform: scale(0.98);
}

/* Closed Overlay */
.closed-banner {
    background: #FEF2F2;
    color: #DC2626;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    border: 1px solid #FECACA;
    margin-bottom: 20px;
    display: none;
}