/* =================================================================== */
/* --- THEME & COLOR SYSTEM --- */
/* =================================================================== */

:root {
    /* -- Light Theme (Default) -- */
    --color-background: #f8f9fa;       /* Very light grey */
    --color-surface: #ffffff;          /* White for cards, modals, header */
    --color-text-primary: #212529;     /* Nearly black for main text */
    --color-text-secondary: #6c757d;    /* Grey for subtitles, secondary info */
    --color-border: #e9ecef;           /* Light border color */
    --color-input-bg: #f1f3f4;          /* Background for search/select */
    --color-brand: #e91e63;             /* Your main pink */
    --color-brand-light: #fce4ec;       /* A very light pink for highlights */
}

body.dark-mode {
    /* -- Dark Theme (Professional Palette) -- */

    /* Layer 1: The very back background. A soft, desaturated blue-grey. */
    --color-background: #121212;

    /* Layer 2: The main surfaces like cards, modals, and the header. 
       It's slightly lighter than the background to create a sense of depth. */
    --color-surface: #1E1E1E;

    /* Primary text is never pure white. This off-white is much easier to read. */
    --color-text-primary: rgba(255, 255, 255, 0.87);

    /* Secondary text is a dimmer white, creating a clear visual hierarchy. */
    --color-text-secondary: rgba(255, 255, 255, 0.6);

    /* Borders are subtly lighter than the surfaces they contain. */
    --color-border: #2c2c2c;

    /* Inputs are slightly lighter than the surface they sit on. */
    --color-input-bg: #2c2c2c;

    /* The brand color is slightly desaturated to be less harsh on a dark background. */
    --color-brand: #f06292;

    /* The light brand color for highlights is a transparent version of the main brand color. */
    --color-brand-light: rgba(240, 98, 146, 0.1);

    /* This is the Global Reset. It forces all text to be light. */
    color: var(--color-text-primary);
    * {
        color: inherit;
    }
}

/* --- ADD THIS EXTRA RULE --- */
/* This adds a subtle box-shadow to cards in dark mode to help them "pop"
   from the background, further enhancing the sense of depth. */
body.dark-mode .product-card,
body.dark-mode .admin-content {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.dark-mode .header {
    background: rgba(30, 30, 30, 0.85);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}


/* =================================================================== */
/* --- THIS IS THE FINAL, CLEANED & CORRECTED CSS FOR THE ENTIRE APP --- */
/* =================================================================== */

/* --- GLOBAL STYLES --- */
* { margin: 0; padding: 0; box-sizing: border-box; touch-action: manipulation; /* Disable double-tap zoom globally */ }
html { height: 100%; overflow: hidden; }

/* --- Image Protection (No Right-Click/Drag/Long-Press) --- */
img {
    -webkit-user-drag: none;       /* Safari/Chrome */
    user-select: none;             /* Prevent selection */
    -webkit-user-select: none;     /* Safari */
    -webkit-touch-callout: none;   /* Disables long-press menu on iOS */
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    background: var(--color-background); 
    overflow: hidden; /* Prevent body scroll, use flex layout */
    display: flex;
    flex-direction: column;
    /* Fix for iOS Safari header jumping/hiding */
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
}

/* --- FIX: Prevent background scroll when a modal is open --- */
/* This class is added/removed by JavaScript in ui.js */
body.modal-open {
    overflow: hidden;
}

/* --- HEADER STYLES (NEW & SIMPLIFIED) --- */
.header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 16px;
    /* Ensure header respects safe area (notch) */
    padding-top: max(10px, env(safe-area-inset-top));
    box-shadow: 0 4px 24px rgba(0,0,0,0.03);
    position: relative; /* Changed from sticky to relative for flex layout */
    z-index: 100;
    flex-shrink: 0; /* Prevent header from shrinking */
    border-bottom: 1px solid rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;

    /* --- NEW: Central Control for Header Icons --- */
    /* Play with these values to adjust all icons at once */
    --header-icon-size: 40px; /* The size of the circular button */
    --header-icon-content-size: 28px; /* The size of the icon/svg/emoji inside */
    --header-icon-bg: transparent; /* Default background for icons */
    --header-icon-color: var(--color-text-primary); /* Default color for SVGs and emojis */
    --header-icon-hover-bg: var(--color-background); /* A very light grey for hover */
}

/* --- [CONTROL PANEL] Product Grid & Card Layout --- */
:root {
    /* Play with these values to customize the product grid layout */

    /* 1. Grid Columns */
    --grid-gap: 12px;               /* Space between product cards */

    /* 2. Product Image Style */
    --product-image-height: 140px;    /* Height of the image area */
    --product-image-fit: cover;     /* How image fits: 'cover' (fills space) or 'contain' (shows full image) */
}

/* Container for each of the three sections */
.header-section {
    display: flex;
    align-items: center;
}
/* Left section takes up as much space as its content */
.header-left {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

/* Center section is absolutely positioned to ensure perfect centering */
.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
}
.header-center h1 {
    background: linear-gradient(135deg, var(--color-brand) 0%, #ff4081 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 26px; 
    font-weight: 800; 
    letter-spacing: -1px;
    white-space: nowrap;
    filter: drop-shadow(0 2px 4px rgba(233, 30, 99, 0.15));
}

/* Right section takes up as much space as its content */
.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    margin-left: auto; /* Pushes this section to the far right */
}
/* Common style for all icons */
.header-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    border: none;
    gap: 2px;
    text-decoration: none;
    padding: 0 6px;
}
.header-action:hover .header-icon {
    background-color: var(--header-icon-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}
.header-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-secondary);
    line-height: 1;
    white-space: nowrap;
}

.header-icon {
    font-size: var(--header-icon-content-size); /* Use content size for emoji fallback */
    /* cursor: pointer; Removed, handled by parent */
    position: relative;
    /* This controls the size of the circular background button.
       To make the button bigger, increase these values (e.g., to 44px). */
    width: var(--header-icon-size);
    height: var(--header-icon-size);
    background-color: var(--header-icon-bg);
    color: var(--header-icon-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid transparent;
}
/* --- Cart Running Animation --- */
.cart-button.animate .header-icon {
    animation: cart-run 0.6s ease-in-out;
    background-color: var(--color-brand-light); /* Flash light pink */
    color: var(--color-brand);
    overflow: visible;
}

/* Animate the inner SVG to tilt like it's driving */
.cart-button.animate .header-icon svg {
    animation: cart-tilt 0.6s ease-in-out;
}

/* Ripple Effect (Reused from wishlist for consistency) */
.cart-button.animate .header-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 2px solid var(--color-brand);
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    animation: ripple-burst 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes cart-run {
    0% { transform: translateX(0) scale(1); }
    20% { transform: translateX(-2px) scale(0.98); } /* Subtle wind up */
    40% { transform: translateX(3px) scale(1.02); } /* Subtle drive */
    60% { transform: translateX(-1px) scale(1); } /* Subtle brake */
    80% { transform: translateX(0.5px) scale(1); }
    100% { transform: translateX(0) scale(1); }
}

@keyframes cart-tilt {
    0% { transform: rotate(0deg); }
    20% { transform: rotate(-6deg); } /* Subtle lean */
    45% { transform: rotate(8deg); } /* Subtle wheelie */
    70% { transform: rotate(-3deg); } /* Subtle dip */
    100% { transform: rotate(0deg); }
}

/* Style for the new <img> icons */
.header-icon-img {
    width: var(--header-icon-content-size);
    height: var(--header-icon-content-size);
    /* Use absolute positioning to layer the image over the fallback emoji */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* The background of the parent will show through if the image is transparent, so we inherit it */
    background-color: inherit;
    object-fit: contain;
}

/* The fallback emoji, which is visible if the image fails and is hidden by the onerror handler */
.icon-fallback {
    /* This should generally match the size of the icon content */
    font-size: var(--header-icon-content-size);
    line-height: 1;
}
.cart-badge {
    position: absolute;
    top: 0px;
    right: -2px;
    background: var(--color-brand);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    border: 2px solid white;
}

/* Cart Icon in Header */
.cart-button .cart-svg {
    width: var(--header-icon-content-size);
    height: var(--header-icon-content-size);
    stroke: currentColor; /* Use the parent's color */
    transition: all 0.2s ease;
}
.wishlist-badge {
    position: absolute;
    top: 0px;
    right: -2px;
    background: var(--color-brand);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    border: 2px solid white;
}

.orders-badge {
    position: absolute;
    top: 0px;
    right: -2px;
    background: var(--color-brand);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    border: 2px solid white;
}

/* Wishlist Icon in Header */
#wishlistHeaderIcon .wishlist-svg {
    width: var(--header-icon-content-size);
    height: var(--header-icon-content-size);
    transition: all 0.2s ease;
}
#wishlistHeaderIcon .wishlist-svg path {
    fill: none; /* Outline only by default */
    stroke: currentColor;
    stroke-width: 2;
}

.header-action.logged-in .header-icon {
    background-color: var(--color-brand); /* Brand color for logged-in state */
    color: #ffffff; /* White icon on pink background */
}
/* Active state for when items are in the wishlist */
#wishlistHeaderIcon.active .wishlist-svg path {
    fill: var(--color-brand); /* Filled pink when active */
    stroke: var(--color-brand);
}
.admin-toggle {
    display: none; /* Hidden by default */
}

/* --- LOCATION BANNER --- */
.location-banner {
    position: relative; /* Changed from fixed */
    /* top: 60px; Removed */
    /* left: 0; Removed */
    width: 100%;
    background-color: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    z-index: 99;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    border-bottom: 1px solid #ffeeba;
    font-size: 14px;
    /* transform: translateY(-150%); Removed */
    /* transition: transform 0.4s ease-in-out; Removed */
    flex-shrink: 0; /* Prevent shrinking */
}
.location-banner.show {
    display: flex;
    animation: bannerSlideDown 0.3s ease-out;
}
@keyframes bannerSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.location-banner-btn {
    background-color: var(--color-brand);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
/* --- MAINTENANCE BANNER --- */
.maintenance-banner {
    position: relative; /* Changed from fixed */
    /* top: 60px; Removed */
    /* left: 0; Removed */
    width: 100%;
    background-color: #fff5f6; /* subtle red-tint */
    color: #842029;
    padding: 10px 16px;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(216, 46, 77, 0.08);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    gap: 12px;
    font-size: 14px;
    flex-shrink: 0; /* Prevent shrinking */
}
.maintenance-banner .maintenance-text {
    flex: 1;
    text-align: left; /* left-align for readability */
}
.maintenance-banner .maintenance-close {
    background: transparent;
    border: none;
    color: #842029;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .maintenance-banner { padding: 10px; font-size: 13px; }
    .maintenance-banner .maintenance-text { text-align: center; }
}
/* =================================================================== */
/* --- LAYOUT & SCROLL BEHAVIOR FIX --- */
/* =================================================================== */

html {
    /* scroll-padding-top removed as main scroll is now within divs */
    scroll-behavior: smooth; /* Optional: adds a nice scroll effect */
}

/* --- MAIN CONTAINER & SIDEBAR --- */
.container { 
    display: flex; 
    flex: 1; /* Take remaining vertical space */
    height: auto; /* Reset fixed height */
    min-height: 0; /* Critical for nested scrolling in flex */
    overflow: hidden; /* Container doesn't scroll, children do */
}
.category-sidebar { width: 80px; background: var(--color-surface); border-right: 1px solid var(--color-border); overflow-y: auto; padding: 8px 0; flex-shrink: 0; overscroll-behavior-y: contain; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.category-item { display: flex; flex-direction: column; align-items: center; padding: 6px 4px; cursor: pointer; transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); border-radius: 12px; margin: 3px 4px; border: 1px solid transparent; }
.category-item:hover { background: var(--color-background); transform: translateY(-1px); }
.category-item.active { background: var(--color-brand-light); color: var(--color-brand); box-shadow: 0 4px 12px rgba(233, 30, 99, 0.15); border-color: rgba(233, 30, 99, 0.1); transform: scale(1.02); }
.category-item.active .category-name { font-weight: 700; letter-spacing: -0.2px; }
.category-icon { font-size: 24px; margin-bottom: 4px; transition: transform 0.2s; }
.category-item.active .category-icon { transform: scale(1.1); }
.category-name { font-size: 10.5px; text-align: center; line-height: 1.2; font-weight: 500; }

/* --- PRODUCT SECTION & CARDS --- */
.products-section { 
    flex: 1; 
    overflow-y: auto; 
    padding: 8px 12px; 
    overscroll-behavior-y: contain; 
    /* Add a safe area at the bottom for mobile browser UI (e.g., Safari nav bar) */
    padding-bottom: calc(120px + env(safe-area-inset-bottom)); 
}
.product-controls {
    display: flex;
    align-items: center;
    gap: 8px; /* Creates space between search and sort */
    margin-bottom: 6px; /* Reduced space below controls */
    flex-wrap: wrap;
}

.search-bar-wrapper {
    flex: 1;
    min-width: 150px;
    position: relative;
}

#searchInput {
    width: 100%;
    /* --- NEW: Add search icon as background --- */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 16px center; /* Adjust icon position for pill shape */
    padding-left: 42px; /* Adjust padding for icon */
}

.search-placeholder {
    position: absolute;
    top: 0;
    left: 42px;
    height: 100%;
    display: flex;
    align-items: center;
    color: var(--color-text-secondary);
    pointer-events: none;
    font-size: 14px;
    overflow: hidden;
    opacity: 0.8;
}

#placeholderWord {
    display: inline-block;
    margin-left: 4px;
    position: relative;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.placeholder-hidden {
    opacity: 0 !important;
    visibility: hidden;
}

.product-controls #sortSelect.form-select {
    width: auto;       /* Let it size to its content */
    flex-shrink: 0;    /* Prevent it from being squished */
    padding: 8px 12px; /* Make it smaller */
    font-size: 13px;   /* Make it smaller */
}

/* --- NEW: Modern, borderless, pill-shaped controls --- */
.product-controls #searchInput,
.product-controls .form-select {
    padding-top: 8px;
    padding-bottom: 8px;
    border: none;
    background-color: #f1f3f4;
    border-radius: 16px; /* Pill shape */
}

/* --- NEW: Specific focus style for product controls --- */
.product-controls #searchInput:focus,
.product-controls .form-select:focus {
    background-color: #e9ecef; /* Slightly darker on focus */
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.15);
}

/* --- NEW: Enhanced Section Title Styling --- */
.section-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-primary);
    width: fit-content;
    border-bottom: none;
    text-transform: capitalize;
    letter-spacing: -0.3px;
    padding-bottom: 2px;
    margin-bottom: 12px;
    margin-top: 6px;
    line-height: 1.2;
}

.form-input:focus, .form-select:focus {
    outline: none;
    /* border-color: var(--color-brand); <-- This is removed to support borderless inputs */
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.15);
}

/* --- NEW: Search History --- */
.search-history-container {
    margin: -8px 0 16px 0;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-history-item {
    background-color: #f1f3f4;
    color: var(--color-text-primary);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.search-history-item:hover {
    background-color: #e9ecef;
}

.products-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); 
    gap: 6px; 
    transition: opacity 0.15s ease-in-out; 
}

@media (max-width: 500px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
        gap: 4px;
    }
}

.product-card { background: var(--color-surface); border-radius: 12px; padding: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03); transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); position: relative; border: 1px solid transparent; display: flex; flex-direction: column; overflow: hidden; }
/* This rule hides the star rating from the main product grid for a cleaner look. */
.product-card .rating {
    display: none;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px -8px rgba(0,0,0,0.15); border-color: transparent; }
.product-card.out-of-stock { opacity: 0.6; }
/* .product-card.out-of-stock::after { content: 'Out of Stock'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(233, 30, 99, 0.9); color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; } */
/* .product-details { flex-grow: 1; display: flex; flex-direction: column; }
.product-image { position: relative; width: 100%; height: 130px; background: var(--color-background); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 32px; margin-bottom: 8px; } */
.product-details {
    flex-grow: 1;
    /* --- THIS IS THE KEY CHANGE --- */
    /* By making this a flex container, we can precisely control its children's sizes */
    display: flex;
    flex-direction: column; 
}

.product-image {
    position: relative;
    width: 100%;
    /* --- THIS IS THE VALUE YOU "PLAY WITH" --- */
    /* I've increased it to 130px as a starting point.
       Change this to 150px to make the image even taller.
       Change it to 110px to make it shorter. */
    height: 125px;
    background: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 4px;
    /* This makes sure the image div does not shrink */
    flex-shrink: 0; 
}
.product-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: 0;
}
/* New container for name and weight to push price/rating to the bottom */
.product-info-top {
    flex-grow: 1; /* This is the key change: it takes up all available vertical space */
    margin-bottom: 4px; /* Add some space before the price section */
}
/* --- NEW: Admin Stock Info (Inline) --- */
.admin-stock-info {
    font-size: 11px;
    font-weight: 600;
    color: #dc3545; /* Red to draw attention */
}
.product-weight { font-size: 12px; color: var(--color-text-secondary); }
.price-section { display: flex; align-items: baseline; gap: 4px; margin-bottom: 4px; flex-wrap: wrap; }
.current-price { font-size: 14px; font-weight: 700; color: var(--color-text-primary); }
.original-price { font-size: 11px; color: var(--color-text-secondary); text-decoration: line-through; margin-right: 2px; }
.discount { background: rgba(34, 197, 94, 0.1); color: #16a34a; font-size: 10px; padding: 2px 6px; border-radius: 6px; font-weight: 700; display: inline-block; }
.rating { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-top: auto; } /* Use margin-top: auto to push to bottom */
.rating-text { color: var(--color-text-secondary); }

/* Product-level star display in orders */
.star-display { font-size: 18px; color: var(--color-brand); letter-spacing: 2px; }
.star-action .star-link { color: var(--color-brand); text-decoration: none; font-size: 20px; padding: 0 2px; }
.star-action .star-link:hover { transform: scale(1.06); }
.order-review-stars { font-size: 18px; color: var(--color-brand); margin-bottom: 6px; }
.add-button-container { position: absolute; bottom: 5px; right: 5px; z-index: 5; }
.add-button { position: relative; width: auto; height: 32px; padding: 0 16px; font-size: 13px; font-weight: 700; border-radius: 10px; box-shadow: 0 4px 10px rgba(233, 30, 99, 0.3); background: var(--color-brand); color: white; border: none; cursor: pointer; transition: all 0.2s; }
.add-button:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(233, 30, 99, 0.4); }
.add-button:active { transform: scale(0.95); }
.add-button:disabled { background: #e9ecef; color: #adb5bd; cursor: not-allowed; padding: 0 12px; font-size: 11px; box-shadow: none; transform: none; }

.card-quantity-selector { width: auto; height: 32px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); box-shadow: 0 2px 8px rgba(0,0,0,0.08); overflow: hidden; display: flex; align-items: center; }
.card-quantity-selector .quantity-btn { background: transparent; color: var(--color-brand); width: 30px; height: 30px; border: none; font-size: 18px; cursor: pointer; border-radius: 0; box-shadow: none; display: flex; align-items: center; justify-content: center; padding-bottom: 2px; }
.card-quantity-selector .quantity-btn:hover { background: var(--color-brand-light); color: var(--color-brand); }
.card-quantity-selector .cart-item-quantity { padding: 0 6px; font-size: 14px; min-width: 24px; text-align: center; }

