:root {
    --bg-color: #f6f6f6;
    --header-bg: #ffffff;
    --text-color: #1a1a1a;
    --text-light: #6b7280;
    --primary: #ea580c;
    /* Orange accent */
    --primary-light: #fff7ed;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --max-width: 800px;
    /* Apps look better narrow/centered on desktop */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    padding-bottom: 2rem;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.app-header {
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    padding-top: 1rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

h1 {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-color);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.cart-btn {
    background: var(--bg-color);
    border: none;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.2s;
}

.cart-btn:hover {
    background: #e5e7eb;
}

#cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid white;
}

/* Search */
.search-container {
    margin-bottom: 1rem;
}

.search-bar {
    background: var(--bg-color);
    border-radius: 100px;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.search-icon {
    color: var(--text-light);
}

#search-input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    outline: none;
}

/* Tabs */
.tabs-container {
    padding-bottom: 0.5rem;
    overflow: hidden;
    /* Hide scrollbar shim */
}

.tabs-scroll {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    /* Firefox */
}

.tabs-scroll::-webkit-scrollbar {
    display: none;
    /* Chrome */
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s;
}

.tab-btn.active {
    color: var(--text-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--text-color);
    border-radius: 3px;
}

/* Main Content */
.main-content {
    padding-top: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.hidden-init {
    display: none !important;
}

/* Override hidden-init when visible class is added */
.hidden-init.visible {
    display: flex !important;
}

/* Featured Carousel */
.featured-carousel {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1.5rem;
    /* Space for shadow */
    margin: 0 -1rem;
    /* Full width bleed */
    padding: 0 1rem 1.5rem 1rem;
    scrollbar-width: none;
}

.featured-carousel::-webkit-scrollbar {
    display: none;
}

.featured-card {
    min-width: 280px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
}

.featured-card:active {
    transform: scale(0.98);
}

.featured-img {
    height: 160px;
    width: 100%;
    background: #e5e7eb;
    object-fit: cover;
}

.featured-info {
    padding: 1rem;
}

.featured-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}

.featured-price {
    font-size: 0.95rem;
    color: var(--text-light);
}

.featured-add-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-color);
}

/* Product List Grid */
.product-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 600px) {
    .product-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.list-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: border 0.2s;
}

.list-card:hover {
    border-color: var(--border-color);
}

.list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.list-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.list-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.list-price {
    font-weight: 600;
    color: var(--text-color);
}

.list-img {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    background: #e5e7eb;
    object-fit: cover;
}

.list-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 100px;
    border: 1px solid var(--border-color);
    background: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    align-self: flex-start;
}

/* Modals */
.product-modal,
.cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Bottom sheet on mobile */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

@media (min-width: 600px) {
    .product-modal {
        align-items: center;
    }

    .cart-modal {
        justify-content: flex-end;
    }
}

.product-modal.visible,
.cart-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

@media (min-width: 600px) {
    .modal-content {
        border-radius: 20px;
        height: auto;
        max-height: 85vh;
    }
}

/* Product Modal Internals */
.modal-gallery {
    height: 250px;
    background: #e5e7eb;
    position: relative;
}

.modal-media-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-info {
    padding: 1.5rem;
}

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1.2;
}

.modal-close {
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-color);
    flex-shrink: 0;
    margin-left: 1rem;
}

.modal-desc {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.modal-price {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.modal-footer-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.qty-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
}

#qty-input {
    width: 40px;
    text-align: center;
    border: none;
    font-weight: 600;
    font-size: 1rem;
}

.add-btn-primary {
    flex: 1;
    background: var(--text-color);
    /* Black button style */
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.add-btn-primary:active {
    opacity: 0.9;
}

/* Cart Specific */
.cart-content {
    background: white;
    width: 100%;
    max-width: 450px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

@media (min-width: 600px) {
    .cart-content {
        animation: slideInRight 0.3s ease;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.cart-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-item {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
}

.cart-item-price {
    font-size: 0.9rem;
    color: var(--text-light);
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.checkout-btn {
    width: 100%;
    background: #25D366;
    /* Whatsapp Green */
    color: white;
    border: none;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.new-order-btn {
    width: 100%;
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    transition: background 0.2s, color 0.2s;
}

.new-order-btn:hover {
    background: #ef4444;
    color: white;
}

.empty-cart-msg {
    text-align: center;
    color: var(--text-light);
    margin-top: 2rem;
}

.sold-out {
    color: #ef4444;
    font-weight: bold;
}

/* Enhanced Cart Button in Header */
.cart-btn-enhanced {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.cart-btn-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.cart-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-icon-wrapper i {
    font-size: 1.1rem;
}

.cart-count-badge {
    position: absolute;
    top: -10px;
    right: -12px;
    background: linear-gradient(135deg, var(--primary) 0%, #f97316 100%);
    color: white;
    font-size: 0.7rem;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid white;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.cart-count-badge:empty,
.cart-count-badge[data-count="0"] {
    animation: none;
}

.cart-total-preview {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.cart-total-label {
    font-size: 0.65rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#cart-total-header {
    font-size: 0.95rem;
    font-weight: 700;
    color: #4ade80;
}

/* Floating Order Button */
.floating-order-btn {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    border: none;
    border-radius: 100px;
    padding: 1rem 1.5rem;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    animation: float-btn 3s ease-in-out infinite;
    transition: all 0.3s ease;
    max-width: calc(100% - 2rem);
}

@keyframes float-btn {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(-5px);
    }
}

.floating-order-btn:hover {
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.5);
    transform: translateX(-50%) scale(1.02);
}

.floating-order-btn:active {
    transform: translateX(-50%) scale(0.98);
}

.floating-order-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.floating-order-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    padding-right: 1rem;
}

.floating-order-count {
    font-size: 0.75rem;
    opacity: 0.9;
}

.floating-order-total {
    font-size: 1.1rem;
    font-weight: 700;
}

.floating-order-text {
    font-weight: 600;
    font-size: 1rem;
}

.floating-order-btn i {
    font-size: 0.9rem;
    animation: arrow-bounce 1.5s ease-in-out infinite;
}

@keyframes arrow-bounce {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(4px);
    }
}

/* Hide floating button when cart is empty */
.floating-order-btn.hidden-init {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 400px) {
    .cart-btn-enhanced {
        padding: 0.4rem 0.8rem;
        gap: 0.5rem;
    }

    .cart-total-preview {
        display: none;
    }

    .floating-order-btn {
        padding: 0.85rem 1.2rem;
    }
}