/* Mobile-first responsive layout */
:root {
    --primary-color: #d32f2f;
    --primary-hover: #b71c1c;
    --primary-light: #ffebee;
    --accent-gold: #f59e0b;
    --bg-light: #f8f9fa;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --drawer-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
}

body {
    background-color: var(--bg-light);
    padding-bottom: 90px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-dark);
    margin: 0;
}

/* Category Navigation (Sticky, horizontal scroll) */
.category-nav-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    padding: 10px 0;
}

.category-nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 4px 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.category-nav::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.category-pill {
    white-space: nowrap;
    padding: 8px 18px;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.category-pill:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.category-pill.active {
    background: var(--theme-color, var(--primary-color));
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Product Section */
.category-section {
    padding: 15px 16px;
    scroll-margin-top: 65px;
}

.category-title {
    margin-bottom: 14px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--theme-color, var(--primary-color));
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 18px;
    }
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid #f1f5f9;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.product-image-container {
    width: 100%;
    padding-top: 75%; /* 4:3 Aspect Ratio */
    position: relative;
    background: #f1f5f9;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #94a3b8;
    font-size: 2.2rem;
}

.product-rating-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-rating-badge i {
    color: var(--accent-gold);
}

.product-info {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-dark);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.product-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    color: var(--theme-color, var(--primary-color));
    font-weight: 700;
    font-size: 1.05rem;
}

.add-btn {
    background: var(--theme-color, var(--primary-color));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.add-btn:hover {
    opacity: 0.92;
}

.add-btn:active {
    transform: scale(0.96);
}

/* Loyalty Bar & Widget */
.loyalty-banner {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 10px 16px;
    margin: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.loyalty-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loyalty-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f59e0b;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* FAB Action Buttons */
.fab-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.fab {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab:hover {
    transform: scale(1.08);
}

.fab:active {
    transform: scale(0.95);
}

.fab-cart {
    background: var(--theme-color, var(--primary-color));
    position: relative;
}

.fab-bell {
    background: #f59e0b;
}

.fab-chat {
    background: #25d366;
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    border-radius: 9999px;
    min-width: 22px;
    height: 22px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
}

/* Cart Drawer */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: min(440px, 100vw);
    background: white;
    z-index: 1055;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--drawer-shadow);
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    right: 0;
}

.cart-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.cart-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.cart-footer {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1050;
    display: none;
}

.drawer-backdrop.show {
    display: block;
}

/* Recommendation cards */
.recommendations-wrapper {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #e2e8f0;
}

.recommendations-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.recommendation-item {
    flex: 0 0 140px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.recommendation-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 6px;
}

/* Reviews Tab & Star rating */
.star-rating-select {
    display: flex;
    gap: 6px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #cbd5e1;
}

.star-rating-select i.active,
.star-rating-select i:hover,
.star-rating-select i:hover ~ i {
    color: var(--accent-gold);
}

.review-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #f1f5f9;
}

/* Chatbot Widget Window */
.chat-window {
    display: none;
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: min(340px, calc(100vw - 40px));
    height: 460px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 1001;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.chat-header {
    background: var(--theme-color, var(--primary-color));
    color: white;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    max-width: 82%;
    font-size: 0.88rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-bubble-bot {
    align-self: flex-start;
    background: white;
    color: #1e293b;
    border-top-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid #f1f5f9;
}

.chat-bubble-user {
    align-self: flex-end;
    background: var(--theme-color, var(--primary-color));
    color: white;
    border-top-right-radius: 2px;
}
