/* Color Palette & Global Variables */
:root {
    --primary-gold: #DDCD5C; /* New Gold Primary Color (#DDCD53) */
    --primary-blue: #042853; /* New Dark Blue Secondary Color (#042853) */
    --accent-gold: #FFD700; /* Gold - Accent color for highlights */

    --secondary-gray: #f8f9fa; /* Light neutral gray for backgrounds */
    --light-bg: #ffffff; /* White background */
    --dark-bg: #212529; /* Dark neutral gray for footer/dark elements */
    --text-dark: #343a40; /* Dark text on light backgrounds */
    --text-light: #f8f9fa; /* Light text on dark backgrounds */
    --maroon-text: #800000; /* Dark Red/Maroon for alerts */
    --maroon-bg: #800000;
    --aqua-bg: #008080;
    --aqua-text: #008080;
    --vibrant-deep-blue: #1A0F49; /* Deep indigo color for vibrant sections */
    --deal-red: #A30000; /* Deep red for professional deal badge */
}

/* General Body and Text */
body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-dark); /* Default text color */
    background-color: var(--light-bg);
    line-height: 1.6;
    /* Ensure space for fixed bottom nav on mobile */
    padding-bottom: 60px; 
    /* CRITICAL FIX: Prevent horizontal scrolling/user zooming/panning */
    overflow-x: hidden;
    touch-action: pan-y;
}

/* Custom Colors and Backgrounds for direct application */
.gold-primary { color: var(--primary-gold) !important; }
.blue-primary { color: var(--primary-blue) !important; }
.gold-accent { color: var(--accent-gold) !important; }
.gold-bg { background-color: var(--primary-gold) !important; }
.blue-bg { background-color: var(--primary-blue) !important; }
.maroon-bg { background-color: var(--maroon-bg) !important; }
.aqua-bg { background-color: var(--aqua-bg) !important; }
.maroon-text { color: var(--maroon-text) !important; }
.aqua-text { color: var(--aqua-text) !important; }