/* Global Quantity Button Style (Modern Fallback) */
.quantity-btn { 
    background: var(--color-background); 
    border: 1px solid var(--color-border); 
    width: 28px; 
    height: 28px; 
    border-radius: 50%; 
    cursor: pointer; 
    font-weight: 700; 
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
    padding-bottom: 2px;
}
.quantity-btn:hover { background: #e9ecef; color: var(--color-brand); }
.quantity-btn:active { transform: scale(0.9); }
/* .product-image-tag { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; } */
.product-image-tag { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.product-image-emoji, .product-image-emoji-fallback { font-size: 32px; }
.product-image-emoji-fallback { display: none; }
.product-image img[style*="display: none"] + .product-image-emoji-fallback { display: flex; }

.hub-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    z-index: 4;
    pointer-events: none;
    letter-spacing: 0.5px;
    backdrop-filter: blur(2px);
}

.hub-badge.open {
    background-color: rgba(34, 197, 94, 0.9);
}

.category-image-wrapper {
    width: 50px;
    height: 60px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 480px) {
    .category-image-wrapper {
        width: 55px;
        height: 65px;
    }
}

/* This styles the new <img> tag for category images */
.category-image-tag {
    width: 110%;
    height: 110%;
    border-radius: 16px;
    object-fit: cover;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.category-item.active .category-image-tag {
    transform: scale(1.08);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
/* Product modal description collapsed/expanded */
.product-modal-desc {
    display: block;
    max-height: 3.6em; /* ~2 lines */
    overflow: hidden;
    text-overflow: ellipsis;
}
.product-modal-desc.expanded {
    max-height: 400px; /* sufficiently large to show full text */
}
/* --- MODALS (GENERAL) --- */
/* FIX: Use 100dvh to account for mobile browser address bars */
.admin-panel { position: fixed; top: 0; left: 0; width: 100%; height: 100%; height: 100dvh; background: rgba(0, 0, 0, 0.8); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; transform: translateZ(0); }
.admin-content { position: relative; background: var(--color-surface); border-radius: 12px; width: 100%; max-width: 400px; max-height: 90vh; max-height: 90dvh; display: flex; flex-direction: column; overflow: hidden; }

/* --- NEW: Modal Processing Overlay --- */
.modal-processing-overlay {
    position: absolute;
    inset: 0; /* Modern shorthand for top: 0; right: 0; bottom: 0; left: 0; */
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 100; /* Ensure it's above the modal body content */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px; /* Match the parent modal's border-radius */
}

/* Dark mode version of the overlay */
body.dark-mode .modal-processing-overlay {
    background-color: rgba(30, 30, 30, 0.7);
}
/* Make the header sticky so it remains visible while the modal body scrolls */
.admin-header { padding: 12px 12px; border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 5; background: var(--color-surface); }
.admin-header-actions-left, .admin-header-actions-right { display: flex; align-items: center; z-index: 2; }
.admin-header-actions-right { justify-content: flex-end; }
/* Added flex properties to center icon + text together */
.admin-title { font-size: 18px; font-weight: 700; text-align: center; position: absolute; left: 50%; transform: translateX(-50%); max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 4px; }
.close-admin { background: none; border: none; font-size: 28px; cursor: pointer; color: var(--color-text-secondary); padding: 0 4px; line-height: 1; display: flex; align-items: center; height: 32px; }
.back-modal-btn { background: none; border: none; cursor: pointer; color: var(--color-text-primary); display: flex; align-items: center; padding: 4px; margin-right: 4px; border-radius: 50%; transition: background-color 0.2s; }
.back-modal-btn:hover { background-color: var(--color-background); }
/* --- New Header Icon Button (Reload/Refresh) --- */
.header-icon-btn { background: transparent; border: none; cursor: pointer; color: var(--color-text-secondary); padding: 6px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.2s; margin-left: 4px; }
.header-icon-btn:hover { background-color: var(--color-background); color: var(--color-brand); }
.admin-body { padding: 12px; overflow-y: auto; }
.form-group { margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--color-text-primary);
}
.form-group.required label::after { content: ' *'; color: #dc3545; margin-left: 4px; }
.form-input, .form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit; /* Fix for textarea monospace */
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.15);
}
.address-input { flex-grow: 1; }
.form-link { font-size: 13px; color: var(--color-brand); text-decoration: none; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; transition: all 0.2s; padding: 4px 6px; border-radius: 4px; }
/* --- FIX: Add focus state to prevent "sticky" hover styles on click --- */
.form-link:hover, .form-link:focus {
    color: #c2185b;
    background-color: #fce4ec;
    outline: none; /* Remove default browser focus outline */
}
.form-error { color: #dc3545; font-size: 12px; margin-bottom: 12px; min-height: 14px; }
/* --- FIX: Removed 'flex: 1' from the base button style. --- */
/* This property is for layout and should not be in a generic component style. */
/* It was causing buttons to stretch vertically in column-based flex containers. */
.btn-primary, .btn-danger {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 15px;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease, background-color 0.2s;
    position: relative;
    letter-spacing: 0.3px;
}
.btn-primary:active, .btn-danger:active { transform: scale(0.97); }

.btn-primary { 
    background: var(--color-brand); 
    color: white; 
    box-shadow: 0 4px 14px rgba(233, 30, 99, 0.25);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.35);
    transform: translateY(-1px);
}

.btn-danger { 
    background: #dc3545; 
    color: white;
    box-shadow: 0 4px 14px rgba(220, 53, 69, 0.2);
}

/* --- BUTTON LOADING STATE (Spinner removed due to alignment issues) --- */
/* The loading state now just dims the button and makes it unclickable. */

.btn-loading {
    opacity: 0.7;
    cursor: wait;
}
.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 12px 20px;
    font-size: 15px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.btn-secondary:hover {
    background: var(--color-background);
    border-color: #adb5bd;
    transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0) scale(0.97); }

/* --- NEW: Pin on Map Button & Address Divider --- */
.btn-pin-on-map {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* Padding and font-weight are now inherited from .btn-secondary for visual consistency */
}

.address-divider {
    text-align: center;
    margin: 16px 0;
    color: #adb5bd;
    font-size: 12px;
    font-weight: 600;
    position: relative;
}
.address-divider span {
    background: var(--color-surface);
    padding: 0 10px;
    position: relative;
    z-index: 1;
}
.address-divider::before {
    content: ''; position: absolute; top: 50%; left: 0;
    width: 100%; height: 1px; background: #e9ecef; z-index: 0;
}

/* --- NEW: Address Form Styling --- */
.address-form-container {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.btn-add-address {
    display: block;
    width: 100%;
    padding: 4px;
    margin-top: 10px;
    background-color: transparent;
    border: 2px dashed var(--color-border);
    border-radius: 8px;
    text-align: center;
    color: var(--color-text-secondary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}
.btn-add-address:hover {
    background-color: var(--color-background);
    border-color: var(--color-text-secondary);
    color: var(--color-text-primary);
}

/* --- CART & CHECKOUT --- */
#cartItemsContainer {
    flex-grow: 1; /* Allows this element to grow and fill available space */
    overflow-y: auto; /* This is now the primary vertical scroller */
    padding: 0 4px; /* Add horizontal padding */
    overscroll-behavior-y: contain; /* Prevent scroll chaining to the main page */
}
/* --- NEW: Specific Layout for Cart Modal to Fix Scrolling --- */
#cartModal .admin-body {
    display: flex;
    flex-direction: column;
    padding: 0; /* Remove padding, children will handle it */
    overflow-y: hidden; /* CRITICAL: Disable scrolling on the body itself */
}

#cartModal #cartSuggestedContainer,
#cartModal .cart-footer {
    flex-shrink: 0; /* Prevent the footer and suggestions from shrinking */
    padding-left: 20px;
    padding-right: 20px;
}

.empty-cart-container { text-align: center; padding: 20px; }
.empty-cart-container .icon, .empty-state-container .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}
.empty-cart-container h4, .empty-state-container h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text-primary);
}
.empty-cart-container p, .empty-state-container p {
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}
.empty-cart-container .btn-primary {
    width: auto;
    padding: 10px 20px;
}
/* --- Modern Cart Redesign --- */
.cart-item {
    display: grid;
    grid-template-columns: auto 1fr auto; /* Image | Details | Actions */
    gap: 12px;
    padding: 12px 10px; /* Tighter padding for mobile alignment */
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    transition: background 0.2s;
    align-items: center;
}
.cart-item:last-child { border-bottom: none; }

.cart-item-image-box {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}
.cart-item-img { width: 100%; height: 100%; object-fit: contain; }
.cart-item-emoji { font-size: 28px; }

.cart-item-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Text truncation fix */
    margin-left: 0; /* Reset */
}

.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 2px;
    cursor: pointer;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Allow 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}

.cart-item-meta {
    font-size: 13px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.cart-item-price {
    font-weight: 700;
    color: var(--color-text-primary);
    font-size: 14px;
}

.stock-info {
    font-size: 11px;
    color: #e91e63; /* Brand color for attention */
    background: rgba(233, 30, 99, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    display: inline-block;
    width: fit-content;
}

/* Modern Quantity Pill */
.cart-qty-pill {
    display: flex;
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    height: 34px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    overflow: hidden;
}

.cart-qty-btn {
    width: 32px;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--color-brand);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 2px;
    transition: background 0.2s;
}
.cart-qty-btn:hover { background: var(--color-background); }
.cart-qty-btn:active { background: #e0e0e0; }

.cart-qty-val {
    font-size: 14px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    color: var(--color-text-primary);
}

/* Disabled/Stock States */
.cart-item.disabled-item {
    background: #fff5f5;
    opacity: 1; /* Keep visible but distinct */
    grid-template-columns: auto 1fr auto;
}
.cart-item.disabled-item .cart-item-name { color: #dc3545; }
.cart-item.disabled-item .cart-item-image-box { opacity: 0.6; filter: grayscale(100%); }

/* Cart Footer Enhancements */
#cartModal .cart-footer {
    padding: 16px 20px;
    background: var(--color-surface);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
    border-top: 1px solid var(--color-border);
    z-index: 10;
}

.cart-footer .btn-primary, .cart-footer .btn-secondary { flex: 1; }

#deliveryEligibilitySummary {
    margin: 0 0 12px 0;
    padding: 10px 14px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
}
#deliveryEligibilitySummary span.eligible { color: #16a34a; }
#deliveryEligibilitySummary span.needs-more { color: #d97706; }

#checkoutOrderSummary { background: var(--color-background); border-radius: 8px; padding: 12px; margin-bottom: 20px; border: 1px solid var(--color-border); }

/* --- NEW: Checkout Action Buttons --- */
.checkout-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.checkout-actions .btn-primary,
.checkout-actions .btn-secondary {
    width: 100%;
}

/* --- NEW: Admin Settings --- */
.settings-section {
    margin-bottom: 16px;
}
#settings .form-group {
    padding: 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
}
#settings .form-group:hover { background: var(--color-background); }
#settings #saveSettingsBtn { width: 100%; }

/* --- NEW: Admin Settings --- */
.settings-section {
    margin-bottom: 16px;
}
#settings .form-group {
    padding: 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
}
#settings .form-group:hover { background: var(--color-background); }
#settings #saveSettingsBtn { width: 100%; }
.summary-item { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 6px; }
.summary-item-details { flex-grow: 1; margin-left: 8px; }
.summary-totals { border-top: 1px solid #dee2e6; padding-top: 10px; margin-top: 10px; }
.summary-totals .summary-item { font-size: 14px; }

/* Checkout & Order summary styling */
.price-old { text-decoration: line-through; color: var(--color-text-secondary); margin-left: 8px; font-size: 12px; }
.price-new { font-weight: 700; color: var(--color-text-primary); margin-right: 6px; }
.item-qty { color: var(--color-text-secondary); margin-left: 6px; }
.line-savings { font-size: 12px; color: #28a745; margin-top: 4px; }
.savings-amount { color: #28a745; font-weight: 700; }
/* Updated margin to -8px to align text with parent content while keeping background padding */
.summary-savings { background: #e6ffed; border: 1px solid #c8f7d1; padding: 8px; border-radius: 8px; margin: 8px -8px; color: #155724; display: flex; justify-content: space-between; align-items: center; }

/* Improve alignment and spacing for mobile */
@media (max-width: 480px) {
    /* --- FIX: Prevent auto-zoom on input focus on iOS --- */
    .form-input, .form-select, .form-input:focus, .form-select:focus {
        font-size: 16px !important; /* Must be 16px+ to prevent zoom */
    }
    /* --- NEW: Responsive Modal Positioning --- */
    .admin-panel {
        padding: 0; /* Remove padding to allow content to go edge-to-edge */
        align-items: flex-end; /* Align modal to bottom */
    }
    .admin-content {
        width: 100%;
        max-width: 100%; /* Go edge-to-edge */
        /* FIX: Use dvh for mobile sheet height to avoid address bar overlap */
        max-height: 97dvh; 
        min-height: 97dvh;
        border-radius: 16px 16px 0 0; /* Round top corners */
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        padding: 12px; /* Keep internal padding */
        /* FIX: Ensure bottom padding respects safe area (home bar) */
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        animation: modal-slide-up 0.3s ease-out;
    }

    /* --- FIX: Prevent map modal from animating to avoid resize-observer loop --- */
    #mapPickerModal .admin-content {
        animation: none;
    }

    /* --- FIX: Ensure map modal body fills space on mobile --- */
    /* This removes the "white space" below the map and correctly contains the "My Location" button. */
    #mapPickerModal .admin-body {
        display: flex;
        flex-direction: column;
        flex-grow: 1; /* Make the body fill the vertical space of the modal content */
        padding: 0; /* Remove body padding, as parent .admin-content provides it */
    }

    @keyframes modal-slide-up {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    /* Changed align-items to center for better vertical alignment */
    .summary-item { align-items: center; font-size: 14px; }
    .summary-item-details { margin-left: 0; }
    .summary-item .summary-item-total { min-width: 72px; text-align: right; font-weight: 700; }
    .summary-item-meta { margin-top: 6px; display: flex; gap: 8px; align-items: center; }
    .summary-savings { margin-top: 6px; margin-bottom: 6px; }
    .summary-totals .summary-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
    .line-savings { margin-top: 4px; font-size: 13px; }
    .price-new { font-size: 16px; }
    .price-old { font-size: 13px; }
}

/* Slight spacing fix for desktop narrow modals */
@media (min-width: 481px) {
    .admin-content { max-width: 520px; }
}

/* --- Refined Coupon Section Styling --- */

/* The main container for the whole coupon block */
.coupon-section {
    background: var(--color-background); /* A light, clean background */
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin: 16px 0;
    padding: 12px;
}

/* Container for the list of available coupons */
#availableCouponsContainer {
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--color-border); 
}

/* Title "Available Coupons" */
.available-coupons-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary); /* Darker text for better contrast */
    margin: 0 0 12px 0;
}

/* Flex container for the coupon tags */
.available-coupons-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Individual clickable coupon tag */
.available-coupon-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-surface);
    border: 1px dashed #e91e63;
    color: var(--color-brand);
    padding: 8px 14px;
    border-radius: 6px; /* A more modern, slightly squared-off radius */
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
}


/* The coupon code itself, e.g., "SAVE10" */
.available-coupon-tag strong {
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

/* The discount description, e.g., "10% OFF" */
.available-coupon-tag span {
    font-size: 11px;
    opacity: 0.9;
}

.coupon-input-group {
    display: flex;
}

.coupon-input-group .form-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    flex-grow: 1;
}

.coupon-input-group .btn-secondary {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Container for success/error messages */
#couponMessageContainer {
    min-height: 0px; /* Prevent layout shifts */
    margin-top: 8px;
}

/* The message paragraph itself */
#couponMessage {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

/* Success text styling */
.coupon-success-text {
    color: #28a745;
    font-size: 13px;
    font-weight: 500;
}

/* Error text styling */
.coupon-error-text {
    color: #dc3545;
    font-size: 13px;
}

/* The "Remove" link for an applied coupon */
.remove-coupon-link {
    font-size: 12px;
    color: var(--color-brand);
    text-decoration: none;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.remove-coupon-link:hover {
    background-color: #fce4ec; /* Light pink background on hover */
    text-decoration: none;
}

/* --- Styling for Active/Inactive Coupon States --- */

/* Active state for a selected coupon */
.available-coupon-tag.active {
    background-color: var(--color-brand);
    color: #fff;
    border-color: var(--color-brand);
    border-style: solid;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.25);
    transform: translateY(-2px);
    cursor: default;
}

