/* ==========================================================================
   1. Base Reset & Variables (Clean, Simple, High-Contrast Design)
   ========================================================================== */
:root {
    /* Solid, Trustworthy E-commerce Colors */
    --primary-color: #0d6efd; /* Trustworthy Blue */
    --secondary-color: #198754; /* Success/Money Green */
    --header-bg: #0056b3; /* Darker blue for header */
    --success-color: #28a745; /* Green for discount badges */
    
    /* Backgrounds */
    --app-bg: #f4f7f6; /* Light gray background makes white cards pop */
    --card-bg: #ffffff;
    
    /* Text Colors */
    --text-main: #212529; /* Very dark gray for high readability */
    --text-muted: #6c757d;
    --text-price: #b30000; /* Red/Dark Red for prices to catch attention */
    
    /* Simple Borders & Shadows for clear boundaries */
    --border-light: 1px solid #e0e0e0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    overflow-x: hidden; /* Strictly prevent horizontal scrolling */
}

/* Global Link Styling */
a {
    text-decoration: none;
    color: inherit;
    display: block;
}

body {
    background: var(--app-bg); 
    display: flex;
    justify-content: center;
    padding: 0; 
    margin: 0;
    color: var(--text-main);
}

/* Mobile App Container */
.app-container {
    width: 100%;
    max-width: 100vw; 
    background: var(--app-bg); 
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; 
}

/* ==========================================================================
   2. Sidebar & Overlay Styles (Fluid Widths)
   ========================================================================== */
.sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); 
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: absolute;
    top: 0;
    /* Dynamically size based on screen, cap at 280px */
    width: min(280px, 80vw); 
    left: calc(-1 * min(280px, 80vw));
    height: 100%;
    background: var(--card-bg); 
    z-index: 2000;
    transition: left 0.3s ease;
    box-shadow: 4px 0 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    background: var(--header-bg);
    padding: clamp(15px, 4vw, 20px) clamp(12px, 3.5vw, 15px);
    color: white;
    display: flex;
    align-items: center;
    gap: clamp(8px, 2.5vw, 12px); 
}

.sidebar-header img {
    width: clamp(45px, 12vw, 50px); 
    height: clamp(45px, 12vw, 50px); 
    border-radius: 20%; 
    border: 2px solid white;
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
}

.sidebar-header div {
    min-width: 0; /* Prevents text overflow */
}