/* Text gradients for logo */
.gold-text-gradient {
    background: linear-gradient(to right, var(--primary-gold), #FFF8DC); /* Gold to lighter gold */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}
.gold-icon-gradient {
    background: linear-gradient(to right, var(--primary-gold), #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

/* --- Navigation Bar (Streamlined) --- */
.custom-navbar {
    background-color: var(--light-bg);
    padding: 0.5rem 0; 
    border-bottom: 1px solid #eee;
    z-index: 1050; 
}
.custom-navbar .navbar-brand {
    font-weight: 700;
}
.custom-navbar .nav-link {
    color: var(--text-dark);
    font-weight: 500;
    margin-right: 15px;
    transition: color 0.3s ease;
}
.custom-navbar .nav-link:hover,
.custom-navbar .nav-link.active {
    color: var(--primary-gold);
}
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='%23042853' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Action Buttons (Cart) */
.btn-icon-text {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-gold {
    background-color: var(--primary-gold);
    color: var(--primary-blue); /* Dark text on Gold */
    border: 1px solid var(--primary-gold);
    /* Add subtle shadow for premium look */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Transition for micro-interaction */
    transition: all 0.2s ease-in-out; 
}
.btn-gold:hover {
    background-color: #E6D99C;
    border-color: #E6D99C;
    /* Lift button on hover/tap */
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}
.btn-gold:active {
    /* Press-down effect */
    transform: scale(0.98);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.btn-gold:disabled {
    background-color: #cccccc;
    border-color: #cccccc;
    cursor: not-allowed;
    transform: none; /* Disable transform on disabled state */
    box-shadow: none;
}

/* General button polish (Applies to btn-primary, btn-success, etc.) */
.btn {
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
}
.btn:active {
    transform: scale(0.98);
}
.btn-primary {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.btn-primary:hover {
    background-color: #031e3d;
    border-color: #031e3d;
    transform: translateY(-1px);
}
.btn-success {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.btn-success:hover {
    transform: translateY(-1px);
}
.btn-outline-secondary {
    transition: all 0.2s ease-in-out;
}
.btn-outline-secondary:active {
     transform: scale(0.98);
}

/* --- Service Card Icon Pulse Animation (for index.html and about.html) --- */
.service-card-container:hover .service-icon-pulse {
    animation: iconPulse 0.8s infinite;
}
@keyframes iconPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}


/* Call to Action Section */
.cta-section {
    background: linear-gradient(to right, var(--primary-blue), #031e3d);
    color: white;
    padding: 5rem 0;
}

/* Footer */
footer {
    background-color: var(--dark-bg);
    color: var(--text-light);
}
footer h5 {
    color: var(--primary-gold);
    margin-bottom: 1rem;
}
footer a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s ease;
}
footer a:hover {
    color: var(--primary-gold);
}

/* --- Mobile Fixed Bottom Navigation Bar --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px; /* Fixed height for mobile */
    background-color: var(--vibrant-deep-blue); /* Deep Blue Background */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1060; 
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}
.bottom-nav a {
    color: var(--text-light); /* White/Light text */
    text-decoration: none;
    text-align: center;
    padding: 5px;
    display: block;
    font-size: 0.75rem;
    line-height: 1;
    transition: color 0.2s, transform 0.2s; /* Add transform for tap feedback */
}
/* Tap/Hover Feedback for bottom nav icons */
.bottom-nav a:active,
.bottom-nav a:hover {
    transform: scale(1.05);
}
.bottom-nav a i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 3px;
    color: var(--text-light);
    transition: color 0.2s;
}
.bottom-nav .nav-item-active {
    color: var(--primary-gold);
}
.bottom-nav .nav-item-active i {
    color: var(--primary-gold);
}
@media (max-width: 991.98px) {
    .custom-navbar .d-flex.align-items-center.gap-2.ms-lg-3 {
        display: none !important; 
    }
}


/* --- Order Page Specific Overrides --- */
.sticky-lg-top {
    top: 60px !important; 
    z-index: 1000; 
}
.card-header.text-white h4, 
.card-header.text-white p,
.card-header.text-white i {
    color: white !important;
}

/* Custom Location Status Alert (Updated style to be based on Bootstrap alerts for consistency) */
.location-status {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    margin-top: 5px;
    font-weight: 500;
}
.location-status.alert-success {
    background-color: #e6f7e9;
    color: #1e7045;
    border: 1px solid #c3e6cb;
}
.location-status.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.location-status.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* --- Shopping Page: VIBRANT THEME & STICKY HEADER FIX --- */

/* TOP HERO BANNER (index.html) */
.vibrant-hero-top {
    background-color: var(--vibrant-deep-blue);
    padding-bottom: 2rem;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
}
/* FIX: Index page heading color for better contrast */
.vibrant-hero-top h2.blue-primary {
    color: var(--text-light) !important;
}

/* CRITICAL BANNER FIX: Ensure images/gifs in the carousel fit the container */
.carousel-item img,
.carousel-item .gif-content img {
    height: 100%;
    width: 100%;
    /* Ensures the entire image/GIF fills the 40vh space, cropping if necessary */
    object-fit: cover !important; 
}


/* STICKY HEADER FOR SHOPPING (Below Navbar) */
.sticky-mobile-header {
    position: fixed;
    top: 52px; /* Directly below fixed navbar */
    left: 0;
    right: 0;
    background-color: var(--vibrant-deep-blue); /* Consistent dark background */
    z-index: 1040; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 5px 0; /* Minimized vertical padding */
}
/* Ensure search inputs/buttons within the sticky header look good */
.sticky-mobile-header .form-control {
    border-radius: 8px;
}
.sticky-mobile-header .btn-gold {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.sticky-mobile-header .btn-outline-light { /* Changed to light outline for contrast */
    color: var(--text-light);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Desktop Search Fix: Hide the mobile sticky header components on desktop */
@media (max-width: 991.98px) {
    .custom-navbar .d-flex.align-items-center.gap-2.ms-lg-3 {
        display: none !important; 
    }
    
    /* FIX 3: Reduce overall padding and fix overlap on mobile */
    .main-content-area-mobile {
        /* Adjusted padding-top: Navbar (52) + Sticky Header (60) = ~112px. Using 120px for safety. */
        padding-top: 120px !important; 
        /* Reduced horizontal padding for shopping page rows/grid */
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}
/* Desktop Search Fix: Hide the mobile sticky header components on desktop */
@media (min-width: 992px) {
    .sticky-mobile-header {
        position: static !important;
        background-color: var(--light-bg) !important;
        box-shadow: none !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
}

/* --- Category Grid (Mobile Shopping Page - Matching App Look) --- */
/* CRITICAL FIXES FOR CLUMSY/ZOOM ISSUES */
#categoryIconGridContainer {
    /* FIX 3: Reduced lateral padding here for compact look */
    padding: 0 0.5rem; 
    margin-bottom: 1rem;
    /* Ensure grid container scrolls horizontally on small screens */
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap; /* Forces content into a line */
}
/* Hides scroll bar on iOS devices */
#categoryIconGridContainer::-webkit-scrollbar {
    display: none;
}
#categoryIconGridContainer {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

#categoryIconGrid {
    /* Forces grid items into a single non-wrapping row, relying on parent overflow-x */
    flex-wrap: nowrap !important; 
    width: max-content; 
    padding-bottom: 5px; /* space for potential scroll bar */
}

.category-icon-item {
    text-align: center;
    text-decoration: none;
    color: var(--text-dark);
    /* Set fixed width for each item (adjusting from 90px for 5-6 items per row) */
    min-width: 80px; 
    max-width: 80px;
    display: inline-block; /* Use inline-block to respect width in the non-wrapping container */
    flex-direction: column; 
    align-items: center;
    padding: 5px 0;
    transition: background-color 0.1s;
    /* Fix alignment with inline-block */
    margin-right: 5px;
}
/* Add subtle press down effect to categories */
.category-icon-item:active {
    transform: scale(0.98);
}


.category-icon-item.active {
    border-bottom: 2px solid var(--primary-blue);
}

.category-icon-item .category-icon {
    width: 55px; /* Fixed icon size (slightly smaller) */
    height: 55px; 
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    border-radius: 50%; /* Circle background */
    overflow: hidden;
    background-color: #f3f3f3;
}

.category-icon-item .category-icon img {
    width: 100%; /* FIX 4: Image now fills the circle completely */
    height: 100%; /* FIX 4: Image now fills the circle completely */
    object-fit: cover; /* FIX 4: Ensures image covers the circle without distortion/clumsiness */
    padding: 0; /* Remove internal padding on image to fill circle */
    border-radius: 50%; /* Ensure image itself is also rounded if overflow is hidden */
}

.category-icon-item span {
    font-size: 0.7rem; /* Smaller font for mobile legibility */
    font-weight: 500;
    line-height: 1.1;
    display: block;
    height: 2.2em; /* Ensure two lines of text fit */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal; /* Allow wrapping within the fixed width */
}

/* --- Mini Cart Bar --- */
.mini-cart-bar {
    position: fixed;
    bottom: 60px; /* Sits right above the fixed bottom-nav */
    left: 0;
    right: 0;
    background: linear-gradient(to right, var(--primary-blue), #031e3d);
    color: white;
    padding: 10px 15px;
    z-index: 1059; /* Below bottom-nav (1060) */
    display: none;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.2);
    /* Add transition for smooth appearance/disappearance */
    transition: transform 0.3s ease-out;
}
.mini-cart-bar.active {
    display: flex; /* Use flex to ensure layout remains correct */
    transform: translateY(0);
}
.mini-cart-bar:not(.active) {
    transform: translateY(100%);
    display: none; /* Hide when not active */
}
.mini-cart-bar .progress-text {
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 0;
    font-weight: 500;
    /* Styles for the inner message */
    color: var(--primary-blue);
    background-color: var(--primary-gold);
}

/* --- Product Row Layout (Slidable Rows) --- */
.product-row-container {
    margin-bottom: 2rem;
    /* FIX 3: Reduced horizontal padding for consistency */
    padding: 0 0.5rem;
}
.product-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-left: 5px;
}
.product-row-header h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin: 0;
}

.product-row-list {
    display: flex;
    overflow-x: scroll;
    white-space: nowrap;
    padding-bottom: 10px; /* Space for scrollbar */
    -webkit-overflow-scrolling: touch;
}
.product-row-list::-webkit-scrollbar {
    height: 4px;
}
.product-row-list::-webkit-scrollbar-thumb {
    background: var(--primary-gold);
    border-radius: 2px;
}
.product-row-list::-webkit-scrollbar-track {
    background: var(--secondary-gray);
}

.product-row-item {
    flex: 0 0 140px; /* Fixed width for each card */
    max-width: 140px; 
    margin-right: 12px;
    /* Reset Bootstrap column spacing */
    padding: 0 !important; 
    /* Add animation delay for staggered entrance */
    animation-delay: 0.1s; 
}

/* --- Product Card Styling (Used in Rows and Grid) --- */
.product-card {
    border: 1px solid #eee;
    border-radius: 0.75rem;
    overflow: hidden;
    /* Add transition for hover/tap scale effect */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    /* Subtle inner shadow for depth */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.product-row-item-card {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* Lighter shadow for rows */
}
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.product-card:active {
    /* Instant press-down effect on touch/tap */
    transform: scale(0.98);
}

.product-card-image-container {
    height: 120px; 
    overflow: hidden;
    position: relative;
    background-color: white; /* Ensure background is white for 'contain' images */
}
.product-card-image {
    width: 100%;
    height: 100%;
    /* CRITICAL FIX: Shows full image without cropping */
    object-fit: contain; 
    transition: transform 0.5s ease;
}

/* FIX: ADD Button visibility and positioning */
.quantity-area-row {
    position: absolute;
    bottom: 5px;
    right: 5px;
    z-index: 10;
}
.quantity-area-row button.btn-gold {
    width: 35px;
    height: 35px;
    padding: 0;
    border-radius: 50%;
    background-color: var(--primary-gold);
    border: 1px solid var(--primary-gold);
    color: var(--primary-blue);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: transform 0.1s;
}
.quantity-area-row button.btn-gold:active {
    transform: scale(0.9); /* Subtle button press animation */
}


/* --- Daily Deals Specific Styles (Matching User's Image) --- */
.limited-deal-banner {
    position: absolute;
    top: 5px;
    left: 5px;
    display: flex;
    align-items: center;
    z-index: 10;
    border-radius: 6px;
    overflow: hidden;
}

.discount-percent-badge {
    background-color: var(--deal-red); 
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 8px;
    line-height: 1;
    white-space: nowrap;
}

.deal-text-badge {
    background-color: #f3f3f3; /* Light gray background */
    color: var(--deal-red); /* Red text */
    font-weight: 600;
    font-size: 0.75rem;
    padding: 4px 8px;
    line-height: 1;
    white-space: nowrap;
}

/* --- Daily Deals Section Header Styling --- */
.deals-timer-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1;
}


.product-card-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-height: 80px; /* Minimum height for text area */
}
.product-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 2px;
    min-height: 30px; 
}
.product-card-unit {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 4px;
}
.product-card-price-container {
    /* Align price details at the bottom of the card body */
    margin-top: auto; 
}
.product-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-blue);
}
.product-price-old {
    font-size: 0.7rem;
    text-decoration: line-through;
    color: #999;
}