/* Add a checkmark to the active coupon */
.available-coupon-tag.active::before {
    content: '✔';
    font-size: 14px;
    margin-right: 6px;
    font-weight: bold;
}

/* Inactive state for other coupons when one is applied */
.available-coupon-tag.inactive {
    opacity: 0.6;
    filter: grayscale(80%);
    pointer-events: none; /* Make them unclickable */
}

/* Disabled state for coupons that don't meet criteria (e.g. min order) */
.available-coupon-tag.disabled {
    background-color: #f8f9fa;
    border-color: #e0e0e0;
    border-style: dashed;
    color: #9e9e9e;
    cursor: pointer; /* Keep clickable for details */
}
.available-coupon-tag.disabled strong {
    color: #757575;
}
.available-coupon-tag.disabled span {
    color: #9e9e9e;
}
.available-coupon-tag.disabled:hover {
    background-color: #f1f1f1;
    transform: none;
    box-shadow: none;
}



/* --- NEW: Confirmation Modal & Celebration --- */
.confirmation-content {
    text-align: center;
    padding: 10px 0;
    position: relative; /* Needed for confetti container */
}

.confirmation-icon {
    font-size: 64px;
    line-height: 1;
    animation: tada 1s ease-out;
}

.confirmation-content h2 {
    font-size: 24px;
    color: var(--color-brand);
    margin: 10px 0;
    font-weight: 700;
}

.confirmation-content p {
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    font-size: 14px;
}

.confirmation-order-id {
    margin: 15px 0;
    color: var(--color-text-primary);
    background: #f1f3f4;
    padding: 8px 16px;
    border-radius: 6px;
    display: inline-block;
    font-family: monospace;
    font-size: 16px;
    border: 1px solid #dee2e6;
}

.confirmation-summary-box {
    text-align: left;
    margin: 20px auto;
    padding: 12px;
    background: var(--color-background);
    border-radius: 8px;
    max-width: 340px;
    border: 1px solid var(--color-border);
}

.confirmation-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.celebration-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 3100;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 12px;
    top: -20px;
    opacity: 0;
    border-radius: 2px;
    left: var(--pos-x, 50%);
    background-color: var(--bg-color, #E91E63);
    animation: confetti-fall var(--duration, 3s) ease-in-out var(--delay, 0s) forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotateX(0) rotateY(0) rotateZ(0);
    }
    100% {
        opacity: 0;
        /* Fall down 110vh + drift horizontally + 3D rotation */
        transform: translate3d(var(--drift-x, 0px), 110vh, 0) rotateX(var(--rot-x, 360deg)) rotateY(var(--rot-y, 360deg)) rotateZ(var(--rot-z, 360deg));
    }
}

@keyframes tada {
  from { transform: scale3d(1, 1, 1); }
  10%, 20% { transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -5deg); }
  30%, 50%, 70%, 90% { transform: scale3d(1.2, 1.2, 1.2) rotate3d(0, 0, 1, 5deg); }
  40%, 60%, 80% { transform: scale3d(1.2, 1.2, 1.2) rotate3d(0, 0, 1, -5deg); }
  to { transform: scale3d(1, 1, 1); }
}

/* --- NEW: Re-order Modal --- */
#reorderItemsContainer {
    max-height: 45vh;
    overflow-y: auto;
    margin-bottom: 16px;
    padding-right: 5px; /* for scrollbar */
}

.reorder-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
    gap: 12px;
}

.reorder-item.out-of-stock {
    opacity: 0.5;
}

/* --- SUGGESTED PRODUCTS (Cart modal) --- */
/* --- NEW: Make suggestions less prominent until interacted with --- */
#cartSuggestedContainer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f3f4;
    opacity: 1; /* Start dimmed */
    transition: opacity 0.25s ease-in-out;
}

/* Reveal on hover or when a child element has focus */
#cartSuggestedContainer:hover,
#cartSuggestedContainer:focus-within {
    opacity: 1;
}

#cartSuggestedContainer h4 {
    margin: 0 0 12px 0; /* Replaces inline style */
    font-size: 14px;
}
.suggested-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain; /* Prevents horizontal scroll from trapping vertical scroll */
}
.suggested-strip::-webkit-scrollbar { height: 8px; }
.suggested-strip::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 6px; }
.suggested-card {
    flex: 0 0 140px; /* fixed card width, prevents huge images */
    background: var(--color-surface);
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.suggested-image { width: 100%; height: 90px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 6px; background: var(--color-background); }
.suggested-image img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Name: Fixed height for alignment (Restored) */
.suggested-name { 
    font-size: 13px; 
    font-weight: 600; 
    text-align: center; 
    line-height: 1.2; 
    height: 34px; /* Fixed height for 2 lines to ensure alignment */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 2px;
}

/* Price Line */
.suggested-price-line { 
    display: flex; 
    justify-content: center; 
    align-items: baseline; 
    gap: 8px; 
    margin-top: 4px; 
    margin-bottom: 6px;
}
.suggested-weight { font-size: 12px; color: var(--color-text-secondary); }
.suggested-price { font-size: 13px; font-weight: 700; color: var(--color-text-primary); }

/* Action Container */
.suggested-action { 
    width: 100%; 
    margin-top: auto; 
}

/* --- Suggested Add Button (Premium Outline) --- */
.suggested-add-btn {
    width: 100%;
    padding: 6px 0;
    background-color: transparent;
    color: var(--color-brand);
    border: 1px solid var(--color-brand);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.suggested-add-btn:hover {
    background-color: var(--color-brand);
    color: white;
}

/* Hub Closed Warning Style */
.hub-closed-warning {
    background-color: #fff1f2;
    border-bottom: 1px solid #ffe4e6;
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.hub-closed-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fee2e2;
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hub-closed-content { flex: 1; }
.hub-closed-title { font-weight: 700; color: #991b1b; font-size: 14px; margin-bottom: 2px; }
.hub-closed-text { font-size: 12px; color: #b91c1c; line-height: 1.4; }

/* Ensure card stretches to fill row height for alignment */
.suggested-card {
    flex: 0 0 130px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.suggested-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

@media (max-width: 480px) {
    .suggested-card { flex: 0 0 120px; }
    .suggested-image { height: 72px; }
}

.reorder-item-details { flex-grow: 1; }
.reorder-item-name { font-weight: 600; font-size: 14px; }
.reorder-item-stock-info {
    font-size: 11px;
    color: #dc3545; /* Error color */
    font-weight: 500;
}
.order-feedback {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f3f4;
    text-align: center;
}

.order-review-stars {
    font-size: 18px;
    color: var(--color-brand);
    margin-bottom: 6px;
}

.order-review-text {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-style: italic;
    margin-top: 4px;
}

/* --- TOAST NOTIFICATION --- */
#toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 30px; /* Pill shape */
    background: #333;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: bottom 0.5s ease;
    z-index: 2000;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center; /* Center text */
    gap: 16px;
    width: fit-content; /* Shrink to fit text */
    min-width: auto;    /* Remove fixed width */
    max-width: 90%;     /* Safety for mobile */
}
#toast.show { bottom: 20px; }
#toast.error { background: #dc3545; }

.toast-action {
    background-color: var(--color-brand);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

/* --- NEW: Animation for the checkout button in the toast --- */
@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--color-brand-rgb), 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(var(--color-brand-rgb), 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--color-brand-rgb), 0);
  }
}

.toast-action.toast-action-highlight {
  /* Apply the animation with a slight delay so it pulses after the toast has appeared */
  animation: pulse-glow 1.5s 1 ease-out;
  animation-delay: 0.3s;
}

/* --- PRODUCT MODAL (NEW & IMPROVED) --- */
.product-modal { display: flex; gap: 24px; }
.product-modal-left { position: relative; flex: 0 0 40%; display: flex; align-items: flex-start; justify-content: center; }
.product-modal-right { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.product-modal-image { width: 100%; height: auto; max-height: 400px; object-fit: contain; border-radius: 12px; background: var(--color-background); border: 1px solid var(--color-border); }
.product-modal-image-emoji { font-size: 72px; display: flex; align-items: center; justify-content: center; width: 100%; height: 320px; background: var(--color-background); border-radius: 8px; }
.product-modal-title { font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--color-text-primary); }
.savings-text { font-size: 14px; font-weight: 700; color: #28a745; margin-top: 4px; }
.product-modal-meta { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
.product-modal-meta .price-new { font-size: 22px; }
.product-modal-meta .price-old { font-size: 14px; color: var(--color-text-secondary); text-decoration: line-through; margin-left: 8px; }
.product-modal-meta .discount { font-size: 12px; padding: 4px 8px; }
.product-modal .product-rating { margin-top: -8px; font-size: 14px; }
.product-modal .product-rating-value { font-weight: 700; }
.product-modal .product-rating-count { color: var(--color-text-secondary); }
.product-hub-info { font-size: 13px; color: var(--color-text-secondary); margin-top: 4px; margin-bottom: 4px; }
.product-hub-info strong { color: var(--color-text-primary); font-weight: 600; }
.product-modal-actions { display: flex; gap: 12px; align-items: center; }

.product-modal-actions .btn-primary,
.product-modal-actions .modal-quantity-selector {
    flex-grow: 1;
}

.product-modal-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px;
    display: flex;
    justify-content: flex-end;
}

.image-overlay-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.image-overlay-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.info-button {
    position: absolute;
    bottom: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    color: var(--color-text-secondary);
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.info-button:hover {
    background: var(--color-surface);
    transform: scale(1.1);
}

.alert-box { padding: 10px; }
.alert-title { font-size: 18px; font-weight: bold; color: var(--color-text-primary); margin-bottom: 10px; }
.alert-message { font-size: 15px; color: var(--color-text-secondary); line-height: 1.6; }

.product-modal-description, .product-attributes, .related-products { padding-top: 16px; border-top: 1px solid #f1f3f4; }
.product-modal-description h4, .product-attributes h4, .related-products h4 { font-size: 14px; font-weight: 600; color: var(--color-text-primary); margin-bottom: 12px; }
.product-modal-desc, .product-modal-full p { color: var(--color-text-primary); line-height: 1.6; font-size: 14px; }
.product-modal-description .form-link { margin-top: 8px; }
.attributes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.attribute-item { background: var(--color-background); padding: 8px 12px; border-radius: 6px; }
.attribute-key { display: block; font-size: 11px; color: var(--color-text-secondary); font-weight: 500; margin-bottom: 2px; }
.attribute-value { font-size: 13px; font-weight: 600; color: var(--color-text-primary); }
.related-products-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.related-item { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; padding: 8px; cursor: pointer; text-align: center; transition: box-shadow 0.2s; }
.related-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.related-image { width: 100%; height: 80px; display: flex; align-items: center; justify-content: center; font-size: 24px; background: var(--color-background); border-radius: 6px; overflow: hidden; }
.related-image img { width: 100%; height: 100%; object-fit: contain; }
.related-name { font-size: 12px; margin-top: 8px; height: 32px; overflow: hidden; line-height: 1.3; }
.related-weight { font-size: 11px; color: var(--color-text-secondary); }
.related-price { font-weight: 700; color: var(--color-text-primary); margin-top: 4px; font-size: 13px; }

/* Side-by-side layout: Quantity (small) + Go to Cart (large) */
.footer-in-cart { display: flex; gap: 12px; align-items: center; width: 100%; }
.footer-in-cart .modal-quantity-selector { flex: 1; } /* Takes 1/3 space */
.go-to-cart-btn { flex: 2; } /* Takes 2/3 space */

@media (max-width: 700px) {
    .product-modal { flex-direction: column; }
    .product-modal-left { flex-basis: auto; }
    .product-modal-image { max-height: 300px; }
    .related-products-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Minimal toast variant: when only an action is present (no message)
   This prevents a full dark bar and centers the action button in a small pill. */
#toast.minimal {
    background: transparent;
    box-shadow: none;
    min-width: auto;
    padding: 0;
}

#toast.minimal .toast-action {
    background: var(--color-brand);
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 14px;
}

/* Ensure the action is centered when minimal */
#toast.minimal { display: flex; align-items: center; justify-content: center; }

/* Free delivery banner: fixed at bottom, uses transform/opacity for show/hide to avoid reflow/flicker */
.free-delivery-banner {
    position: fixed;
    bottom: 12px; /* slight gap from bottom to avoid overlapping floating checkout UI */
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: fit-content; /* Shrink to fit text */
    max-width: 90%; /* Prevent overflow on small screens */
    background: #fff8e6;
    color: #8a6d3b;
    border: 1px solid #ffeeba; /* Full border looks better on a pill */
    align-items: center;
    justify-content: center; /* Center content */
    padding: 10px 20px; /* More horizontal padding for pill shape */
    gap: 8px;
    z-index: 1001; /* below admin/modal overlays but above content */
    border-radius: 30px; /* Professional pill shape */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    transition: transform 260ms cubic-bezier(.2,.9,.2,1), opacity 260ms ease;
    pointer-events: auto;
    white-space: nowrap; /* Keep text on one line if possible */
}
.free-delivery-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.free-delivery-banner .free-delivery-text { 
    flex: none; 
    font-size: 13px; 
    font-weight: 600; 
    text-align: center; 
}

/* Mobile adjustment to allow wrapping if screen is very narrow */
@media (max-width: 360px) {
    .free-delivery-banner {
        white-space: normal;
        text-align: center;
    }
}

@media (min-width: 480px) {
    .free-delivery-banner { max-width: 520px; }
}
/* --- ADMIN & MY ACCOUNT MODALS --- */
.admin-nav {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
    /* --- NEW: For mobile scrolling --- */
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* For smoother scrolling on iOS */
}
.admin-nav::-webkit-scrollbar { height: 4px; }
.admin-nav::-webkit-scrollbar-thumb { background: #e9ecef; border-radius: 10px; }
.admin-nav-item { padding: 10px 15px; cursor: pointer; color: var(--color-text-secondary); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; }
.admin-nav-item.active { color: var(--color-brand); border-bottom-color: var(--color-brand); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }
.dashboard-metric { background: var(--color-background); border: 1px solid var(--color-border); border-radius: 8px; padding: 15px; text-align: center; margin-bottom: 10px; }
.dashboard-metric .value { font-size: 24px; font-weight: 700; color: var(--color-brand); }
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Two columns, equal width */
    gap: 16px; /* Space between grid items */
    margin-top: 20px; /* Margin from the controls above */
}
/* Adjust for smaller screens */
@media (max-width: 600px) {
    .dashboard-grid { grid-template-columns: repeat(1, 1fr); } /* One column on smaller screens */
}
.dashboard-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--color-background);
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 20px;
}
.date-range-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.date-range-picker .form-group {
    margin-bottom: 0;
    flex-grow: 1;
}
.date-range-picker .btn-primary {
    flex-shrink: 0;
}
.dashboard-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.dashboard-metric .label { font-size: 12px; color: var(--color-text-secondary); }
.product-list-item, .order-item, .address-item { background: var(--color-background); border: 1px solid var(--color-border); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.product-list-item, .address-item { display: flex; justify-content: space-between; align-items: center; }
.product-list-name { flex: 1; font-size: 12px; }
.product-.product-list-controls { display: flex; gap: 4px; }
.control-btn {
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    position: relative; /* Ensure loading spinner is centered */
    color: white;
    transition: opacity 0.2s;
}
.control-btn:hover { opacity: 0.85; }
.edit-btn { background: #17a2b8; }
.add-btn { background: #28a745; }
.delete-btn { background: #dc3545; }

/* --- NEW: Admin Order Control Buttons --- */
.btn-accept { background: #28a745; } /* Green */
.btn-reject { background: #dc3545; } /* Red */

/* --- ENHANCED ADDRESS FORM STYLING (Android Match) --- */

/* 1. Container for the two location buttons */
.address-method-buttons {
    display: flex !important;
    flex-direction: row !important; /* Force side-by-side */
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

/* 2. Shared Layout for Address Buttons */
.address-method-buttons .btn-primary,
.address-method-buttons .btn-secondary,
#useCurrentLocationBtn {
    /* flex: 1 1 0px !important; <-- Removed generic flex */
    width: auto !important;
    min-width: 0;
    margin: 0;
    font-weight: 600;
    padding: 12px 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    font-size: 12px;
    white-space: nowrap;
}

/* 3. Specific Width Ratios */
.address-method-buttons .btn-secondary {
    flex: 1 !important; /* Share space equally */
}

/* 4. Fix for Map Modal Button (Standalone) */
#useCurrentLocationBtn {
    width: 100% !important; /* Full width in the map modal */
    flex: none !important;
}

/* 3. Specific Styles: Map Modal Button (Filled Brand Color - Remains unchanged) */
#useCurrentLocationBtn {
    background-color: var(--color-brand) !important;
    border: 1px solid var(--color-brand) !important;
    color: #ffffff !important;
}
#useCurrentLocationBtn svg {
    fill: #ffffff !important;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
#useCurrentLocationBtn:hover {
    background-color: #c2185b !important;
    transform: translateY(-1px);
}

/* 3b. Specific Styles: Address Form Buttons (Outlined) */
/* Target the first button (Current Location) to give it pink accents */
.address-method-buttons .btn-secondary:first-child {
    color: var(--color-brand) !important;
    border-color: var(--color-brand) !important;
    background-color: var(--color-surface) !important;
}
.address-method-buttons .btn-secondary:first-child svg {
    fill: var(--color-brand) !important;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.address-method-buttons .btn-secondary:first-child:hover {
    background-color: var(--color-brand-light) !important;
}

/* 4. Specific Styles: Pin on Map (Outlined White) */
.address-method-buttons .btn-secondary {
    background-color: var(--color-surface) !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-text-primary) !important;
}
.address-method-buttons .btn-secondary svg {
    fill: var(--color-text-secondary) !important; /* Grey Icon */
    width: 20px;
    height: 20px;
    flex-shrink: 0; /* Prevent icon squishing */
}
.address-method-buttons .btn-secondary:hover {
    background-color: var(--color-background) !important;
    border-color: #adb5bd !important;
    transform: translateY(-1px);
}

/* --- NEW: Fetched Address Display (Android Match) --- */
.fetched-address-container {
    display: flex;
    align-items: center;
    background-color: #e9ecef;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    gap: 12px;
    border: 1px solid var(--color-border);
}

.fetched-address-icon {
    color: #28a745; /* Green check/map icon */
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.fetched-address-text {
    flex: 1;
    font-size: 14px;
    color: var(--color-text-primary);
    line-height: 1.4;
    font-weight: 500;
}

.change-address-btn {
    color: var(--color-brand);
    font-weight: 700;
    font-size: 13px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.change-address-btn:hover {
    background-color: rgba(233, 30, 99, 0.05);
    border-radius: 4px;
}

/* 4. Refine Input Fields in the Address Form */
.address-form-container .form-input {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    background-color: var(--color-surface);
    transition: border-color 0.2s;
}

.address-form-container .form-input:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

/* 5. Ensure the bottom 'Save Address' button remains solid pink */
.address-form-container > .btn-primary {
    border-radius: 8px;
    padding: 12px;
    font-size: 16px;
    font-weight: 700;
    background-color: var(--color-brand) !important;
    color: #ffffff !important;
    border: none !important;
}

.address-form-container > div > .btn-secondary { /* Cancel button */
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--color-border) !important;
    background-color: var(--color-surface) !important;
    color: var(--color-text-secondary) !important;
}
.btn-ready { background: #17a2b8; } /* Teal/Info */
.btn-outfordelivery { background: var(--color-brand); } /* Primary Pink */
.btn-delivered { background: #198754; } /* Darker Green */
.btn-cancel { background: #dc3545; } /* Red */

/* --- NEW: Manage Order Button --- */
.manage-btn {
    background: #6c757d; /* Neutral gray */
}

.address-list, .order-history-list { list-style: none; padding: 0; max-height: 40vh; overflow-y: auto; }
.order-item-header, .address-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-id, .address-tag { font-weight: bold; font-size: 12px; }
.order-date, .delete-address-btn { font-size: 10px; color: var(--color-text-secondary); cursor: pointer; }

/* --- NEW: Admin Panel Product List --- */
.admin-tab-content > .btn-primary {
    margin-bottom: 20px;
}
.admin-controls-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin-bottom: 20px;
}
.admin-controls-header .form-select {
    min-width: 180px;
}

.admin-product-item {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s;
}
.admin-product-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.admin-product-top-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.admin-product-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    background: var(--color-background);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.admin-product-image-tag { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.admin-product-image-emoji { font-size: 32px; }
.admin-product-details {
    flex-grow: 1;
    min-width: 0; /* CRUCIAL FIX: Allows the flex item to shrink below its content size */
}
.admin-product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 4px;
    word-break: break-word; /* Ensures long names without spaces will wrap */
}
.admin-product-meta {
    display: flex;
    gap: 12px; /* Reduced gap for mobile */
    flex-wrap: wrap; /* Allows meta items to stack vertically on small screens */
    font-size: 12px;
    color: var(--color-text-secondary);
}
.admin-product-meta .low-stock { color: #dc3545; font-weight: 700; }

.admin-product-controls { 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    flex-shrink: 0; 
    justify-content: center;
}

.btn-icon-action {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 6px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}
.btn-icon-action:hover {
    background: var(--color-background);
    color: var(--color-brand);
    border-color: var(--color-brand);
}
.btn-icon-action.delete:hover {
    color: #dc3545;
    border-color: #dc3545;
    background: #fff5f5;
}

/* --- NEW: Admin Product Price Grid --- */
.admin-price-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px 12px;
    margin-top: 6px;
    font-size: 12px;
    background: var(--color-background);
    padding: 8px;
    border-radius: 6px;
}
.admin-price-item {
    display: flex;
    flex-direction: column;
}
.admin-price-label {
    font-size: 10px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    font-weight: 700;
}
.admin-price-value {
    font-weight: 600;
    color: var(--color-text-primary);
}
/* Visual cue for edit mode */
body.quick-edit-mode-active .admin-price-value,
body.quick-edit-mode-active .admin-product-name,
body.quick-edit-mode-active .admin-stock-val {
    border-bottom: 1px dashed var(--color-brand);
    cursor: text;
    background-color: rgba(255, 255, 255, 0.5);
    padding: 0 2px;
}
body.quick-edit-mode-active .admin-price-value:hover,
body.quick-edit-mode-active .admin-product-name:hover,
body.quick-edit-mode-active .admin-stock-val:hover {
    background-color: var(--color-brand-light);
}

/* --- NEW: Generic Admin List Item (for Categories, Users, Coupons) --- */
.admin-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s;
}
.admin-list-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.admin-list-item-content {
    flex-grow: 1;
}
.admin-list-item-content .title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.admin-list-item-content .description {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}
.admin-list-item-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

/* --- NEW: Seller Status Badges --- */
.admin-list-item-controls .status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: white;
}
.admin-list-item-controls .status-badge.open {
    background-color: #28a745; /* Green */
}
.admin-list-item-controls .status-badge.closed {
    background-color: #6c757d; /* Gray */
}

/* --- WISHLIST --- */
    .wishlist-icon {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 19px;
        height: 19px;
        cursor: pointer;
        z-index: 10;
        display: flex; 
        align-items: center;
        justify-content: center;
    }

    .wishlist-icon .wishlist-svg {
        width: 18px;
        height: 18px;
        transition: transform 0.2s ease-in-out;
    }

    .wishlist-icon .wishlist-svg path {
        fill: rgba(255, 255, 255, 0.5); /* Semi-transparent white fill for visibility */
        stroke: #e91e63; /* Pink outline */
        stroke-width: 1.5;
        transition: fill 0.2s ease-in-out;
    }

    .wishlist-icon:hover .wishlist-svg {
        transform: scale(1.15);
    }

    .wishlist-icon.active .wishlist-svg path {
        fill: #e91e63; /* Solid pink fill when active */
    }

    /* Animation for when the heart is clicked */
    .wishlist-icon.animate {
        animation: heart-pop 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    }

    @keyframes heart-pop {
        0% { transform: scale(1); }
        50% { transform: scale(1.4); }
        100% { transform: scale(1); }
    }

.wishlist-item { display: flex; align-items: center; padding: 8px; margin-bottom: 8px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; }
.wishlist-item-details { flex-grow: 1; margin: 0 10px; }
.wishlist-item-name { font-size: 14px; font-weight: 600; }
.wishlist-item-price { font-size: 12px; color: var(--color-text-secondary); }
.wishlist-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    min-width: 100px;
}
.btn-wishlist-add {
    background: var(--color-brand); /* Green for add */
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: background-color 0.2s;
}
.btn-wishlist-add:hover {
    background: var(--color-brand);
}
.btn-wishlist-remove {
    background: none;
    border: none;
    color: #dc3545; /* Red for remove */
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    padding: 2px 4px;
    transition: color 0.2s, text-decoration 0.2s;
}
.btn-wishlist-remove:hover {
    color: #c82333;
    text-decoration: underline;
}
.btn-danger-outline {
    background: transparent;
    border: 1px solid #dc3545;
    color: #dc3545;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-danger-outline:hover {
    background: #dc3545;
    color: white;
}

/* --- MAP MODAL --- */
#mapPickerModal .admin-content { overflow-y: hidden; display: flex; flex-direction: column; }
#mapPickerModal .admin-body { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; }
.map-wrapper { position: relative; flex-grow: 1; width: 100%; min-height: 300px; }
#mapContainer { height: 100%; width: 100%; }
#centerPin { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -100%); font-size: 40px; color: var(--color-brand); z-index: 10; pointer-events: none; }
/* --- FIX: The 'My Location' button was moving when the address text below the map changed height. --- */
/* This was because its `bottom` value was too large, making its position dependent on the flexible height of the map wrapper. */
/* By reducing the `bottom` value, we anchor it firmly to the bottom of the map container itself, making its position stable. */
/* This value also keeps it clear of the Google Maps zoom controls (bottom-left). */
#myLocationBtn { position: absolute; bottom: 20px; right: 15px; background: var(--color-surface); border: none; border-radius: 50%; width: 40px; height: 40px; box-shadow: 0 2px 6px rgba(0,0,0,0.3); cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; }
#myLocationBtn svg { width: 20px; height: 20px; fill: var(--color-text-secondary); }

/* --- FIX: Isolate map footer to prevent layout shifts from causing map shaking --- */
.map-footer {
    flex-shrink: 0; /* Prevents this element from affecting the size of the flexible map-wrapper */
    padding: 8px 12px 12px; /* Add padding to all sides */
    background: var(--color-surface);
    /* --- PERMANENT FIX: Make the footer a flex container --- */
    /* This ensures the button is always visible, and only the address text scrolls. */
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#selectedMapAddress {
    font-size: 12px;
    /* --- PERMANENT FIX: Move scrolling behavior to the address text itself --- */
    max-height: 45px; /* Allow for ~3 lines of text before scrolling */
    overflow-y: auto; /* Add a scrollbar if the address is extremely long */
    /* A small min-height prevents the layout from jumping when text populates, but it no longer needs to be large. */
    min-height: 14px;
    padding-right: 4px; /* Add a little space for the scrollbar */
    color: var(--color-brand);
    font-weight: bold;
    text-align: center;
}
.map-confirm-btn {
    /* --- CLEANUP: The flex override is no longer needed as the base .btn-primary style is fixed. --- */
    /* We just keep the mobile-friendly padding and font-size. */
    padding: 12px;
    font-size: 16px;
    flex-shrink: 0; /* Ensure button doesn't get squished */
}

@media (max-width: 480px) {
    #mapPickerModal .admin-content { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; }
}

/* --- STYLE FOR THE ADMIN EDIT BUTTON ON PRODUCT CARDS --- */
.admin-edit-button {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10; /* Ensure it's above the wishlist icon */
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent background */
    color: white;
    border: none;
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    opacity: 0.7; /* Make it subtle */
}
.admin-edit-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
    opacity: 1; /* Fully visible on hover */
}

/* --- PROFILE PAGE STYLES (Modern) --- */
.account-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0 32px;
    background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-background) 100%);
    border-bottom: 1px solid var(--color-border);
    margin: -16px -16px 20px -16px; /* Bleed to edges */
}

.account-avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 12px;
    cursor: pointer;
}