.sidebar-header div h3 {
    font-size: clamp(16px, 5vw, 20px); 
    font-weight: 700;
    margin: 0 0 4px 0;
    text-shadow: 1px 2px 3px rgba(0,0,0,0.3); 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-header div p {
    font-size: clamp(11px, 3vw, 13px);
    margin: 0;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-menu-container {
    padding: 0; 
    overflow-y: auto;
    flex: 1;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    border-bottom: var(--border-light); 
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: clamp(12px, 3.5vw, 15px); 
    color: var(--text-main);
    font-weight: 500;
    font-size: clamp(13px, 4vw, 15px); 
}

.sidebar-menu li a i {
    width: clamp(20px, 6vw, 24px); 
    font-size: clamp(16px, 5vw, 18px); 
    color: var(--primary-color);
    margin-right: clamp(8px, 2.5vw, 10px); 
    text-align: center;
}

.sidebar-menu li a:active {
    background: #f0f0f0;
}

/* ==========================================================================
   3. Header Section (Responsive spacing & fluid buttons)
   ========================================================================== */
.header {
    position: sticky;
    top: 0; 
    width: 100%; 
    background: var(--header-bg);
    z-index: 1000;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: clamp(6px, 2vw, 10px); 
    padding: clamp(8px, 2.5vw, 10px); 
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

.header-top { display: contents; }

.header-left {
    display: flex;
    align-items: center;
    gap: clamp(6px, 2vw, 10px); 
    order: 1; 
    flex-shrink: 0;
}

.search-container-wrapper {
    position: relative;
    flex-grow: 1; 
    order: 2; 
    min-width: 0; /* Prevents flex blowout on narrow screens */
}

.header-actions {
    display: flex;
    align-items: center;
    order: 3; 
    flex-shrink: 0;
}

.brand-text, .user-icon-wrapper, .add-btn { display: none !important; }

.menu-toggle-btn {
    width: clamp(40px, 10vw, 48px); 
    height: clamp(40px, 10vw, 48px); 
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(22px, 6vw, 26px); 
    cursor: pointer;
    color: white; 
    text-shadow: 0 3px 6px rgba(0,0,0,0.5); 
}

.brand {
    display: flex;
    align-items: center;
}

.brand-logo {
    width: clamp(34px, 9vw, 40px); 
    height: clamp(34px, 9vw, 40px); 
    border-radius: 8px; 
    object-fit: cover;
    background: white;
    padding: 2px;
}

.cart-icon-wrapper {
    width: clamp(40px, 10vw, 48px); 
    height: clamp(40px, 10vw, 48px); 
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.cart-icon {
    font-size: clamp(22px, 6vw, 26px); 
    color: white; 
    text-shadow: 0 3px 6px rgba(0,0,0,0.5); 
}

.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ff3b30; 
    color: white;
    font-size: clamp(9px, 2.5vw, 11px); 
    font-weight: bold;
    width: clamp(16px, 4.5vw, 18px); 
    height: clamp(16px, 4.5vw, 18px);
    display: none; 
    align-items: center;
    justify-content: center;
    border-radius: 50%; 
    border: 2px solid var(--header-bg); 
}

/* ==========================================================================
   4. Search Bar & Dropdowns (Safe boundaries to prevent horizontal scroll)
   ========================================================================== */
.search-bar input {
    width: 100%;
    padding: clamp(8px, 2.5vw, 10px) clamp(10px, 3vw, 10px) clamp(8px, 2.5vw, 10px) clamp(30px, 8vw, 35px); 
    border: none;
    border-radius: 6px; 
    background-color: white; 
    color: var(--text-main);
    font-size: clamp(12px, 3.5vw, 14px);
    outline: none;
}

.search-bar input::placeholder {
    color: #888;
}

.search-bar i {
    position: absolute;
    left: clamp(8px, 2.5vw, 12px);
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: clamp(12px, 3.5vw, 14px);
}

.search-results-dropdown,
.search-history-dropdown {
    position: absolute;
    top: calc(100% + 5px); 
    left: -20px; /* INCREASED WIDTH */
    width: calc(100% + 40px); /* INCREASED WIDTH */
    min-width: 280px;
    max-width: 95vw;
    background: var(--card-bg);
    border-radius: 6px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15); 
    border: var(--border-light);
    max-height: 40vh; /* Responsive height */
    overflow-y: auto;
    z-index: 9999;
    display: none;
}

.search-results-dropdown {
    padding: 5px; 
}

.search-results-dropdown.active,
.search-history-dropdown.active { 
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: clamp(6px, 2vw, 8px); 
    margin-bottom: 4px; 
    background: var(--app-bg);
    border-radius: 4px;
}

.search-result-img {
    width: clamp(45px, 12vw, 55px); 
    height: clamp(45px, 12vw, 55px); 
    border-radius: 4px;
    object-fit: fill;
    margin-right: clamp(8px, 2.5vw, 10px); 
    background: #fff;
    border: var(--border-light);
    flex-shrink: 0;
}

.search-result-info {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevents overflow */
    justify-content: center;
}

.search-result-name {
    font-size: clamp(12px, 3.5vw, 14px); 
    font-weight: bold;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* NEW: Styles for price in search results */
.search-result-price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}
.search-result-sale-price {
    font-size: clamp(12px, 3.5vw, 14px);
    font-weight: bold;
    color: var(--text-price);
}
.search-result-regular-price {
    font-size: clamp(10px, 3vw, 12px);
    text-decoration: line-through;
    color: var(--text-muted);
}
.search-result-discount-badge {
    font-size: clamp(9px, 2.5vw, 11px);
    color: var(--success-color);
    font-weight: 800;
}

/* Search History Specific */
.history-header {
    display: flex;
    justify-content: space-between;
    padding: clamp(8px, 2.5vw, 10px) clamp(12px, 3.5vw, 15px);
    background: var(--app-bg);
    font-size: clamp(11px, 3.2vw, 13px);
    font-weight: bold;
    color: var(--text-muted);
    border-bottom: var(--border-light);
}

.history-item {
    padding: clamp(8px, 2.5vw, 10px) clamp(12px, 3.5vw, 15px);
    border-bottom: var(--border-light);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(12px, 3.5vw, 14px);
    cursor: pointer;
    transition: background 0.2s;
}

.history-item:hover {
    background-color: var(--app-bg);
}

.history-item:last-child {
    border-bottom: none;
}

.history-icon {
    color: var(--text-muted);
}

/* ==========================================================================
   5. UNIFIED SECTION CONTAINERS & TITLES
   ========================================================================== */
.section-wrapper {
    background: var(--card-bg);
    border-radius: 8px; 
    margin: clamp(8px, 2.5vw, 10px); 
    box-shadow: var(--shadow-sm);
    overflow: hidden; 
}

.full-width-section {
    background: var(--card-bg);
    margin: clamp(8px, 2.5vw, 10px) 0; 
    box-shadow: var(--shadow-sm);
    overflow: hidden; 
}

.grid-categories, 
.products-grid, 
.confidence-scroll-wrapper {
    margin: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(10px, 3vw, 12px) clamp(12px, 3.5vw, 15px); 
    border-bottom: var(--border-light);
}

.section-title {
    font-size: clamp(15px, 4.5vw, 19px); 
    font-weight: bold; 
    color: var(--text-main);
    text-shadow: 1px 2px 3px rgba(0,0,0,0.15); 
}

.section-header a {
    font-size: clamp(10px, 3vw, 12px); 
    color: var(--primary-color);
    font-weight: bold;
    padding: clamp(4px, 1.5vw, 6px) clamp(8px, 2.5vw, 12px); 
    border-radius: 4px; 
    background: #e9f2ff;
}

/* ==========================================================================
   6. Horizontal Scroll Categories
   ========================================================================== */
.scroll-categories {
    display: flex;
    overflow-x: auto;
    padding: clamp(12px, 3.5vw, 15px) clamp(8px, 2.5vw, 10px); 
    gap: clamp(8px, 2.5vw, 12px); 
    scrollbar-width: none;
    background: var(--card-bg); 
    margin-bottom: 5px;
    box-shadow: 0 8px 12px -6px rgba(0,0,0,0.15); 
    position: relative;
    z-index: 10; 
    scroll-snap-type: x mandatory;
}

.scroll-categories::-webkit-scrollbar { display: none; }

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; 
    flex-shrink: 0;
    width: clamp(65px, 18vw, 75px);
    scroll-snap-align: start;
}

.category-image-wrapper {
    width: clamp(50px, 15vw, 60px); 
    height: clamp(50px, 15vw, 60px); 
    border-radius: 10%; 
    background: var(--app-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    overflow: hidden;
}

.category-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-item span {
    font-size: clamp(9px, 2.8vw, 11px); 
    color: var(--text-main);
    font-weight: 600; 
    text-align: center;
    line-height: 1.2;
}

/* ==========================================================================
   7. Image Slider (Fluid Height)
   ========================================================================== */
.slider-wrapper {
    margin: clamp(8px, 2.5vw, 10px) 0; 
    border-radius: 0; 
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.slider-container {
    width: 100%;
    height: clamp(160px, 45vw, 220px); 
    border-radius: 0; 
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.slide {
    min-width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    scroll-snap-align: center;
    display: flex;
    align-items: flex-end; 
    padding: clamp(12px, 3.5vw, 15px); 
    position: relative;
    border-radius: 0; 
}

.slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
}

.slide-content {
    position: relative;
    z-index: 1;
    color: white;
}

.slide-content h2 {
    font-size: clamp(11px, 3.2vw, 13px); 
    font-weight: bold;
    margin-bottom: 0;
    text-shadow: 1px 2px 4px rgba(0,0,0,0.5); 
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px; 
    padding: 8px; 
    background: var(--card-bg);
}

.dot {
    width: clamp(6px, 1.8vw, 8px);
    height: clamp(6px, 1.8vw, 8px);
    border-radius: 50%; 
    background: #ccc; 
}

.dot.active {
    background: var(--primary-color); 
    width: clamp(16px, 4.5vw, 20px);
    border-radius: 4px;
}

/* ==========================================================================
   8. Grid Categories (Auto-fit for responsiveness)
   ========================================================================== */
.grid-categories {
    display: grid;
    /* Auto fits columns smoothly down to mobile sizes */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 80px), 1fr)); 
    gap: clamp(8px, 2.5vw, 10px); 
    padding: clamp(12px, 3.5vw, 15px); 
}

