:root {
    --primary: #FF5C00;
    /* FoodAppi Orange */
    --primary-light: #FFF0E6;
    --secondary: #28a745;
    --text-dark: #1A1D26;
    --text-gray: #6C757D;
    --bg-body: #F5F7FA;
    --white: #FFFFFF;
    --border-radius: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-dark);
    line-height: 1.5;
}

/* --- Header --- */
.app-header {
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    padding: 0.8rem 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 0.5rem;
}

.logo-img {
    width: 32px;
    height: 32px;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--text-dark);
}

.highlight {
    color: var(--primary);
}

.search-bar-container {
    flex: 1;
}

.search-input-wrapper {
    position: relative;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    border: 1px solid #eee;
    background: #F8F9FA;
    border-radius: 50px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.header-cart-btn {
    background: var(--white);
    border: 1px solid #eee;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-dark);
    transition: 0.2s;
}

.header-cart-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
}

.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;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

/* --- Main Content --- */
.app-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

/* Banners */
.banner-section {
    display: flex;
    overflow-x: hidden;
    /* JS will handle scroll, or 'auto' for touch */
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    /* For shadow/hover space */
    cursor: grab;
}

.banner-section:active {
    cursor: grabbing;
}

.banner-card {
    border-radius: var(--border-radius);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    flex: 0 0 85%;
    /* Mobile default */
    min-width: 0;
    /* Flexbox fix */
    transition: transform 0.3s;
}

@media (min-width: 768px) {
    .banner-card {
        flex: 0 0 45%;
    }
}

.primary-banner {
    background: linear-gradient(135deg, #FFF6E5 0%, #FFFFFF 100%);
}

.secondary-banner {
    background: #E8F5E9;
}

.banner-text h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.banner-text p {
    color: var(--text-gray);
    margin-bottom: 1.5rem;
}

.banner-btn {
    bottom: 2rem;
    padding: 0.8rem 1.8rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 92, 0, 0.3);
}

.banner-img {
    height: 180px;
    width: 180px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
}

.view-all {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Categories */
.categories-section {
    margin-bottom: 2.5rem;
}

.categories-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.categories-row::-webkit-scrollbar {
    display: none;
}

/* Safari/Chrome */

.category-pill {
    padding: 0.6rem 1.2rem;
    border: 1px solid #eee;
    background: var(--white);
    border-radius: 50px;
    white-space: nowrap;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-gray);
    transition: 0.2s;
    font-family: var(--font-body);
}

.category-pill:hover,
.category-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(255, 92, 0, 0.2);
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem;
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid transparent;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: #eee;
}

.product-img-wrapper {
    height: 180px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    position: relative;
}

.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.product-card:hover .product-img-wrapper img {
    transform: scale(1.05);
}

.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff5252;
}

.product-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
}

.product-desc {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.add-cart-btn {
    background: var(--white);
    border: 1px solid #eee;
    color: var(--text-dark);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    font-size: 0.9rem;
}

.add-cart-btn:hover {
    background: var(--text-dark);
    color: var(--white);
    border-color: var(--text-dark);
}

/* --- Cart Sidebar --- */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: var(--white);
    z-index: 1000;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header-row {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.cart-header-row h3 {
    font-family: var(--font-heading);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-gray);
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.cart-item-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
}

.cart-item-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.cart-item-price {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.qty-control {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #f8f9fa;
    padding: 0.3rem 0.6rem;
    border-radius: 50px;
}

.qty-btn {
    background: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

/* Footer Area inside Cart */
.cart-footer-area {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    background: #fff;
}

.delivery-input-group {
    background: #ffffff;
    padding: 0;
    margin-bottom: 1.5rem;
}

.delivery-input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.delivery-input-group input {
    width: 100%;
    border: 2px solid #e0e0e0;
    background: #ffffff;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: border-color 0.2s;
}

.delivery-input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.bill-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.total-row {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-dark);
    margin-top: 1rem;
    border-top: 1px dashed #ddd;
    padding-top: 1rem;
}

.action-buttons {
    display: grid;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.checkout-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: white;
    transition: 0.2s;
}

.primary-btn {
    background: var(--primary);
}

.primary-btn:hover {
    background: #e65200;
}

.checkout-btn:hover {
    filter: brightness(1.05);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
    display: none;
    backdrop-filter: blur(2px);
}

.overlay.open {
    display: block;
}

.empty-state {
    text-align: center;
    color: #ccc;
    margin-top: 3rem;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .banner-section {
        grid-template-columns: 1fr;
    }

    .secondary-banner {
        display: none;
    }

    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

    .search-input-wrapper {
        max-width: 100%;
    }

    .banner-text h2 {
        font-size: 1.6rem;
    }
}

/* Floating Cart Button */
.floating-cart-btn-fixed {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(255, 92, 0, 0.4);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-cart-btn-fixed:hover {
    transform: scale(1.05);
}

.floating-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary);
}

/* --- Centered Cart Modal (Overrides) --- */
.cart-sidebar {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90% !important;
    max-width: 500px !important;
    height: 70vh !important;
    background: var(--white);
    z-index: 2000 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    transition: opacity 0.3s ease, transform 0.3s ease !important;
    display: flex;
    flex-direction: column;

    /* Hidden state */
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.cart-sidebar.open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1) !important;
    right: auto !important;
}

@media (max-width: 768px) {
    .cart-sidebar {
        width: 90% !important;
        right: auto !important;
        left: 50% !important;
    }
}

/* PWA Modal */
.pwa-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: none;
    /* Flex when active */
    align-items: flex-end;
    justify-content: center;
    height: 100%;
    backdrop-filter: blur(4px);
}

.pwa-modal.show {
    display: flex;
}

.pwa-content {
    background: #fff;
    width: 100%;
    max-width: 400px;
    /* Tablet limit */
    border-radius: 20px 20px 0 0;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
    margin-bottom: 0;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.pwa-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.pwa-content h3 {
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.pwa-content p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.pwa-actions {
    display: flex;
    gap: 1rem;
}

.pwa-btn {
    flex: 1;
    padding: 0.8rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.pwa-cancel {
    background: #f1f3f5;
    color: var(--text-dark);
}

.pwa-install {
    background: var(--primary);
    color: white;
}

@media (min-width: 768px) {
    .pwa-modal {
        align-items: center;
    }

    .pwa-content {
        border-radius: 20px;
        margin-bottom: 0;
    }
}