.profile-picture, .profile-picture-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--color-surface);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    background-color: var(--color-background);
}

.profile-picture-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--color-text-secondary);
}

.account-edit-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--color-brand);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--color-surface);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}
.account-avatar-wrapper:hover .account-edit-badge { transform: scale(1.1); }

.account-menu-group {
    background: var(--color-surface);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.account-menu-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--color-surface);
    border: none;
    border-bottom: 1px solid var(--color-border);
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 500;
}
.account-menu-item:last-child { border-bottom: none; }
.account-menu-item:hover { background: var(--color-background); }

.account-menu-icon {
    width: 24px;
    height: 24px;
    margin-right: 14px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.account-menu-item:hover .account-menu-icon { color: var(--color-brand); }

.account-menu-text { flex: 1; }
.account-menu-chevron { color: var(--color-text-secondary); opacity: 0.5; }

/* Dark Mode Tweaks */
body.dark-mode .account-header { background: linear-gradient(180deg, var(--color-surface) 0%, #121212 100%); }

/* --- Address & Wishlist Modern Cards (Premium) --- */

/* Address Card */
.address-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}
.address-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    border-color: var(--color-border);
    transform: translateY(-2px);
}

/* New Icon Styles (No Pink) */
.address-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.address-icon-box svg { width: 24px; height: 24px; stroke-width: 2px; }

/* Semantic Colors */
.icon-box-home { background-color: #e3f2fd; color: #1565c0; }
.icon-box-work { background-color: #f3e5f5; color: #7b1fa2; }
.icon-box-other { background-color: #f5f5f5; color: #616161; }

/* Dark Mode Colors */
body.dark-mode .icon-box-home { background-color: rgba(21, 101, 192, 0.2); color: #90caf9; }
body.dark-mode .icon-box-work { background-color: rgba(123, 31, 162, 0.2); color: #ce93d8; }
body.dark-mode .icon-box-other { background-color: rgba(255, 255, 255, 0.1); color: #bdbdbd; }

.address-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.address-tag-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 3px;
    text-transform: capitalize;
    line-height: 1.2;
}

.address-body-text {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 0;
}

.address-delete-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid transparent;
    color: #dc3545;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.7;
}
.address-delete-btn:hover {
    background: #fff5f5;
    border-color: #ffcdd2;
    opacity: 1;
}

.address-body-text {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    padding-left: 4px;
}

/* Wishlist Card */
.wishlist-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    gap: 16px;
    transition: all 0.2s;
    position: relative;
}
.wishlist-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.wishlist-image-container {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wishlist-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wishlist-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px 0;
    min-width: 0;
}

.wishlist-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.wishlist-product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
    padding-right: 28px; /* Space for delete button */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wishlist-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.wishlist-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--color-text-primary);
}

.btn-wishlist-add-cart {
    background: var(--color-brand);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.25);
}
.btn-wishlist-add-cart:hover {
    background: #c2185b;
    transform: translateY(-1px);
}

.btn-wishlist-trash {
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-wishlist-trash:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.out-of-stock-label {
    font-size: 11px;
    color: #dc3545;
    font-weight: 700;
    background: #fff5f5;
    padding: 4px 8px;
    border-radius: 6px;
}

/* --- ORDERS PAGE --- */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0; /* <-- FIX: Remove padding from the parent */
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden; /* <-- ADD: Ensures child corners are clipped correctly */
}

/* ADD THIS NEW RULE to apply padding to the children instead */
.order-header, .order-body, .order-footer {
    padding: 16px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f3f4;
}

.order-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.order-header p {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.order-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order-items h4,
.order-details h4 {
    font-size: 14px;
    font-weight: 600;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.order-items ul {
    list-style: none;
    padding-left: 16px;
}

.order-items li {
    font-size: 14px;
    color: var(--color-text-primary);
    margin-bottom: 4px;
    position: relative;
}

.order-items li::before {
    content: '•';
    position: absolute;
    left: -16px;
    color: var(--color-brand);
}

.order-details {
    text-align: left;
}

.order-details p {
    font-size: 12px;
    margin-bottom: 8px;
}

.order-details a {
    font-size: 12px;
    color: var(--color-brand);
    text-decoration: none;
    font-weight: 600;
}

.order-details a:hover {
    text-decoration: underline;
}
.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center; /* <-- Changed to center for better alignment */
    background: var(--color-background);
    /* --- FIX: These lines make it a full-width bar --- */
    padding: 12px 16px;
    margin: 16px -16px 0 -16px; /* Negative margin breaks out of the parent's padding */
    border-top: 1px solid var(--color-border);
}

.order-total h4 {
    margin-bottom: 0;
}

.order-total span {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
}

.order-status-badge {
    display: inline-block;
    padding: 6px 12px; /* Increased padding for a larger, more modern look */
    font-size: 12px;   /* Slightly larger font for better readability */
    font-weight: 700;
    border-radius: 20px; /* More rounded "pill" shape */
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px; /* Adds a touch of refinement */
    border: 1px solid rgba(0,0,0,0.1); /* Subtle border for depth */
    margin-top: 8px; /* Add some space above the badge */
}

/* Updated colors for better contrast and modern feel */
.order-status-badge { background-color: #6c757d; }
.order-status-badge.status-pending { background-color: #ffc107; color: var(--color-text-primary); border-color: #e0a800; }
.order-status-badge.status-processing { background-color: #17a2b8; border-color: #138496; }
.order-status-badge.status-ready-for-pickup { background-color: #fd7e14; border-color: #e36a00; }
.order-status-badge.status-picking-up { background-color: #17a2b8; }
.order-status-badge.status-out-for-delivery { background-color: #0d6efd; border-color: #0b5ed7; }
.order-status-badge.status-delivered { background-color: #198754; border-color: #146c43; }
.order-status-badge.status-canceled { background-color: #dc3545; border-color: #b02a37; }

/* --- ENHANCED ORDER DETAILS STYLES --- */

/* 1. Style the new footer for alignment */
.order-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f3f4;
    display: flex;
    justify-content: space-between; /* Pushes toggle link and buttons apart */
    align-items: center;
}

/* Make the user-controls div in the footer adapt its size */
.order-footer .user-controls {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    display: flex;
    gap: 8px; /* Arrange buttons horizontally */
    align-items: center;
}

/* 2. Style the "View Details" link */
.details-toggle {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-brand);
    text-decoration: none;
    cursor: pointer;
}

/* 3. Style the expanded details container */
.order-details-expanded {
    padding: 12px;
    background: var(--color-background);
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
}

/* Use existing styles for the summary items inside */
.order-details-expanded .summary-item {
    font-size: 13px;
    margin-bottom: 8px;
}
.order-details-expanded .summary-item:last-child {
    margin-bottom: 0;
}
.order-details-expanded .summary-savings span {
    color: #155724; /* Keep the green color for savings */
}

/* Style the "Price Details" title */
.order-details-expanded h5 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text-primary);
}

/* Add a separator line above the totals, just like a receipt */
.order-details-expanded .summary-totals {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
}

/* Ensure consistent styling for the line items */
.order-details-expanded .summary-item-title { font-weight: 600; }
.order-details-expanded .summary-item-total { font-weight: 600; min-width: 60px; text-align: right; }


/* --- KEBAB ACTION MENU STYLES --- */

/* Make the header a flex container to align items */
.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align to top */
    position: relative; /* Crucial for positioning the dropdown */
}

.order-header-info {
    flex-grow: 1;
}

.kebab-menu-container {
    position: relative;
    flex-shrink: 0;
}

.kebab-menu-button {
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}
.kebab-menu-button:hover {
    background-color: var(--color-background);
}

.order-action-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10;
    background: var(--color-surface);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 180px;
    overflow: hidden;
}

.order-action-menu-item {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--color-text-primary);
    text-decoration: none;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
}
.order-action-menu-item:last-child {
    border-bottom: none;
}

.order-action-menu-item:hover {
    background-color: var(--color-background);
}
/* --- ENHANCED DELIVERED ORDER ACTIONS --- */

/* The main wrapper for all user controls */
.user-controls-wrapper {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f3f4;
}

/* The container for our new two-tier layout */
.order-actions-container {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Space between the primary and secondary action tiers */
}

/* The tier for the main buttons */
.primary-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end; /* This aligns buttons to the right */
}

.primary-actions .btn-primary,
.primary-actions .btn-secondary-outline,
.invoice-link { /* <-- ADD THIS SELECTOR */
    padding: 10px 16px; 
    font-size: 14px;
}

/* ADD THIS NEW RULE for the outline button */
.btn-secondary-outline {
    padding: 10px 16px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-surface);
    color: var(--color-text-primary);
    transition: all 0.2s;
}
.btn-secondary-outline:hover {
    background: var(--color-background);
    border-color: var(--color-text-secondary);
}
/* The tier for the utility links */
.secondary-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Style for the invoice download link */
.invoice-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}
.invoice-link:hover {
    color: var(--color-brand);
}