.grid-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--app-bg); 
    border: var(--border-light);
    border-radius: 8px; 
    padding: clamp(8px, 2.5vw, 10px) clamp(4px, 1.5vw, 5px); 
    text-align: center;
}

.grid-cat-card img {
    width: clamp(40px, 12vw, 50px);  
    height: clamp(40px, 12vw, 50px); 
    border-radius: 8px; 
    object-fit: cover; 
    margin-bottom: 8px; 
    background: white;
}

.grid-cat-card span {
    color: var(--text-main); 
    font-size: clamp(10px, 3vw, 12px); 
    font-weight: 600; 
    line-height: 1.2;
}

/* ==========================================================================
   9. Promotional Banner Area (Fluid Height)
   ========================================================================== */
.promo-banner-wrapper {
    position: relative;
    height: clamp(180px, 50vw, 250px); 
    overflow: hidden;
}

.dyn-banner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.dyn-banner.active {
    opacity: 1;
    z-index: 2;
}

.dyn-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   10. New Products Section (Fluid Auto-Fit Grid + New Pricing Layout)
   ========================================================================== */
.products-grid {
    display: grid;
    /* Prevents breaking on ultra-narrow screens while utilizing space on larger ones */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
    gap: clamp(8px, 2.5vw, 10px); 
    padding: clamp(12px, 3.5vw, 15px); 
    background: var(--app-bg);
}