/* Quantity Controls (After item is added) */
.quantity-control-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 80px; 
    border-radius: 50px;
    overflow: hidden;
    height: 30px;
    background-color: var(--primary-blue);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.quantity-control-card button {
    background-color: transparent;
    color: white;
    border: none;
    font-size: 1rem;
    width: 30px;
    height: 100%;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.1s, transform 0.1s;
}
.quantity-control-card button:hover {
    background-color: #031e3d;
}
.quantity-control-card button:active {
    transform: scale(0.9);
}
.quantity-control-card span {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
}

/* --- CRITICAL FIX 3: OUT OF STOCK STYLES --- */
.out-of-stock-card {
    position: relative;
    /* Adjusted filter for slight blur/desaturation, not full blur */
    filter: blur(0.5px) grayscale(30%); 
    pointer-events: none; /* Disables clicks on the card content */
    opacity: 0.9; /* Slightly dim the card */
}

.stock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20; /* Above all card content */
    display: flex;
    align-items: center;
    justify-content: center;
    /* Use a light overlay for visibility */
    background-color: rgba(255, 255, 255, 0.4); 
    border-radius: 0.75rem;
}

.stock-text {
    background-color: var(--maroon-bg);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.9rem;
    pointer-events: auto; /* Re-enables interaction for the text box itself */
    filter: none; /* Removes blur from text */
    white-space: nowrap;
}
/* --- END CRITICAL FIX 3 --- */