.cancellation-reason, .order-discount {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
}

.cancellation-reason {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.order-discount {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.user-controls {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f3f4;
}

/* --- NEW: Admin Controls Container --- */
.admin-controls {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f3f4;
    display: flex;
    gap: 8px;
    justify-content: flex-end; /* Align buttons to the right */
}

.delivery-agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-background);
    padding: 8px;
    border-radius: 6px;
    margin-top: 12px;
    /* text-align: left; Ensure content inside aligns left */
    justify-content: space-between;
    
}

.agent-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 24px;
    flex-shrink: 0;
}

.agent-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-grow: 1;
}

.agent-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.agent-call-btn {
    /* Sizing and Shape */
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Makes it a perfect circle */
    
    /* Colors and Appearance */
    background-color: var(--color-brand); /* Use the main brand color */
    color: white; /* This will make the SVG icon white */
    text-decoration: none; /* Remove underline from the <a> tag */
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);

    /* Flexbox for Centering the Icon */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Polish */
    flex-shrink: 0; /* Prevent the button from shrinking */
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.agent-call-btn:hover {
    transform: scale(1.1); /* Add a nice hover effect */
    background-color: #c2185b; /* A slightly darker shade of the brand color */
}

.delivery-map {
    /* compact, reliable map container styles */
    height: 150px;
    width: 100%;
    margin: 12px 0;
    border-radius: 8px;
    background: #e9ecef;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    position: relative;
}
.delivery-map-info {
    font-size: 14px;
    color: var(--color-text-primary);
    margin-top: 8px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Floating distance/time badge */
.delivery-distance-badge {
    position: absolute;
    right: 16px;
    top: 14px;
    background: rgba(0,0,0,0.78);
    color: #fff;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    z-index: 6000;
    box-shadow: 0 6px 14px rgba(0,0,0,0.18);
}

/* Styling for polyline overlay if we create one */
.leaflet-routing-line {
    stroke: #ff5722;
    stroke-width: 4px;
    stroke-linecap: round;
    opacity: 0.95;
}

.order-feedback {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f3f4;
    text-align: center;
}

.rating-widget {
    display: inline-flex;
    flex-direction: row-reverse; /* This makes the hover effect work correctly */
    justify-content: center;
}

.rating-widget > label {
    font-size: 24px;
    color: var(--color-border);
    cursor: pointer;
    transition: color 0.2s;
}

.rating-widget > input {
    display: none;
}

.rating-widget > label:hover,
.rating-widget > label:hover ~ label,
.rating-widget > input:checked ~ label {
    color: var(--color-brand);
}


.header-action.orders-button {
    display: none; /* Hidden by default */
}

/* --- LOADING SPINNER --- */
.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
    text-align: center;
}
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f1f3f4;
    border-top: 3px solid #e91e63;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}
.empty-state-container {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- SKELETON LOADER --- */
.skeleton-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #f1f3f4;
}
.skeleton-image {
    height: 120px;
    background-color: #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
}
.skeleton-text {
    height: 16px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin-bottom: 8px;
}
.skeleton-text.short {
    width: 60%;
}
.skeleton-price {
    height: 20px;
    width: 40%;
    background-color: #e9ecef;
    border-radius: 4px;
}

/* Shimmer Animation */
.skeleton-image, .skeleton-text, .skeleton-price {
    background-image: linear-gradient(90deg, #e9ecef 0px, #f8f9fa 40px, #e9ecef 80px);
    background-size: 600px;
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% {
        background-position: -300px 0;
    }
    100% {
        background-position: 300px 0;
    }
}

@keyframes cart-shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

/* Wishlist Pop Animation for Header */
#wishlistHeaderIcon.animate .header-icon {
    animation: container-bounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-color: var(--color-brand-light); /* Flash light pink bg */
    color: var(--color-brand); /* Turn icon pink */
    overflow: visible; /* Allow ripple to expand outside */
}

/* Animate the inner SVG separately for a layered effect */
#wishlistHeaderIcon.animate .header-icon svg {
    animation: icon-beat 0.5s ease-in-out;
}

/* The Ripple Ring Effect */
#wishlistHeaderIcon.animate .header-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 2px solid var(--color-brand);
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    animation: ripple-burst 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes container-bounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.08); } /* Reduced scale */
    100% { transform: scale(1); }
}

@keyframes icon-beat {
    0% { transform: scale(1); }
    25% { transform: scale(1.15) rotate(-4deg); } /* Reduced scale & rotation */
    50% { transform: scale(0.95) rotate(4deg); }
    75% { transform: scale(1.05) rotate(-2deg); }
    100% { transform: scale(1) rotate(0); }
}

@keyframes ripple-burst {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; border-width: 2px; }
    100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; border-width: 0px; } /* Tighter burst */
}

/* --- STYLES FOR NEW SVG HEADER ICONS --- */

/* Target all SVGs within the right side of the header */
.header-right .admin-svg,
.header-right .orders-svg,
.header-right .profile-svg {
    /* 
     * This is the key: We use your '--header-icon-content-size' variable
     * to ensure these SVGs are the exact same size as your cart and wishlist icons.
     */
    width: var(--header-icon-content-size);
    height: var(--header-icon-content-size);

    /* 
     * 'currentColor' is a special value that makes the SVG's stroke (its outline)
     * automatically inherit the color of its parent (.header-icon), which is #495057.
     */
    stroke: currentColor; 
    transition: transform 0.2s ease-in-out;
}

/* 
 * This reuses your existing hover effect. When you hover over the circular
 * button, the SVG inside will scale up slightly for a nice interactive feel.
 */
.header-icon:hover svg {
    transform: scale(1.1);
}

/* 
 * This rule targets the profile icon specifically when the user is logged in.
 * The .auth-button gets a .logged-in class, which you've styled with a pink
 * background. This rule makes the SVG icon inside it turn white for better contrast.
 */
.header-action.logged-in .header-icon .profile-svg {
    stroke: #fff; 
}

/* =================================================================== */
/* --- SCROLL CHAINING & OVERSCROLL FIXES --- */
/* Prevents scrolling in one container from affecting parent/adjacent 
   containers. This creates a much smoother, native-like feel on 
   touch devices and prevents the main page from scrolling behind modals. */
/* =================================================================== */

/* Main app layout (already fixed, included for completeness) */
.category-sidebar,
.products-section {
    overscroll-behavior-y: contain;
}

/* The main scrolling body of ALL modals */
.admin-body {
    overscroll-behavior-y: contain;
}

/* Specific scrollable lists within modals for extra safety */
#cartItemsContainer,
#reorderItemsContainer,
#addressListContainer,
#orderHistoryContainer,
#wishlistContainer {
    overscroll-behavior-y: contain;
}

/* Prevent horizontal scroll on admin tabs from triggering browser back/forward gestures */
.admin-nav {
    overscroll-behavior-x: contain;
}

/* =================================================================== */
/* --- ENHANCED DELIVERY OPTION STYLES --- */
/* Transforms the delivery choice from basic radio buttons into
   modern, clickable, card-style options for a better UX. */
/* =================================================================== */

.delivery-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--color-border); /* Use theme variable for border */
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background: var(--color-surface);
    position: relative;
    flex-wrap: wrap; /* Allow nested content to wrap to the next line */
}

/* --- NEW: Styles for the checkmark icon --- */
.delivery-option .checkmark-icon {
    display: none; /* Hidden by default */
    font-size: 24px;
    color: var(--color-brand);
}

.slots-container {
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

.delivery-option:hover {
    border-color: #adb5bd; /* Darker border on hover */
    transform: translateY(-2px); /* Subtle lift effect */
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* --- NEW: Corrected styles for the selected state using a class --- */
.delivery-option.selected {
    border-color: var(--color-brand);
}

.delivery-option.selected .checkmark-icon {
    display: block;
}

.delivery-option.selected label strong,
.delivery-option.selected strong {
    color: var(--color-brand);
}

/* Style the radio button itself */
.delivery-option input[type="radio"] {
    margin-right: 16px;
    /* Make the radio button larger and match the brand color */
    width: 20px;
    height: 20px;
    accent-color: var(--color-brand);
}

/* The label contains all the text */
.delivery-option label {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Aligns text to the left */
    width: 100%;
}

.delivery-option label strong {
    font-size: 15px;
    color: var(--color-text-primary);
    display: block; /* Ensures title is on its own line */
    margin-bottom: 2px;
}

.delivery-option label span {
    font-size: 13px;
}

/* ADD THIS CSS FOR THE TOGGLE SWITCH */
/* Legacy container styles removed to prevent conflicts with .account-menu-item */
.theme-toggle-container {
    /* Ensure it behaves as a flex container for the toggle/label alignment */
    display: flex; 
    justify-content: space-between;
    align-items: center;
}
/* Hide the label inside the toggle container as we use the menu text */
.theme-toggle-container label {
    display: none; 
}
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 28px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--color-brand); }
input:checked + .slider:before { transform: translateX(22px); }

/* --- Language Selector (Segmented Control) --- */
.language-selector-container {
    display: flex;
    background: var(--color-background);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    width: 100%;
    margin-top: 8px;
}
.lang-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}
.lang-btn.active {
    background: var(--color-surface);
    color: var(--color-brand);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* =================================================================== */
/* --- DARK MODE: COMPONENT-SPECIFIC FIXES --- */
/* This block targets specific elements that were missed in the
   initial theme implementation to ensure full readability. */
/* =================================================================== */

body.dark-mode {
    /* --- 1. Form Inputs, Selects, and Placeholders --- */
    .form-input,
    .form-select {
        background-color: var(--color-input-bg);
        border-color: var(--color-border);
        color: var(--color-text-primary); /* Text the user types */
    }

    /* Target placeholder text specifically */
    .form-input::placeholder {
        color: var(--color-text-secondary);
        opacity: 0.8; /* Make placeholders slightly dimmer */
    }

    /* --- 2. Buttons with Dark Text --- */
    .btn-secondary,
    .coupon-input-group .btn-secondary,
    .suggested-action .btn-secondary {
        background-color: var(--color-surface);
        border-color: var(--color-border);
        color: var(--color-text-primary);
    }
    
    .btn-add-address {
        border-color: var(--color-border);
        color: var(--color-text-secondary);
    }
    
    .quantity-btn {
        background-color: var(--color-input-bg);
        color: var(--color-text-primary);
    }

    /* --- 3. Badges and Informational Boxes --- */
    .summary-savings,
    .order-discount {
        background-color: #2e7d32; /* A dark, rich green */
        border-color: #388e3c;
        color: #ffffff; /* Ensure text is white */
    }

    .cancellation-reason {
        background-color: #d32f2f; /* A dark, rich red */
        border-color: #c62828;
        color: #ffffff; /* Ensure text is white */
    }

    .available-coupon-tag {
        background-color: transparent;
        border-color: var(--color-brand);
    }

    /* --- 4. Miscellaneous Text Elements --- */
    .category-name {
        color: var(--color-text-primary);
    }

    /* Ensure active category text is highly visible */
    .category-item.active .category-name {
        color: #ffffff;
    }

    .delivery-option label {
        color: var(--color-text-secondary);
    }
    .delivery-option label strong {
        color: var(--color-text-primary);
    }

    .delivery-option:has(input:checked) {
        background-color: var(--color-brand-light);
    }
}

body.dark-mode {
    /* --- 1. ENHANCING DEPTH & HIERARCHY --- */

    /* Make cards and modals "pop" from the background with a subtle border */
    .product-card,
    .admin-content,
    .admin-list-item,
    .suggested-card,
    .order-card {
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Make inputs and dropdowns distinct from the surface they are on */
    .form-input,
    .form-select,
    .product-controls #searchInput,
    .product-controls .form-select {
        background-color: var(--color-background); /* Use the darkest color */
        border: 1px solid rgba(255, 255, 255, 0.2); /* With a slightly brighter border */
    }

    /* --- 2. TONING DOWN SATURATED COLORS --- */

    /* Make secondary buttons (like "Add more items") outlined instead of filled */
    .btn-secondary {
        background-color: transparent;
        border: 2px solid var(--color-brand);
        color: var(--color-brand);
    }
    .btn-secondary:hover {
        background-color: var(--color-brand-light);
    }

    /* Desaturate the "Discount" and "You Saved" boxes */
    .summary-savings,
    .order-discount {
        background-color: rgba(102, 187, 106, 0.2); /* Dark, transparent green */
        border: 1px solid rgba(102, 187, 106, 0.5);
        color: #66bb6a; /* Lighter green text */
    }
    .summary-savings .savings-amount,
    .order-discount span {
        color: #81c784;
    }

    /* Desaturate the "Reason" and "Canceled" boxes */
    .cancellation-reason,
    .order-status-badge.status-canceled {
        background-color: rgba(239, 83, 80, 0.2); /* Dark, transparent red */
        border: 1px solid rgba(239, 83, 80, 0.5);
        color: #ef5350; /* Lighter red text */
    }

    /* --- 3. REFINING HIGHLIGHTS & SPECIFIC COMPONENTS --- */

    /* Make the active category in the sidebar a subtle highlight, not a solid block */
    .category-item.active {
        background: var(--color-brand-light);
    }
    .category-item.active .category-name {
        color: var(--color-brand);
    }

    /* Make the selected delivery option a subtle highlight */
    .delivery-option:has(input:checked) {
        background-color: var(--color-brand-light);
    }

    /* Ensure the cart item divider is visible */
    .cart-item,
    .product-modal-description,
    .related-products,
    .product-attributes,
    .order-header,
    .user-controls,
    .admin-controls {
        border-color: var(--color-border);
    }
}

body.dark-mode {
    /* --- 1. INTRODUCE DEPTH & LAYERS --- */

    /* Make the main product section the darkest color, establishing our base layer */
    .products-section {
        background-color: var(--color-background);
    }

    /* Make the sidebar slightly lighter, so it feels like it's on top */
    .category-sidebar {
        background-color: var(--color-surface);
        border-right: 1px solid var(--color-border); /* Keep a subtle separator */
    }

    /* Remove the hard border from product cards in dark mode */
    .product-card {
        border: 1px solid transparent; /* Remove the default border */
        background-clip: padding-box; /* Important for the glow effect */
    }

    /* Add a subtle "glow" border on hover for a premium feel */
    .product-card:hover {
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0,0,0,0.3);
    }

    /* --- 2. REFINE THE CATEGORY SIDEBAR --- */

    /* Make the active category a modern "pill" shape */
    .category-item.active {
        background: var(--color-brand-light);
    }
    .category-item.active .category-name {
        color: var(--color-brand);
        font-weight: 700; /* Make the active text bolder */
    }

    /* --- 3. REFINE THE "ADD" BUTTON --- */

    /* Style the new icon-based Add button */
    .add-button.icon-only {
        width: 36px;  /* Make it circular */
        height: 36px;
        padding: 0;
        font-size: 24px; /* Larger '+' icon */
        line-height: 36px; /* Vertically center the '+' */
        border-radius: 50%;
    }
}

/* 1. Make the modal body a flex container */
/* This allows us to control the sizing of its direct children. */
#cartModal .admin-body {
    display: flex;
    flex-direction: column; /* Stack children vertically */
    padding: 0; /* Remove padding from the body itself */
    overflow: hidden; /* Prevent the body from scrolling */
}

/* 2. Style the new scrollable content wrapper */
/* This div will now be responsible for all scrolling. */
.cart-scroll-content {
    flex-grow: 1; /* CRITICAL: This makes the div take up all available vertical space */
    overflow-y: auto; /* Enable vertical scrolling ONLY for this container */
    padding: 0px; /* Re-apply the padding that was on the modal body */
    
    /* Add padding at the bottom to ensure the last item is not hidden by the sticky footer.
       100px is a safe value, slightly larger than the footer's expected height. */
    padding-bottom: 100px; 
}

/* 3. Style the sticky footer */
/* We are overriding the existing .cart-footer styles for this specific context. */
#cartModal .cart-footer {
    flex-shrink: 0; /* Prevent the footer from shrinking */
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface); /* Ensure it has a solid background to hide content scrolling behind it */
    
    /* Add a subtle shadow to give it a sense of elevation over the scrolling content */
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08); 
}
/* --- ENHANCED & INTERACTIVE RATING WIDGET --- */

/* 1. Style the list item to align its children (name and stars) */
.order-item-row {
    display: flex;
    justify-content: space-between; /* Pushes name to the left and stars to the right */
    align-items: center;
    width: 100%;
}
.order-item-name-static {
    padding-right: 16px; /* Add some space between the name and the stars */
}