.product-card {
    background: var(--card-bg); 
    border-radius: 8px; 
    overflow: hidden;
    box-shadow: var(--shadow-sm); 
    border: var(--border-light);
    display: flex;
    flex-direction: column;
}

.product-image-container {
    height: clamp(120px, 35vw, 150px); 
    background: #fff; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px; 
    border-bottom: var(--border-light);
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
}

.product-info {
    padding: clamp(8px, 2.5vw, 10px); 
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-info h4 {
    font-size: clamp(11px, 3.2vw, 13px); 
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 5px;
}

.product-price-section {
    padding: 5px clamp(8px, 2.5vw, 10px) clamp(8px, 2.5vw, 10px); 
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.price-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.price-text {
    font-size: clamp(13px, 4vw, 16px); 
    font-weight: bold;
    color: var(--text-price); 
    line-height: 1.1;
}

.regular-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: clamp(10px, 3vw, 12px);
}

.discount-badge {
    color: var(--success-color);
    font-size: clamp(10px, 3vw, 12px);
    font-weight: 800;
    margin-left: 4px;
}

.product-add-btn {
    background: var(--secondary-color); 
    width: clamp(28px, 8vw, 32px); 
    height: clamp(28px, 8vw, 32px); 
    border-radius: 4px; 
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: clamp(12px, 3.5vw, 14px);
    flex-shrink: 0;
}

.view-more-container {
    display: none; 
    justify-content: center; 
    padding: clamp(12px, 3.5vw, 15px); 
    background: var(--card-bg);
    border-top: var(--border-light); 
}
        
.btn-view-more {
    background: var(--primary-color); 
    color: white;
    padding: clamp(10px, 3vw, 12px) clamp(16px, 4.5vw, 20px);
    border-radius: 6px; 
    font-size: clamp(12px, 3.5vw, 14px);
    font-weight: bold;
    border: none;
    width: 100%;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   11. Shop With Confidence Section
   ========================================================================== */
.confidence-scroll-wrapper {
    display: flex;
    overflow-x: auto;
    gap: clamp(8px, 2.5vw, 10px); 
    padding: clamp(12px, 3.5vw, 15px); 
    scrollbar-width: none; 
    scroll-snap-type: x mandatory;
}

.confidence-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--app-bg);
    border: var(--border-light);
    border-radius: 8px; 
    padding: clamp(12px, 3.5vw, 15px) clamp(8px, 2.5vw, 10px); 
    width: clamp(80px, 24vw, 90px); 
    text-align: center;
    color: var(--text-main);
    scroll-snap-align: start;
}

.confidence-item i {
    font-size: clamp(20px, 6vw, 24px); 
    margin-bottom: 8px;
    color: var(--primary-color);
}

.confidence-item span {
    font-size: clamp(9px, 2.8vw, 11px); 
    font-weight: 600;
}