/* --- Item Request Chatbot Button --- */
.request-floating-btn {
    position: fixed;
    bottom: 75px; /* Above the fixed bottom nav */
    right: 15px;
    z-index: 1060;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: var(--aqua-bg);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); /* Stronger shadow */
    transition: transform 0.3s, background-color 0.3s;
}
.request-floating-btn:hover {
    background-color: #009999;
    transform: scale(1.05);
}
.request-floating-btn:active {
    transform: scale(0.95); /* Press-down effect */
}
/* Style for the modal (Chatbot look) */
.item-request-modal .modal-content {
    border-radius: 1rem;
}
.item-request-modal .modal-header {
    background-color: var(--aqua-bg);
    color: white;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

/* --- Desktop Styles and Overrides (for Shopping Page) --- */
@media (min-width: 992px) {
    .sticky-mobile-header {
        display: none !important;
    }
    
    /* Ensure single search bar is used, centered above content */
    .search-bar-desktop {
        padding: 10px 0 20px 0;
        background-color: var(--light-bg);
        margin-bottom: 20px;
    }

    /* Reset row item widths for the main grid when filtering/searching on desktop */
    .product-row-list {
        display: flex;
        flex-wrap: wrap; /* Allow wrapping */
        overflow-x: hidden;
        padding-left: 0;
    }
    .product-row-item {
        flex: 0 0 25%; /* 4 columns per row */
        max-width: 25%; 
        padding-right: 1rem !important; /* Re-introduce spacing */
        margin-right: 0 !important;
        margin-bottom: 1rem;
    }
    .product-row-item:nth-child(4n) {
         padding-right: 0 !important;
    }
    .product-row-container {
        padding: 0;
    }
}


/* Skeleton Loader Styles */
.skeleton {
    animation: pulse 1.5s infinite;
}
.skeleton-box {
    background-color: #e0e0e0;
    border-radius: 4px;
}
.skeleton-line {
    height: 10px;
    margin-bottom: 5px;
    background-color: #e0e0e0;
    border-radius: 2px;
}
.skeleton-line.short {
    width: 60%;
}
.skeleton-line.price {
    width: 50%;
    height: 16px;
    margin-bottom: 0;
}
.skeleton-box.add-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

@keyframes pulse {
    0% { background-color: #f0f0f0; }
    55% { background-color: #e0e0e0; }
    100% { background-color: #f0f0f0; }
}