/* 2. The main container for the interactive stars */
.interactive-rating-widget {
    display: inline-flex;
    /* This is the key to the hover effect: stars are ordered 5 to 1 in HTML,
       but this CSS rule displays them as 1 to 5. */
    flex-direction: row-reverse;
    justify-content: flex-end;
}

/* 3. Hide the actual radio button circles */
.interactive-rating-widget .rating-radio-input {
    display: none;
}

/* 4. Style the visible stars (the labels) */
.interactive-rating-widget .rating-star-label {
    font-size: 22px;
    color: var(--color-border); /* Default color is a light grey */
    cursor: pointer;
    padding: 0 1px;
    transition: color 0.2s ease-in-out;
}

/* 5. The Hover Effect:
   - When you hover over a star (label), it turns brand-colored.
   - The '~' (general sibling combinator) makes all preceding stars also turn brand-colored.
   - Because of flex-direction: row-reverse, "preceding" visually means "stars to the left". */
.interactive-rating-widget > .rating-star-label:hover,
.interactive-rating-widget > .rating-star-label:hover ~ .rating-star-label {
    color: var(--color-brand);
}

/* 6. The Selected State:
   - When a radio input is checked, this rule makes all of its preceding sibling
     labels (the stars to its left) stay permanently brand-colored. */
.interactive-rating-widget > .rating-radio-input:checked ~ .rating-star-label {
    color: var(--color-brand);
}




@media (hover: hover) {
    /* A more engaging hover effect */
    .available-coupon-tag:hover {
        background-color: var(--color-brand);
        color: #fff;
        border-style: solid;
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 4px 12px rgba(233, 30, 99, 0.2);
    }

    /* Don't apply hover effects to inactive or active tags */
    .available-coupon-tag.inactive:hover,
    .available-coupon-tag.active:hover {
        transform: none;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    /* This rule applies ONLY when hovering over a coupon that already has the .active class */
    .available-coupon-tag.active:hover {
        background-color: #f8d7da; /* A subtle, warning red background */
        border-color: #dc3545;
        color: #842029; /* Dark red text */
        transform: translateY(0); /* Override the "lift" effect for the remove action */
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }

    /* On hover, change the checkmark content to an 'X' to clearly indicate a remove action */
    .available-coupon-tag.active:hover::before {
        content: '✖';
        color: #dc3545;
    }

    /* This rule is more specific. It targets a tag that is being hovered over,
       but specifically one that does NOT have the .active class. */
    .available-coupon-tag:not(.active):hover {
        /* We re-apply the original, non-red hover styles here */
        background-color: var(--color-brand);
        color: #fff;
        border-style: solid;
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 4px 12px rgba(233, 30, 99, 0.2);
    }
}
/* --- END OF FIX --- */


/* 1. The main container for the selector in the modal */
.modal-quantity-selector {
    display: flex;
    align-items: center;
    justify-content: space-between; /* This will push buttons to edges and keep number centered */
    flex-grow: 1;
    height: 45px;
    border: 2px solid var(--color-brand);
    border-radius: 6px;
    background: var(--color-surface);
}

/* 2. The '+' and '-' buttons, with robust centering */
.modal-quantity-btn {
    width: 50px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--color-brand);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 0; /* Critical: Resets browser defaults */
    
    /* This combination is the most reliable way to center the icon */
    line-height: 45px; /* Matches the container's height */
    text-align: center;
}

/* 3. The number display in the middle */
.modal-quantity-value {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}
/* --- BUTTON LOADING STATE --- */
.btn-loading {
    position: relative;
    color: transparent !important; /* Hide button text */
    pointer-events: none; /* Disable further clicks */
    cursor: wait;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px; /* Spinner size */
    height: 20px; /* Spinner size */
    margin-top: -10px; /* Half of height */
    margin-left: -10px; /* Half of width */
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff; /* Spinner color */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* For secondary buttons with dark text, the spinner should be dark */
.btn-secondary.btn-loading::after {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: #212529; /* Nearly black */
}

/* --- NEW: AI Summary Modal --- */
.summary-modal-content {
    padding: 10px;
}
.summary-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-primary);
    white-space: pre-wrap; /* Preserves line breaks from the AI response */
}
/* --- NEW: ADMIN WAITLIST STYLES --- */
.waitlist-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s;
}
.waitlist-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.waitlist-user-info {
    flex-grow: 1;
}
.waitlist-location-info {
    flex-shrink: 0;
    text-align: right;
    max-width: 40%;
}
.view-on-map-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-brand);
    text-decoration: none;
    margin-top: 4px;
    display: inline-block;
}
.view-on-map-link:hover {
    text-decoration: underline;
}

/* --- ADMIN SUPPORT TICKET STYLES (REFINED) --- */

/* Main container for the entire support tab content */
#support.admin-tab-content.active {
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure it fills the modal body */
}

/* Filter button container */
.support-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 16px;
    flex-shrink: 0; /* Prevent from shrinking */
}

/* Individual filter button */
.support-filters .btn-secondary {
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: 8px 16px;
}
.support-filters .btn-secondary:hover {
    background-color: var(--color-background);
}

/* Active state for filter button */
.support-filters .btn-secondary.active {
    background-color: var(--color-brand);
    color: white;
    border-color: var(--color-brand);
}

/* List container */
.support-ticket-list {
    flex-grow: 1; /* Allow list to take up remaining space */
    overflow-y: auto; /* Enable scrolling for the list */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Individual ticket item in the list */
.support-ticket-item {
    display: flex;
    align-items: center; /* Vertically center content */
    justify-content: space-between;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.support-ticket-item:hover {
    border-color: var(--color-brand);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.ticket-main-info { flex-grow: 1; margin-right: 16px; }
.ticket-subject { font-size: 15px; font-weight: 600; color: var(--color-text-primary); }
.ticket-user { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }
.ticket-meta-info { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.ticket-status-badge { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; color: white; }
.ticket-status-badge.status-open { background-color: #28a745; }
.ticket-status-badge.status-answered { background-color: #0d6efd; }
.ticket-status-badge.status-closed { background-color: #6c757d; }
.ticket-timestamp {
    font-size: 11px;
    color: var(--color-text-secondary);
}

/* Support: polished ticket & chat styles */
.support-detail-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px 16px;
    padding: 18px;
    background: linear-gradient(180deg, rgba(var(--color-brand-rgb),0.02), transparent);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    align-items: center;
}

.header-top {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    background: transparent;
    border: 1px solid rgba(0,0,0,0.04);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}
.back-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.05); }

.header-main {
    grid-column: 1 / 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ticket-subject-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}

.ticket-meta-date {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.ticket-controls {
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    align-items: end;
    gap: 8px;
}

.ticket-status-badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.02) inset;
}

.ticket-status-badge.status-open {
    background: rgba(28, 199, 116, 0.08);
    color: #1bc472;
    border: 1px solid rgba(27,196,114,0.12);
}

.ticket-status-badge.status-closed {
    background: rgba(108,117,125,0.06);
    color: #6c757d;
    border: 1px solid rgba(108,117,125,0.08);
}

.ticket-status-badge.status-pending {
    background: rgba(255,193,7,0.06);
    color: #d39e00;
    border: 1px solid rgba(255,193,7,0.08);
}

.close-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(180deg, rgba(var(--color-brand-rgb),0.12), rgba(var(--color-brand-rgb),0.08));
    border: 1px solid rgba(var(--color-brand-rgb),0.18);
    color: var(--color-brand);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.close-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }
.close-btn[disabled] { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }

@media (max-width: 720px) {
    .support-detail-header {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .ticket-controls { align-items: flex-start; }
    .ticket-status-badge { min-width: 64px; }
    .close-btn { width: 100%; }
}
.ticket-status-badge {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ticket-status-badge.status-open { background: rgba(40,167,69,0.08); color: #28a745; border: 1px solid rgba(40,167,69,0.12); }
.ticket-status-badge.status-closed { background: rgba(108,117,125,0.06); color: #6c757d; border: 1px solid rgba(108,117,125,0.08); }
.ticket-status-badge.status-pending { background: rgba(255,193,7,0.06); color: #d39e00; border: 1px solid rgba(255,193,7,0.08); }

.support-chat-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--color-background);
    min-height: 220px;
}

.chat-message-row {
    display: flex;
    width: 100%;
    align-items: flex-end;
    gap: 12px;
}
.chat-message-row.customer-row { justify-content: flex-end; }
.chat-message-row.admin-row { justify-content: flex-start; }

.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: inline-block;
    word-break: break-word;
    position: relative;
}
.customer-bubble { 
    background: var(--color-brand-light); 
    color: var(--color-text-primary); 
    border-bottom-right-radius: 4px; 
    border: 1px solid rgba(233, 30, 99, 0.1);
}
.admin-bubble { 
    background: var(--color-surface); 
    color: var(--color-text-primary); 
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px; 
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    font-size: 12px;
    border: 1px solid var(--color-border);
}

.chat-sender-name { font-size: 11px; font-weight: 700; margin-bottom: 4px; opacity: 0.8; }
.customer-bubble .chat-sender-name { color: var(--color-brand); }
.admin-bubble .chat-sender-name { color: var(--color-text-primary); }

.chat-message-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

.chat-message-time { font-size: 10px; margin-top: 4px; text-align: right; opacity: 0.7; }
.customer-bubble .chat-message-time { color: var(--color-text-secondary); }
.admin-bubble .chat-message-time { color: var(--color-text-secondary); }

.support-reply-form { border-top: 1px solid var(--color-border); padding: 14px; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.support-reply-form textarea { min-height: 86px; resize: vertical; border-radius: 8px; padding: 10px; border: 1px solid var(--color-border); background: var(--color-surface); }
.reply-controls { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }

/* Removed flex-grow and overflow to allow natural flow with the button */
.user-support-ticket-list { display: flex; flex-direction: column; gap: 16px; padding: 8px 4px; }

.support-ticket-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.support-ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: var(--color-border);
}

.ticket-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.ticket-subject-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.3;
}
.ticket-date-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
    background: var(--color-background);
    padding: 2px 6px;
    border-radius: 6px;
}

.ticket-body-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.ticket-preview-text {
    font-size: 13px;
    color: var(--color-text-secondary);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Enhanced Badge */
.ticket-status-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}
.status-open { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
.status-closed { background: rgba(107, 114, 128, 0.1); color: #4b5563; }
.status-pending { background: rgba(234, 179, 8, 0.1); color: #ca8a04; }

.chat-message-row.pending .chat-bubble { opacity: 0.9; filter: saturate(0.95); border: 1px dashed rgba(255,255,255,0.4); }
.chat-message-row.failed .chat-bubble { opacity: 0.9; border: 1px solid rgba(255,80,80,0.12); box-shadow: 0 2px 6px rgba(255,80,80,0.04); }

.chat-date-separator {
    text-align: center;
    margin: 16px 0 8px;
}
.chat-date-separator span {
    background-color: var(--color-border);
    color: var(--color-text-secondary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* --- Create Ticket UI --- */
.create-ticket-wrapper {
    flex-grow: 1;
    background-color: var(--color-background); /* Match chat bg */
    padding: 16px;
    overflow-y: auto;
}

.create-ticket-card {
    background-color: var(--color-surface);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    max-width: 600px;
    margin: 0 auto; /* Center on desktop */
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px; /* Reduced height */
    border: 2px dashed var(--color-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    background-color: var(--color-background);
    text-align: center;
}

/* --- New Header Styles for Create Ticket --- */
.ticket-creation-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0 16px 0; /* Vertical padding */
    margin-bottom: 0;
}

.back-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    margin-left: -8px; /* Align icon visually with edge */
}
.back-btn-icon:hover {
    background-color: var(--color-background);
}

.file-upload-label:hover, .file-upload-label:active {
    border-color: var(--color-brand);
    color: var(--color-brand);
    background-color: rgba(var(--color-brand-rgb), 0.02);
}

.file-upload-label svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* =================================================================== */
/* --- ENHANCED ORDER TIMELINE (REPLACE YOUR OLD OPTION 2 CSS WITH THIS) --- */
/* =================================================================== */

.order-timeline-vertical.active .timeline-dot-vertical::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: transparent;
    z-index: -1;
    animation: pulse 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

/* --- ENHANCED DELIVERY SLOT STYLES --- */
.slot-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 16px 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}

/* Ensure our new radio buttons look consistent with the existing ones */
.delivery-option:has(input:checked) {
    border-color: var(--color-brand);
    background-color: var(--color-brand-light);
    box-shadow: 0 0 0 2px var(--color-brand);
}

.timeline-step-vertical {
    display: flex;
    position: relative;
    padding-left: 35px; /* Increased space for the larger dot/animation */
    min-height: 60px; /* Increased height for better spacing */
}

/* The vertical connecting line */
.timeline-step-vertical:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 20px;
    width: 2px;
    height: 100%;
    background-color: var(--color-border);
    transition: background-color 0.4s ease;
}

/* --- THE DOT --- */
.timeline-dot-vertical {
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--color-surface);
    border: 2px solid var(--color-border);
    transition: all 0.3s ease;
    z-index: 2; /* Keep dot above the line */
}

/* --- 1. COMPLETED STEP STYLES (FILLED DOT + CHECKMARK) --- */
.timeline-step-vertical.completed .timeline-dot-vertical {
    background-color: var(--color-brand);
    border-color: var(--color-brand);
    /* Add a white checkmark icon inside the filled circle */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
}

/* Make the connecting line also colored when completed */
.timeline-step-vertical.completed:not(:last-child)::before {
    background-color: var(--color-brand);
}


/* --- 2. ACTIVE STEP STYLES (PULSING ANIMATION) --- */
.timeline-step-vertical.active .timeline-dot-vertical {
    border-color: var(--color-brand);
    background-color: var(--color-surface); /* Keep the center white */
    transform: scale(1.1); /* Slightly larger */
}

/* The pulsing halo effect */
.timeline-step-vertical.active .timeline-dot-vertical::after {
    content: '';
    position: absolute;
    /* --- START: MODIFICATION --- */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* --- END: MODIFICATION --- */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: transparent;
    z-index: -1;
    animation: pulse 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

/* The keyframes for the pulse animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--color-brand-rgb), 0.5);
    }
    100% {
        box-shadow: 0 0 0 14px rgba(var(--color-brand-rgb), 0);
    }
}


/* --- TEXT CONTENT STYLES (Unchanged from before) --- */
.timeline-content {
    padding-bottom: 20px;
}

.timeline-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.timeline-step-vertical.completed .timeline-title {
    color: var(--color-text-primary);
}

.timeline-step-vertical.active .timeline-title {
    color: var(--color-text-primary);
    font-weight: 700;
}

.timeline-subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.timeline-subtitle.eta {
    font-weight: 600;
    color: var(--color-brand);
}

/* --- ENHANCED DELIVERY SLOT STYLES --- */
.slot-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 16px 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}

/* Ensure our new radio buttons look consistent with the existing ones */
.delivery-option:has(input:checked) {
    border-color: var(--color-brand);
    background-color: var(--color-brand-light);
    box-shadow: 0 0 0 2px var(--color-brand);
}

/* --- ENHANCED ADDRESS FORM BUTTONS --- */
.address-method-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* Override default button styles for these location buttons */
.address-method-buttons .btn-primary,
.address-method-buttons .btn-secondary {
    width: 100%;
    margin: 0;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.address-method-buttons button:hover {
    border-color: #adb5bd;
    background-color: var(--color-background);
    transform: translateY(-1px);
}

/* Color the icons inside these buttons */
.address-method-buttons button svg {
    fill: var(--color-brand); /* Pink icon */
    width: 20px;
    height: 20px;
}

/* Ensure the inputs match Android styling (cleaner, rounder) */
.address-form-container .form-input {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    background-color: var(--color-surface);
    transition: border-color 0.2s;
}

.address-form-container .form-input:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

/* Style the Save/Cancel buttons at the bottom */
.address-form-container .btn-primary {
    border-radius: 8px;
    padding: 12px;
    font-size: 16px;
    font-weight: 700;
    /* Keep Save button pink filled as per standard Android "Primary" buttons */
}

.address-form-container .btn-secondary {
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
    color: var(--color-text-secondary);
}

/* Apply the same outlined card style to the 'Use My Current Location' button in the map modal */
#useCurrentLocationBtn {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    font-weight: 600;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
#useCurrentLocationBtn:hover {
    border-color: #adb5bd;
    background-color: var(--color-background);
}
#useCurrentLocationBtn svg {
    fill: var(--color-brand);
}

/* --- NEW: Proof of Pickup Modal Styles --- */
.photo-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
}

.photo-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.photo-preview-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    /* Add this for better positioning */
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.location-search-container {
    margin-bottom: 12px; /* Adds space below the search bar */
}

/* --- FLOATING CART BAR (Android Style) --- */
#floatingCartBar {
    position: fixed;
    bottom: 30px; /* Raised default position */
    left: 50%;
    /* Center horizontally, start hidden below screen */
    transform: translateX(-50%) translateY(200%);
    opacity: 0; /* Ensure it is completely invisible when hidden */
    
    width: auto; /* Allow natural width based on content */
    max-width: 90%;
    
    background-color: #ffffff;
    border: 1px solid #E91E63; /* Pink border */
    border-radius: 30px; /* Pill shape */
    
    padding: 8px 12px 8px 20px; /* Adjusted padding for balance */
    gap: 20px; /* Balanced spacing */
    
    box-shadow: 0 4px 20px rgba(233, 30, 99, 0.25);
    z-index: 998;
    
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    /* Added opacity transition */
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

#floatingCartBar.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Move up when free delivery banner is visible */
#floatingCartBar.show.shifted-up {
    transform: translateX(-50%) translateY(-21px); /* Reduced distance */
}

/* Hide bar when a modal is open to prevent overlap */
body.modal-open #floatingCartBar {
    display: none;
}