/* ==========================================================================
   12. Footer
   ========================================================================== */
.footer {
    color: var(--text-muted);
    text-align: center;
    padding: clamp(15px, 4.5vw, 20px) clamp(12px, 3.5vw, 15px); 
    background: var(--card-bg);
    border-top: var(--border-light);
    margin-top: 10px;
}

.footer .social-icons {
    display: flex;
    justify-content: center;
    gap: clamp(10px, 3vw, 15px); 
    margin-bottom: 15px; 
}

.social-link {
    width: clamp(36px, 10vw, 40px); 
    height: clamp(36px, 10vw, 40px); 
    border-radius: 50%; 
    background: var(--app-bg); 
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 4.5vw, 18px);
    color: var(--text-main);
    border: var(--border-light);
}

.footer p {
    font-size: clamp(10px, 3vw, 12px); 
    font-weight: 500;
}

/* ==========================================================================
   13. Global Loader
   ========================================================================== */
.global-loader {
    position: fixed;
    inset: 0; 
    background: white;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.global-loader.hidden {
    display: none;
}

.global-spinner {
    width: clamp(35px, 10vw, 40px); 
    height: clamp(35px, 10vw, 40px);
    border: 4px solid #f3f3f3; 
    border-top: 4px solid var(--primary-color);
    border-radius: 50%; 
    animation: spin-loader 1s linear infinite;
}

@keyframes spin-loader { 100% { transform: rotate(360deg); } }

/* ==========================================================================
   14. Category Modal (Bottom Sheet - Auto widths)
   ========================================================================== */
.cat-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6); 
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}

.cat-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cat-modal {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100vh; /* Changed from 100% to strictly handle viewport */
    max-height: 100dvh;
    background: var(--card-bg);
    border-radius: 12px 12px 0 0; 
    z-index: 2001;
    transition: 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cat-modal.active { bottom: 0; }

.cat-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(12px, 3.5vw, 15px); 
    border-bottom: var(--border-light);
}

.cat-modal-header h3 {
    font-size: clamp(16px, 5vw, 20px); 
    font-weight: bold;
    color: var(--text-main);
    text-shadow: 1px 2px 3px rgba(0,0,0,0.15); 
}

.close-cat-modal {
    background: var(--app-bg);
    color: var(--text-main);
    border: none;
    width: clamp(28px, 8vw, 32px); 
    height: clamp(28px, 8vw, 32px); 
    border-radius: 50%; 
    font-size: clamp(14px, 4vw, 16px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cat-modal-search {
    padding: clamp(12px, 3.5vw, 15px);
    background: var(--card-bg);
    border-bottom: var(--border-light);
}

.cat-modal-search .search-bar {
    display: flex;
    align-items: center;
    background: var(--app-bg);
    border-radius: 6px;
    padding: 0;
    border: 1px solid #ccc;
}

.cat-modal-search .search-bar i {
    color: #666;
    padding-left: clamp(8px, 2.5vw, 10px);
}

.cat-modal-search .search-bar input {
    border: none;
    background: transparent;
    padding: clamp(10px, 3vw, 12px);
    width: 100%;
    font-size: clamp(12px, 3.5vw, 14px);
    color: var(--text-main);
}

.cat-modal-body {
    padding: clamp(12px, 3.5vw, 15px); 
    overflow-y: auto;
    flex-grow: 1;
    background: var(--app-bg);
}

.modal-products-grid {
    display: grid;
    /* Adapts automatically inside modal */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
    gap: clamp(8px, 2.5vw, 10px); 
}

/* ==========================================================================
   15. Exit Toast Notification (Fluid width)
   ========================================================================== */
.exit-toast {
    position: fixed;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    width: clamp(260px, 80%, 350px); /* Smart bounding box */
    text-align: center;
    padding: clamp(10px, 3vw, 12px) clamp(16px, 4vw, 20px); 
    border-radius: 8px; 
    font-size: clamp(12px, 3.5vw, 13px); 
    font-weight: 500;
    z-index: 9999999;
    transition: 0.3s ease;
    opacity: 0;
}

.exit-toast.show {
    bottom: 30px; 
    opacity: 1;
}

/* Lazy Load */
.lazy-load-img, .lazy-bg {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}
.lazy-load-img.loaded, .lazy-bg.loaded {
    opacity: 1;
}