.cart-bar-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-bar-icon {
    color: #E91E63;
    display: flex;
    align-items: center;
}

.cart-bar-text {
    display: flex;
    flex-direction: column;
}

.cart-bar-title {
    font-size: 15px;
    font-weight: 700;
    color: #E91E63;
    white-space: nowrap; /* Force single line */
    line-height: 1.2;
}

.cart-bar-subtitle {
    font-size: 11px;
    color: #6c757d;
    font-weight: 500;
    white-space: nowrap; /* Force single line */
}

.cart-bar-button {
    background-color: #E91E63;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap; /* Force single line */
}

.cart-bar-button:hover {
    background-color: #c2185b;
}

/* Dark mode overrides for the bar */
body.dark-mode #floatingCartBar {
    background-color: #1e1e1e;
    border-color: #f06292;
}
body.dark-mode .cart-bar-title {
    color: #f06292;
}
body.dark-mode .cart-bar-icon {
    color: #f06292;
}

/* --- NEW: Toast Button Highlight Animation --- */
@keyframes toast-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.4); /* Your --color-brand with alpha */
    }
    70% {
        transform: scale(1.08);
        box-shadow: 0 0 0 12px rgba(233, 30, 99, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(233, 30, 99, 0);
    }
}

.toast-action.highlight {
    /* Play the animation twice for emphasis */
    animation: toast-pulse 1.5s cubic-bezier(0.22, 1, 0.36, 1) 2;
}

/* --- NEW: Google Maps User Location (Blue Dot) --- */
@keyframes pulse-dot {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.user-location-dot-container {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 1050; /* High z-index to appear above map tiles */
}

.user-location-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #4285F4; /* Google's blue */
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2; /* z-index relative to its container */
}

.user-location-dot::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #4285F4;
    animation: pulse-dot 2s infinite;
    z-index: 1; /* Below the main dot */
}

/* --- NEW: Contact Support Modal --- */
.support-modal-content {
    text-align: center;
    padding: 20px;
}

/* --- NEW: Checkout Policy Snippet --- */
.policy-snippet {
    background-color: var(--color-background); /* Subtle light gray */
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px;
    margin: 20px 0; /* Increased margin for better separation */
}
.policy-title {
    font-size: 14px;
    color: var(--color-brand); /* Use brand color for highlight */
    margin-bottom: 4px;
}
.policy-text {
    font-size: 12px;
    color: var(--color-text-secondary); /* Softer text color */
    line-height: 1.5;
}

.support-modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--color-brand);
}

.support-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-text-primary);
}

.support-modal-number {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-text-primary);
    letter-spacing: 1px;
    margin-bottom: 24px;
    background-color: var(--color-background);
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    display: inline-block;
}

.support-modal-actions {
    display: flex;
    gap: 12px;
}

.order-card .policy-snippet {
    margin: 12px 0;
}

/* --- NEW: Cart Policy Snippet --- */
.cart-policy-snippet {
    padding: 6px 20px 6px 20px;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-background);
    text-align: center;
}

.cart-policy-snippet strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.cart-policy-snippet p {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* --- NEW: Sold Out Badge for Product Cards --- */
.product-card.out-of-stock .product-image::after {
    content: 'Sold Out';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px; /* Match the image's border-radius */
    z-index: 5;
}

body.dark-mode .product-card.out-of-stock .product-image::after {
    background: rgba(30, 30, 30, 0.7);
    color: var(--color-text-secondary);
}

.status-pending-verification {
    background-color: #ffc107;
    color: #212529;
}

/* --- ADD THESE NEW STYLES --- */
.admin-order-filters {
    display: flex;
    flex-wrap: wrap; /* Allows buttons to wrap to the next line on small screens */
    gap: 8px; /* Adds space between the buttons */
    margin-bottom: 16px; /* Adds space below the filter area */
}

.admin-order-filters .btn-secondary {
    flex-grow: 1; /* Allows buttons to expand and fill the space */
}

/* Style for the active filter button */
.admin-order-filters .btn-secondary.active {
    background-color: var(--color-brand);
    color: white;
    border-color: var(--color-brand);
}

/* Makes the label a flex container, stacking its children vertically */
.delivery-option label {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Aligns text to the left */
    width: 100%;
}

/* The subtitle (status message) gets its own line and styling */
.delivery-subtitle {
    font-size: 12px;
    margin-top: 4px; /* Adds a little space above the status text */
    font-weight: 500;
}

.delivery-subtitle.available {
    color: #28a745; /* Green for success */
}

.delivery-subtitle.unavailable {
    color: #fd7e14; /* Orange for warning/upsell */
}

/* Fades out the entire option when disabled */
.delivery-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- ADD THESE NEW STYLES FOR THE CART SUMMARY --- */
#deliveryEligibilitySummary {
    padding: 10px 20px;
    margin: 6 20px 6px 20px;
    background-color: var(--color-background-light);
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--color-border);
}

#deliveryEligibilitySummary .eligible {
    color: #28a745; /* Green */
}

#deliveryEligibilitySummary .needs-more {
    color: var(--color-text-secondary);
}

/* --- DARK MODE FIXES: Header Icons & Banner --- */
body.dark-mode .sort-icon-btn,
body.dark-mode .hub-icon-btn {
    background-color: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

body.dark-mode .sort-icon-btn:hover,
body.dark-mode .hub-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .free-delivery-banner {
    background-color: #2d2600; /* Dark muted gold */
    color: #ffe082; /* Light gold text */
    border-top: 1px solid #4d4000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

body.dark-mode .free-delivery-banner .free-delivery-text {
    color: #ffe082;
}

/* --- Success State for Free Delivery Banner --- */
.free-delivery-banner.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb; /* Fix: Override border on all sides */
}

body.dark-mode .free-delivery-banner.success {
    background-color: #1b5e20; /* Dark green */
    color: #a5d6a7; /* Light green text */
    border: 1px solid #2e7d32; /* Fix: Override border on all sides */
}

/* --- Hide Banner When Modal is Open --- */
body.modal-open .free-delivery-banner {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(-50%) translateY(100%) !important;
}

/* --- Success Pulse Animation --- */
@keyframes banner-pulse {
    0% { transform: translateX(-50%) translateY(0) scale(1); }
    50% { transform: translateX(-50%) translateY(0) scale(1.05); box-shadow: 0 0 20px rgba(40, 167, 69, 0.4); }
    100% { transform: translateX(-50%) translateY(0) scale(1); }
}

.free-delivery-banner.pulse-success {
    animation: banner-pulse 0.5s ease-in-out 3; /* Pulse 3 times */
}

/* --- PAYMENT METHOD STYLES --- */
.payment-options-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px; /* Added padding to prevent hover clipping */
}

.payment-option-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    min-width: 240px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    flex: 1; /* Take available width */
}

.payment-option-card:hover {
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.payment-option-card.selected {
    border-color: var(--color-brand);
    background-color: var(--color-surface); /* No pink background */
    box-shadow: none; /* No bold border, just the 1px border-color */
}

.payment-option-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.payment-icon-svg {
    width: 24px;
    height: 24px;
    fill: var(--color-text-secondary);
    transition: fill 0.2s;
}

.payment-option-card.selected .payment-icon-svg {
    fill: var(--color-brand);
}

.payment-text-group {
    display: flex;
    flex-direction: column;
}

.payment-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text-primary);
    line-height: 1.2;
}

.payment-option-card.selected .payment-title {
    color: var(--color-brand);
}

.payment-subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.payment-check-icon {
    font-size: 20px;
    color: var(--color-brand);
    font-weight: bold;
    display: none;
}

.payment-option-card.selected .payment-check-icon {
    display: block;
}

/* Dark mode adjustments */
body.dark-mode .payment-option-card.selected {
    background-color: var(--color-surface); /* No pink tint in dark mode either */
}

/* Add these new styles to the end of your styles.css file */

.footer-links {
  text-align: center;
  padding: 20px;
  font-size: 14px;
  color: #6C757D;
}

.footer-links a {
  color: #E91E63;
  text-decoration: none;
  font-weight: 600;
}

.footer-links span {
  margin: 0 10px;
}

.policy-text {
  font-size: 12px;
  color: #6C757D;
  text-align: left;
  margin-top: 4px;
  line-height: 1.5;
}

.policy-text a {
  color: #E91E63;
  font-weight: bold;
  text-decoration: none;
}
/* --- NEW: Drag-and-Drop Image Upload Styles --- */
.product-image.drag-over {
    outline: 3px dashed var(--color-brand);
    outline-offset: -4px;
    transform: scale(1.03);
}

.product-image.drag-over::before {
    content: 'Drop to Upload';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px; /* Match the image's border-radius */
    z-index: 6; /* Ensure it's above the image but below buttons */
    pointer-events: none; /* Allow drop events to pass through */
}

/* --- NEW: Admin Controls Container on Product Card --- */
.admin-card-controls {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 11; /* Above wishlist icon */
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

/* Hide admin controls by default, show in quick edit mode */
.admin-card-controls.admin-auto-hide { display: none; }
body.quick-edit-mode-active .admin-card-controls.admin-auto-hide { display: flex; }

/* Tweak existing edit button to fit in the new container */
.admin-edit-button {
    position: static; /* No longer needs absolute positioning */
    opacity: 0.8;
}
.admin-edit-button:hover {
    opacity: 1;
}

/* --- NEW: Style for the URL Paste Input --- */
.admin-url-paste-input {
    width: 30px;
    padding: 3px 6px;
    font-size: 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 8px;
    opacity: 0.8;
    transition: all 0.2s;
}

.admin-url-paste-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.admin-url-paste-input:focus {
    opacity: 1;
    outline: none;
    border-color: var(--color-brand);
    background-color: rgba(0, 0, 0, 0.8);
}

/* --- NEW: Inline Field Editing for Admins --- */
.editable-field.editing {
    cursor: text;
    background-color: #fffbeB; /* A very light yellow */
    outline: 2px solid #f59e0b; /* A gold/amber color */
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px; /* Offset padding to prevent layout shift */
}


/* --- NEW: Admin Stock Info (Inline) --- */
.admin-stock-info {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary); /* Use the standard secondary text color */
    margin-left: 8px; /* Add space between unit and stock */
}

/* --- NEW: Multi-Select Deletion Styles --- */
.selection-mode-active .product-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.selection-mode-active .product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.3); /* Pink glow */
}

.product-card.selected {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-brand);
    transform: scale(0.98);
}

.product-card.selected .product-image::after {
    content: '✓';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(233, 30, 99, 0.7);
    color: white;
    font-size: 48px;
    font-weight: bold;
    border-radius: 8px;
    z-index: 7;
}

#selectionActionBar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #323232;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1002; /* Above content, below modals */
}

#selectionActionBar span {
    font-weight: 600;
}


/* --- NEW: Compact Button Style for Admin Controls --- */
.btn-compact {
    padding: 4px 10px;
    font-size: 12px;
    height: auto;
    flex-grow: 0 !important; /* Prevent stretching */
}

/* --- NEW: Quick Edit Mode Styles --- */
.quick-edit-mode-active .product-card {
    border: 2px dashed rgba(245, 158, 11, 0.4); /* Amber dash */
}

.quick-edit-mode-active .editable-field {
    cursor: cell;
    transition: background-color 0.2s;
}

.quick-edit-mode-active .editable-field:hover {
    background-color: rgba(245, 158, 11, 0.1); /* Light amber highlight on hover */
}

/* --- NEW: Show/Hide URL Input in Quick Edit Mode --- */
.quick-edit-only {
    display: none;
}

.quick-edit-mode-active .quick-edit-only {
    display: block;
}

.quick-edit-mode-active .add-button-container {
    display: none;
}

body.quick-edit-mode-active .add-button-container {
    display: none !important;
}

/* --- NEW: Clear Search History Button --- */
.clear-history-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 8px;
    margin-left: 4px;
    border-radius: 50%;
    line-height: 1;
}

.clear-history-btn:hover {
    color: var(--color-text-primary);
    background-color: #e9ecef;
}

/* --- NEW: Compact Sort Button --- */
#sortSelect.form-select {
    padding: 8px 12px; /* Reduce horizontal padding */
    font-size: 13px;   /* Smaller font */
    flex-shrink: 0;    /* Prevent it from being squished */
    width: auto;       /* Ensure it only takes the space it needs */
}

/* --- NEW: Custom Sort Button Styles --- */
.sort-button-container {
    position: relative;
    flex-shrink: 0;
}

.sort-icon-btn {
    background-color: #f1f3f4;
    border: none;
    border-radius: 16px; /* Pill shape */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-secondary);
}
.sort-icon-btn:hover,
.hub-icon-btn:hover {
    background-color: #e9ecef;
}

/* Shared styles for both menus */
.sort-options-menu,
.hub-options-menu {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--color-surface);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 101; /* Increased to appear above product card elements */
    width: 200px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.hub-options-menu {
    max-height: 300px; /* Allow scrolling for many hubs */
    overflow-y: auto;
}

.sort-options-menu.show,
.hub-options-menu.show {
    display: block;
}

/* Specific styles for the Hub button container */
.hub-button-container {
    position: relative;
    flex-shrink: 0;
}

.hub-icon-btn {
    background-color: #f1f3f4;
    border: none;
    border-radius: 16px; /* Pill shape */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-secondary);
}

.sort-option {
    display: flex; /* Use flexbox for alignment */
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--color-text-primary);
    text-decoration: none;
}

/* Add a placeholder for the checkmark to maintain alignment */
.sort-option::before {
    content: '✓';
    font-weight: bold;
    color: transparent; /* Make it invisible by default */
    margin-right: 12px;
}

.sort-option:hover {
    background-color: var(--color-background);
}

.sort-option.active {
    font-weight: 600;
    /* No pink background or text color */
}

/* Only show the checkmark on the active item */
.sort-option.active::before {
    color: var(--color-brand);
}

.quick-msp-container {
    margin-bottom: 2px;
}
.quick-msp-wrapper {
    display: flex;
    gap: 4px;
    align-items: center;
    width: 100%;
}
.quick-msp-input {
    width: 100%;
    padding: 2px 6px;
    font-size: 13px;
    border: 1px solid var(--color-brand);
    border-radius: 4px;
    flex: 1;
}

/* --- NEW: Admin Seller Filter Style --- */
#sellerFilterSelect.form-select {
    padding: 8px 12px;
    font-size: 13px;
    flex-shrink: 0;
    width: auto;
    max-width: 150px; /* Prevent it from getting too long */
}

/* Add this new CSS to your admin stylesheet */

.history-item-card {
  background-color: #fff;
  border: 1px solid #e9ecef;
  border-left: 4px solid #17a2b8; /* Use a color to indicate 'info' */
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.history-content {
  margin-bottom: 8px;
}

.history-title {
  font-weight: 600;
  color: #212529;
  font-size: 15px;
  margin-bottom: 4px;
}

.history-body {
  font-size: 14px;
  color: #495057;
  white-space: pre-wrap; /* Respects newlines in the body */
}

.history-deeplink {
  margin-top: 8px;
  font-size: 12px;
  color: #6c757d;
}

.history-deeplink code {
  background-color: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #6c757d;
  border-top: 1px solid #e9ecef;
  padding-top: 8px;
  margin-top: 8px;
}

.history-timestamp {
  font-style: italic;
}

/* --- NEW: Order Management Modal --- */
.order-management-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.admin-controls-column .form-group {
    margin-bottom: 20px;
}
.admin-log-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 10px;
    font-size: 12px;
}
.admin-log-item {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 8px;
    margin-bottom: 8px;
}
.admin-log-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.admin-log-item p {
    margin: 0 0 4px 0;
}
.admin-log-item ul {
    margin: 0;
    padding-left: 20px;
}

/* --- NEW: Admin Order Card Redesign --- */
.admin-order-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden; /* Ensures child corners are clipped */
}

.admin-order-card .order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--color-background);
}

.admin-order-card .order-header-info h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.admin-order-card .order-header-info p {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 2px 0 0 0;
}

.admin-order-card .order-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-order-card .order-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-order-card .order-section h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
}

.admin-order-card .admin-address-text {
    font-size: 14px;
    color: var(--color-text-primary);
    line-height: 1.5;
}

.admin-order-card .admin-order-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.admin-order-card .order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-background);
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
}

.admin-order-card .order-footer h4 {
    margin: 0;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.admin-order-card .order-footer span {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
}

@media (max-width: 700px) {
    .order-management-grid {
        grid-template-columns: 1fr;
    }
}

.om-card {
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.om-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-top: 0;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.om-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
}

.om-detail-row span:first-child {
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-right: 16px;
}

.om-detail-row span:last-child {
    color: var(--color-text-primary);
    text-align: right;
    flex-shrink: 1;
}

.om-item-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.om-item-list li {
    font-size: 14px;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.om-item-qty {
    font-weight: 700;
    color: var(--color-brand);
    margin-right: 8px;
}

.admin-log-container {
    padding: 0;
    border: none;
}

.admin-log-item {
    font-size: 13px;
}

/* --- NEW: Agent Assignment Rules --- */
.agent-rule-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-brand);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}
.agent-rule-priority {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.agent-rule-priority button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    color: var(--color-text-secondary);
}
.agent-rule-priority button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.agent-rule-priority span {
    font-weight: bold;
    font-size: 16px;
}
.agent-rule-details {
    flex-grow: 1;
}
.agent-rule-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}
.agent-rule-conditions {
    font-size: 12px;
    color: var(--color-text-secondary);
}
.agent-rule-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.warning-banner {
    background-color: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid #ffeeba;
}
.info-banner {
    background-color: #e2e3e5;
    color: #495057;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #d6d8db;
}

/* --- NEW: Disabled State for Primary Buttons (Out of Stock) --- */
.btn-primary:disabled {
    background: #e9ecef;
    color: #adb5bd;
    border: 1px solid #dee2e6;
    cursor: not-allowed;
    box-shadow: none;
}

/* --- NEW: AI Overview Button Styling --- */
.btn-ai {
    width: 100%;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    
    /* Gradient Border Trick */
    background: linear-gradient(#fff, #fff) padding-box,
                linear-gradient(45deg, #4285F4, #9B72CB, #D96570) border-box;
    border: 2px solid transparent;
    color: #495057;
}

.btn-ai:hover {
    background: linear-gradient(#f8f9fa, #f8f9fa) padding-box,
                linear-gradient(45deg, #4285F4, #9B72CB, #D96570) border-box;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Dark mode adjustment for AI button */
body.dark-mode .btn-ai {
    background: linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
                linear-gradient(45deg, #4285F4, #9B72CB, #D96570) border-box;
    color: var(--color-text-primary);
}

/* --- NEW: Modern Support Ticket UI --- */
.support-header-modern {
    display: flex;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
    gap: 12px;
}

.support-back-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.support-back-btn:hover { background-color: var(--color-background); color: var(--color-text-primary); }

.support-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.support-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.support-ticket-subject {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text-primary);
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}

.support-ticket-date {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.support-close-btn {
    font-size: 11px;
    color: #dc3545;
    background: transparent;
    border: 1px solid #dc3545;
    padding: 4px 10px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
}
.support-close-btn:hover { background: #dc3545; color: white; }

/* Chat Input Area */
.support-footer-modern {
    margin-top: 12px;
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.support-attach-btn {
    padding: 10px;
    color: var(--color-text-secondary);
    background: var(--color-background);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.support-attach-btn:hover { background: #e9ecef; color: var(--color-text-primary); }

.support-input-wrapper {
    flex: 1;
    background: var(--color-background);
    border-radius: 20px;
    border: 1px solid var(--color-border);
    padding: 4px 12px;
    display: flex;
    flex-direction: column;
}

.support-image-preview-mini {
    position: relative;
    display: inline-block;
    margin: 6px 0 2px 0;
    width: fit-content;
}
.support-image-preview-mini img {
    height: 60px;
    width: auto;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    display: block;
}
.support-remove-img {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    border: 1px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-chat-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    max-height: 100px;
    resize: none;
    outline: none;
    color: var(--color-text-primary);
}

.support-send-btn {
    background: var(--color-brand);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    /* Optical centering for paper plane icon */
    padding-right: 3px; 
    padding-top: 2px;
    flex-shrink: 0;
}
.support-send-btn:hover { transform: scale(1.05); background: #c2185b; }
.support-send-btn:disabled { background: #e9ecef; color: #adb5bd; cursor: default; transform: none; }

/* Chat Image Styling */
.chat-message-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 6px;
    display: block;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
}

/* --- Support Chat Images & Attachments (Matches Android) --- */
.chat-message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 6px;
    display: block;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
}

.image-preview-container {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
}

.image-preview-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.remove-image-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: white;
    color: #dc3545;
    border: 1px solid #dc3545;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.attach-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--color-text-secondary);
    transition: color 0.2s;
}
.attach-btn:hover { color: var(--color-brand); }

/* --- Support Chat Images & Attachments --- */
.chat-message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 6px;
    display: block;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
}

.image-preview-container {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
}

.image-preview-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.remove-image-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: white;
    color: #dc3545;
    border: 1px solid #dc3545;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.attach-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--color-text-secondary);
    transition: color 0.2s;
}
.attach-btn:hover { color: var(--color-brand); }

/* --- NEW: Center Unlock Popup --- */
.unlock-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Glassmorphism Effect */
    background: rgba(255, 255, 255, 0.55); /* More transparent */
    backdrop-filter: blur(16px); /* Blurs the content behind it */
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4); /* Subtle icy border */
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15); /* Soft, deep shadow */
    
    z-index: 3000; /* Above everything */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
    animation: popInAndOut 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    min-width: auto; /* Let content define width */
    padding: 15px 25px; /* Tighter padding */
}

.unlock-popup-icon {
    font-size: 72px; /* Slightly adjusted */
    margin-bottom: 0px;
    animation: bounceIcon 3s ease-in-out;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15)); /* Softer shadow */
}

.unlock-popup-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--color-brand);
    margin-bottom: 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    /* Clean text shadow instead of stroke */
    text-shadow: 0 2px 10px rgba(233, 30, 99, 0.2);
}

/* .unlock-popup-sub removed */

@keyframes popInAndOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    12% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    20% { transform: translate(-50%, -50%) scale(1); }
    85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

@keyframes bounceIcon {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-15px) rotate(-10deg);}
    60% {transform: translateY(-5px) rotate(5deg);}
}

body.dark-mode .unlock-popup {
    background: rgba(20, 20, 20, 0.55); /* Dark glass - more transparent */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

/* --- New Order Card Layout (Android Match) --- */
.order-header-right { display: flex; align-items: center; gap: 10px; }
.order-total-header { font-size: 16px; font-weight: 700; color: var(--color-text-primary); }

.detail-row { display: flex; align-items: flex-start; margin-bottom: 12px; gap: 8px; font-size: 14px; color: var(--color-text-secondary); }
.detail-row svg { flex-shrink: 0; margin-top: 2px; fill: var(--color-text-secondary); }
.detail-text { line-height: 1.4; }

.items-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; cursor: pointer; border-top: 1px solid var(--color-border); margin-top: 8px; }
.items-title { font-size: 14px; font-weight: 600; color: var(--color-text-primary); }
.items-chevron { transition: transform 0.3s ease; }
.items-header.expanded .items-chevron { transform: rotate(180deg); }

.items-simple-list { margin-bottom: 12px; }
.simple-item-text { font-size: 14px; color: var(--color-text-secondary); margin-bottom: 4px; }

.items-detailed-view { display: none; animation: fade-in 0.2s; }
.items-header.expanded + .items-simple-list { display: none; }
.items-header.expanded ~ .items-detailed-view { display: block; }

.order-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--color-border); margin-top: 12px; }
.footer-left { flex: 1; }
.footer-right { display: flex; gap: 8px; }

/* Adjust badges for footer placement */
.order-status-badge { margin-top: 0; }

/* --- Order Card Spacing & Refinement --- */
.order-card {
    margin-bottom: 20px; /* Separate orders clearly */
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* --- Seller Cancellation Accordion (Matches Android) --- */
.seller-cancellation-container {
    background-color: #F8F9FA; /* Light Grey */
    border: 1px solid #E9ECEF;
    border-radius: 8px;
    margin: 12px 0;
    overflow: hidden;
}
.seller-cancellation-header {
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background-color: #F8F9FA;
}
.seller-cancellation-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.seller-cancellation-body {
    padding: 0 12px 12px 12px; /* Remove top padding to blend with header */
    background-color: #F8F9FA;
    display: none; /* Hidden by default */
    font-size: 14px;
    color: var(--color-text-secondary);
}
.seller-cancellation-body.expanded {
    display: block;
}
.seller-cancellation-body strong {
    color: var(--color-text-primary);
    font-weight: 600;
}
.cancellation-chevron {
    transition: transform 0.2s ease;
}
.seller-cancellation-header.expanded .cancellation-chevron {
    transform: rotate(180deg);
}
.cancellation-support-link {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #E9ECEF;
    color: #E91E63;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: block;
}

/* Dark mode text stroke */
body.dark-mode .unlock-popup-title {
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* --- Image Viewer Modal --- */
.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 3500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.image-viewer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.image-viewer-content {
    position: relative;
    max-width: 95%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.image-viewer-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 3502;
}
.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.3);
}
.image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 3502;
}
.image-viewer-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}
.image-viewer-nav:disabled {
    opacity: 0;
    pointer-events: none;
}
.image-viewer-prev { left: 20px; }
.image-viewer-next { right: 20px; }

/* --- Hub Selector Modal Styles (Modern) --- */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 4px;
}

.hub-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0,0,0,0.1);
    border-color: rgba(233, 30, 99, 0.3);
}

.hub-card.active {
    background-color: #fff0f6;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px var(--color-brand); /* Modern Ring */
}

/* Browse All Card */
.hub-card.browse-all {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border: 1px dashed #d1d5db;
    align-items: center;
    text-align: left;
    min-height: auto;
    padding: 12px;
    align-self: start;
    flex-direction: row;
    gap: 12px;
}
.hub-card.browse-all:hover {
    border-color: var(--color-brand);
    background: #fff;
}
.hub-card.browse-all.active {
    background: #fff0f6;
    border-style: solid;
}

.hub-browse-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-brand-light);
    color: var(--color-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.hub-card.browse-all:hover .hub-browse-icon { transform: scale(1.1); }

/* Specific Hub Styles */
.hub-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.hub-info-col { flex: 1; min-width: 0; }

.hub-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hub-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #f1f3f4;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.hub-avatar.open {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.3);
}

.hub-status-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.hub-status-dot { width: 8px; height: 8px; border-radius: 50%; background-color: #d1d5db; }
.hub-status-dot.open { background-color: #22c55e; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2); }
.hub-hours { color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hub-stats {
    font-size: 12px;
    color: var(--color-text-secondary);
    background: var(--color-background);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.brand-pill {
    font-size: 11px;
    background: transparent;
    border: 1px solid var(--color-border);
    padding: 4px 10px;
    border-radius: 20px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* Dark Mode Overrides */
body.dark-mode .hub-card {
    background: var(--color-surface);
    border-color: rgba(255,255,255,0.1);
}
body.dark-mode .hub-card:hover {
    box-shadow: 0 12px 24px -8px rgba(0,0,0,0.5);
    background: #2a2a2a;
}
body.dark-mode .hub-card.active {
    background: rgba(233, 30, 99, 0.15);
    border-color: var(--color-brand);
}
body.dark-mode .hub-card.browse-all {
    background: linear-gradient(145deg, #1e1e1e, #252525);
    border-color: rgba(255,255,255,0.1);
}
body.dark-mode .hub-stats { background: rgba(255,255,255,0.05); }

/* --- Phase 4: Foreign Product Styles --- */
.product-card.foreign {
    /* Removed opacity/dimming as requested */
    background-color: #ffffff; 
    border: 1px dashed var(--color-brand); /* Pink dashed border to indicate 'different' but active */
}


.foreign-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--color-brand);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-top-left-radius: 8px; /* Match card corner */
    border-bottom-right-radius: 8px;
    z-index: 10;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.2);
}

.btn-switch-hub {
    background-color: var(--color-text-secondary);
    color: white;
    font-size: 11px;
    padding: 0 12px; /* Compact padding */
    min-width: auto; /* Allow shrinking */
}

/* --- Phase 5: Hub Context Bar (Premium Redesign) --- */
.hub-context-bar {
    background: linear-gradient(135deg, var(--color-surface) 0%, #fff0f6 100%);
    border: 1px solid rgba(233, 30, 99, 0.1);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 8px 0 16px 0;
    border-radius: 16px;
    box-shadow: 0 8px 20px -6px rgba(233, 30, 99, 0.12);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    animation: bar-pop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hub-context-bar.hub-open {
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    border-color: rgba(34, 197, 94, 0.15);
    box-shadow: 0 8px 20px -6px rgba(34, 197, 94, 0.1);
}

.hub-context-bar.hub-closed {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-color: #d1d5db;
    box-shadow: none;
}

.hub-context-bar:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(233, 30, 99, 0.2);
}

.hub-context-bar:active {
    transform: scale(0.98);
}

.hub-context-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-brand-light);
    color: var(--color-brand);
    border-radius: 12px;
    flex-shrink: 0;
}

.hub-context-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    stroke: currentColor;
    fill: none; 
}

.hub-context-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: center;
}

.hub-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-secondary);
    font-weight: 700;
    margin-bottom: 2px;
}

.hub-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.2;
}

/* --- Fix for Safari Close Button --- */
.close-admin {
    min-width: 44px; /* Apple Human Interface Guideline minimum */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100; /* Ensure it's on top */
    cursor: pointer;
    /* Remove default button styling */
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 28px;
    padding: 0;
}

.hub-context-action {
    background: rgba(233, 30, 99, 0.08);
    border: 1px solid transparent;
    color: var(--color-brand);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s;
}

.hub-context-bar:hover .hub-context-action {
    background: var(--color-brand);
    color: white;
}

/* Dark Mode Overrides for Hub Context Bar */
body.dark-mode .hub-context-bar {
    background: linear-gradient(135deg, var(--color-surface) 0%, #2a1a20 100%);
    border-color: rgba(233, 30, 99, 0.3);
}
body.dark-mode .hub-context-bar.hub-open {
    background: linear-gradient(135deg, var(--color-surface) 0%, #052e16 100%);
    border-color: rgba(34, 197, 94, 0.3);
}
body.dark-mode .hub-context-bar.hub-closed {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: #374151;
}
body.dark-mode .hub-context-icon {
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}
body.dark-mode .hub-name {
    color: var(--color-text-primary);
}

@keyframes bar-pop {
    0% { transform: translateY(-5px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* --- Phase 3: Hub Animations --- */
.hub-flyer {
    position: fixed;
    z-index: 10000; /* Above everything */
    pointer-events: none;
    background: var(--color-brand);
    color: white;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Perfect Circle */
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.5);
    transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); /* Smooth curve */
}

@keyframes hub-pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.7); transform: scale(1); }
    50% { box-shadow: 0 0 0 6px rgba(233, 30, 99, 0); transform: scale(1.15); }
    100% { box-shadow: 0 0 0 0 rgba(233, 30, 99, 0); transform: scale(1); }
}

.hub-btn-pulse {
    animation: hub-pulse-ring 0.6s ease-out forwards;
    background-color: var(--color-brand-light) !important;
    color: var(--color-brand) !important;
    border-color: var(--color-brand) !important;
}

/* --- NEW: Rich Item List (Android Match) --- */
.rich-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}
.rich-item-row:last-child { border-bottom: none; }

.rich-item-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #e9ecef;
}
.rich-item-image { width: 100%; height: 100%; object-fit: contain; }
.rich-item-emoji { font-size: 24px; }

.rich-item-details { flex: 1; }
.rich-item-name { font-size: 14px; font-weight: 600; color: var(--color-text-primary); line-height: 1.3; margin-bottom: 2px; }
.rich-item-meta { font-size: 12px; color: var(--color-text-secondary); }

/* --- NEW: Delivery Type Badges --- */
.delivery-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    width: fit-content;
}
.delivery-tag.express {
    background-color: #f8f9fa;
    color: var(--color-text-primary);
    border: 1px solid #e9ecef;
}
.delivery-tag.slotted {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #e9ecef;
}

/* Category Reordering */
.admin-list-item.draggable { cursor: grab; user-select: none; } /* Removed touch-action: none to fix scroll */
.admin-list-item.draggable:active { cursor: grabbing; }
.admin-list-item.drag-over {
    border: 2px dashed var(--color-brand);
    background-color: var(--color-brand-light);
    transform: scale(1.01);
}
.admin-list-item-controls .drag-handle { touch-action: none; } /* Prevent scroll only on handle */
.admin-list-img {
    width: 32px; height: 32px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background-color: #f1f3f4;
}

/* --- Admin Panel Responsive Layout (Premium) --- */
.admin-layout { display: flex; height: 100%; overflow: hidden; background-color: var(--color-background); }

/* Desktop Sidebar */
.admin-sidebar {
    width: 230px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    padding-top: 0;
}
.admin-sidebar-item {
    padding: 10px 20px;
    font-size: 14px;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}
.admin-sidebar-item:hover { background-color: var(--color-background); color: var(--color-text-primary); }
.admin-sidebar-item.active {
    background-color: rgba(233, 30, 99, 0.08); /* Brand alpha */
    color: var(--color-brand);
    font-weight: 700;
    border-left-color: var(--color-brand);
}

/* Mobile Tab Strip (Premium) */
.admin-mobile-tabs {
    display: none; /* Hidden on desktop */
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 4px 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #d1d5db transparent;
}
.admin-mobile-tabs::-webkit-scrollbar { height: 4px; } /* Chrome/Safari */
.admin-mobile-tabs::-webkit-scrollbar-track { background: transparent; }
.admin-mobile-tabs::-webkit-scrollbar-thumb { background-color: #d1d5db; border-radius: 4px; }

.admin-mobile-tab-item {
    padding: 8px 16px;
    border-radius: 20px;
    background-color: var(--color-background);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--color-border);
    transition: all 0.2s ease;
    flex-shrink: 0;
    user-select: none;
}
.admin-mobile-tab-item.active {
    background-color: var(--color-brand);
    color: white;
    border-color: var(--color-brand);
    box-shadow: 0 3px 8px rgba(233, 30, 99, 0.25);
    transform: translateY(-1px);
}

.admin-main-content { flex: 1; overflow-y: auto; padding: 16px; position: relative; scroll-behavior: smooth; }

/* Modal Body Reset */
#adminPanel .admin-body { padding: 0 !important; overflow: hidden !important; display: flex; flex-direction: column; }

#adminPanel .admin-header,
#accountModal .admin-header,
#sellerPanel .admin-header,
#agentPanel .admin-header {
    padding-bottom: 8px !important;
}

#adminPanel .admin-mobile-tabs,
#accountModal .admin-mobile-tabs,
#sellerPanel .admin-mobile-tabs,
#agentPanel .admin-mobile-tabs {
    padding: 8px 16px !important;
}

#adminPanel .admin-main-content,
#accountModal .admin-main-content,
#sellerPanel .admin-main-content,
#agentPanel .admin-main-content {
    padding-top: 8px !important;
}

@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { display: none; }
    .admin-mobile-tabs { display: flex; }
    .admin-main-content { padding: 12px; }
}

/* --- Desktop Width Expansion for Sidebar Panels --- */
@media (min-width: 769px) {
    #adminPanel .admin-content,
    #accountModal .admin-content,
    #sellerPanel .admin-content,
    #agentPanel .admin-content {
        max-width: 950px !important; /* Significantly widen the modal on PC */
    }
}