/* Bulk Trader Theme - B2B Wholesale Marketplace for South Africa */

/* ============================================
   CSS Variables & Root Settings
   ============================================ */
:root {
    /* Bulk Trader Colors - Black, White, Blue */
    --primary: #1a1a1a;
    --primary-dark: #0a0a0a;
    --primary-light: #333333;
    --secondary: #3b82f6;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --text-dark: #1a1a1a;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    
    --bg-white: #ffffff;
    --bg-light: #f5f5f5;
    --bg-gray: #e5e5e5;
    --bg-dark: #1a1a1a;
    
    --border-color: #d4d4d4;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
    
    --header-height: 64px;
    --mobile-nav-height: 60px;
}

/* Light theme (default) - Bulk Trader Professional */
:root {
    /* Optimized theme variables */
    --theme-bg: #f5f5f5;
    --theme-text: #1a1a1a;
    --theme-border: #d4d4d4;
    --theme-card-bg: #ffffff;
    --theme-input-bg: #ffffff;
    --theme-header-bg: #ffffff;
    --theme-footer-bg: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    --theme-footer-text: #ffffff;
    
    /* Commonly used components */
    --theme-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --theme-nav-text: #1a1a1a;
    --theme-nav-hover: #3b82f6;
    --theme-button-text: #ffffff;
    --theme-link: #3b82f6;
    --theme-link-hover: #2563eb;
    --theme-accent: #3b82f6;
    --theme-success: #22c55e;
    --theme-error: #ef4444;
}

/* Dark theme - Bulk Trader */
[data-theme="dark"] {
    /* Optimized theme variables */
    --theme-bg: #0a0a0a;
    --theme-text: #f5f5f5;
    --theme-border: #333333;
    --theme-card-bg: #1a1a1a;
    --theme-input-bg: #1a1a1a;
    --theme-header-bg: #0a0a0a;
    --theme-footer-bg: #000000;
    --theme-footer-text: #f5f5f5;
    
    /* Commonly used components */
    --theme-shadow: 0 4px 12px rgba(0,0,0,0.4);
    --theme-nav-text: #f5f5f5;
    --theme-nav-hover: #60a5fa;
    --theme-button-text: #ffffff;
    --theme-link: #60a5fa;
    --theme-link-hover: #3b82f6;
    --theme-accent: #3b82f6;
    --theme-success: #34d399;
    --theme-error: #f87171;
    
    /* Remap base color variables for dark mode */
    --text-dark: #f5f5f5;
    --text-muted: #a3a3a3;
    --text-light: #737373;
    --bg-white: #1a1a1a;
    --bg-light: #262626;
    --bg-gray: #1f1f1f;
    --bg-dark: #0a0a0a;
    --border-color: #333333;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -1px rgba(0,0,0,0.2);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -2px rgba(0,0,0,0.2);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.3), 0 10px 10px -5px rgba(0,0,0,0.2);
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--theme-text);
    background-color: var(--theme-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    -webkit-font-smoothing: antialiased;
    padding-bottom: var(--mobile-nav-height);
}

@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--theme-link);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--theme-link-hover);
}

button {
    cursor: pointer;
    font-family: inherit;
}

/* ============================================
   Layout Utilities
   ============================================ */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

.container-fluid {
    width: 100%;
    padding: 0 16px;
}

@media (min-width: 768px) {
    .container, .container-fluid {
        padding: 0 24px;
    }
}

.full-width {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

/* ============================================
   Header Styles
   ============================================ */
.site-header {
    background: var(--theme-header-bg);
    box-shadow: var(--theme-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 16px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo:hover {
    color: var(--theme-link-hover);
}

.logo img {
    height: 40px;
    width: auto;
}

/* Make logo visible in dark theme */
[data-theme="dark"] .logo img {
    filter: brightness(0) invert(1);
}

/* Dark mode specific fixes */
[data-theme="dark"] .header-btn i {
    color: var(--theme-text);
}

/* Search Bar */
.header-search {
    flex: 1;
    max-width: 500px;
    display: none;
}

@media (min-width: 768px) {
    .header-search {
        display: block;
    }
}

.search-form {
    position: relative;
    display: flex;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    border: 2px solid var(--theme-border);
    border-radius: 50px;
    font-size: 0.95rem;
    background: var(--theme-input-bg);
    color: var(--theme-text);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--theme-input-bg);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--theme-text);
    opacity: 0.7;
    pointer-events: none;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--theme-text);
    font-size: 1.25rem;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
    line-height: 1;
}

.header-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

.header-btn:hover {
    background: var(--theme-border);
    color: var(--theme-link);
}

.cart-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--theme-error);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.cart-count:empty {
    display: none;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: flex;
    color: var(--theme-text);
}

/* Ensure menu icon is visible in dark mode */
.menu-toggle i {
    font-size: 1.5rem;
}

@media (min-width: 992px) {
    .menu-toggle {
        display: none;
    }
}

/* Desktop Navigation */
.desktop-nav {
    display: none;
}

@media (min-width: 992px) {
    .desktop-nav {
        display: flex;
        align-items: center;
        gap: 24px;
    }
}

.nav-link {
    color: var(--theme-text);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.nav-link:hover {
    color: var(--theme-link);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--theme-link);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

/* ============================================
   Mobile Navigation (Bottom Tab Bar)
   ============================================ */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--theme-card-bg);
    border-top: 1px solid var(--theme-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--mobile-nav-height);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

@media (min-width: 768px) {
    .mobile-nav {
        display: none;
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px 4px;
    color: var(--theme-text);
    font-size: 0.7rem;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    opacity: 0.7;
    transition: var(--transition);
}

.mobile-nav-item.active {
    color: var(--theme-link);
    opacity: 1;
}

.mobile-nav-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.mobile-nav-item .nav-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(14px);
    background: var(--theme-error);
    color: white;
    font-size: 0.6rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Mobile Slide Menu
   ============================================ */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 85%;
    max-width: 350px;
    background: var(--theme-card-bg);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: var(--theme-shadow);
    display: flex;
    flex-direction: column;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--theme-border);
}

.mobile-menu-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--theme-border);
    color: var(--theme-text);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.mobile-menu-nav {
    padding: 16px;
    flex: 1;
}

.mobile-menu-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--theme-text);
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    margin-bottom: 4px;
    transition: var(--transition);
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a.active {
    background: var(--theme-border);
    color: var(--theme-link);
    transform: translateX(4px);
}

.mobile-menu-nav a i {
    font-size: 1.25rem;
    width: 24px;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--theme-link) 0%, var(--theme-link-hover) 100%);
    color: var(--theme-button-text);
    padding: 40px 0;
    text-align: center;
    box-shadow: inset 0 -1px 0 var(--theme-border);
}

@media (min-width: 768px) {
    .hero {
        padding: 60px 0;
    }
}

.hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
}

.hero p {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Mobile Search in Hero */
.hero-search {
    max-width: 500px;
    margin: 24px auto 0;
    padding: 0 16px;
}

@media (min-width: 768px) {
    .hero-search {
        display: none;
    }
}

.hero-search .search-input {
    background: white;
    border-color: white;
}

/* ============================================
   Category Pills
   ============================================ */
.category-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 16px 0;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-pills {
    display: flex;
    gap: 10px;
    padding: 0 16px;
    width: max-content;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--theme-card-bg);
    border: 1px solid var(--theme-border);
    border-radius: 50px;
    color: var(--theme-text);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: var(--transition);
    box-shadow: var(--theme-shadow);
}

.category-pill:hover,
.category-pill.active {
    background: var(--theme-link);
    border-color: var(--theme-link);
    color: var(--theme-button-text);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.category-pill i {
    font-size: 1rem;
}

/* ============================================
   Product Grid
   ============================================ */
.products-section {
    padding: 24px 0;
}

@media (min-width: 768px) {
    .products-section {
        padding: 40px 0;
    }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-text);
}

@media (min-width: 768px) {
    .section-title {
        font-size: 1.5rem;
    }
}

.view-all {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 576px) {
    .product-grid {
        gap: 16px;
    }
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (min-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 24px;
    }
}

/* ============================================
   Product Card
   ============================================ */
.product-card {
    background: var(--theme-card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--theme-border);
    box-shadow: var(--theme-shadow);
}

.product-card:hover {
    box-shadow: var(--theme-shadow-md);
    transform: translateY(-4px);
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-light);
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition-slow);
    padding: 8px;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

.product-badge.sale {
    background: var(--danger);
}

.product-wishlist {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--theme-card-bg);
    border: none;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    opacity: 0;
    transform: scale(0.8);
    transition: var(--transition);
}

.product-card:hover .product-wishlist {
    opacity: 1;
    transform: scale(1);
}

.product-wishlist:hover {
    color: var(--danger);
}

.product-wishlist.active {
    color: var(--danger);
}

.product-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .product-info {
        padding: 16px;
    }
}

.product-vendor {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.product-vendor a {
    color: var(--text-muted);
}

.product-vendor a:hover {
    color: var(--primary);
}

.product-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 768px) {
    .product-name {
        font-size: 1rem;
    }
}

.product-name a {
    color: inherit;
}

.product-name a:hover {
    color: var(--primary);
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.product-rating i {
    font-size: 0.85rem;
    color: var(--accent);
}

.product-rating span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.product-price {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.price-current {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

@media (min-width: 768px) {
    .price-current {
        font-size: 1.25rem;
    }
}

.price-old {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.add-cart-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.add-cart-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.add-cart-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Product Detail Page
   ============================================ */
.product-detail {
    padding: 16px 0 40px;
}

@media (min-width: 768px) {
    .product-detail {
        padding: 24px 0 60px;
    }
}

.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 768px) {
    .product-detail-grid {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }
}

.product-gallery {
    position: relative;
}

.main-image {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--theme-card-bg);
    border: 1px solid var(--border-color);
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thumbnail-gallery {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.thumbnail {
    width: 64px;
    height: 64px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--bg-light);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.thumbnail.active,
.thumbnail:hover {
    border-color: var(--primary);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
}

.product-detail-info {
    padding: 0;
}

@media (min-width: 768px) {
    .product-detail-info {
        padding: 0 16px;
    }
}

.product-detail-vendor {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.product-detail-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .product-detail-name {
        font-size: 2rem;
    }
}

.product-detail-price {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.detail-price-current {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

@media (min-width: 768px) {
    .detail-price-current {
        font-size: 2rem;
    }
}

.detail-price-old {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.product-detail-desc {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.7;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.quantity-label {
    font-weight: 600;
    color: var(--text-dark);
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.quantity-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-light);
    color: var(--text-dark);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.quantity-btn:hover {
    background: var(--bg-gray);
    color: var(--primary);
}

.quantity-input {
    width: 60px;
    height: 44px;
    border: none;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    background: var(--theme-card-bg);
    color: var(--theme-text);
}

.quantity-input:focus {
    outline: none;
}

.add-to-cart-full {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.btn-add-cart {
    flex: 1;
    padding: 16px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-add-cart:hover {
    background: var(--primary-dark);
}

.btn-buy-now {
    flex: 1;
    padding: 16px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-buy-now:hover {
    background: var(--accent-dark);
}

/* ============================================
   Cart Page
   ============================================ */
.cart-page {
    padding: 16px 0 40px;
}

@media (min-width: 768px) {
    .cart-page {
        padding: 32px 0 60px;
    }
}

.cart-header {
    margin-bottom: 24px;
}

.cart-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

@media (min-width: 768px) {
    .cart-title {
        font-size: 2rem;
    }
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 992px) {
    .cart-layout {
        grid-template-columns: 1fr 380px;
        gap: 32px;
    }
}

.cart-items {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

@media (min-width: 576px) {
    .cart-item {
        gap: 20px;
        padding: 20px;
    }
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    background: var(--bg-light);
    flex-shrink: 0;
}

@media (min-width: 576px) {
    .cart-item-image {
        width: 100px;
        height: 100px;
    }
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-vendor {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.cart-item-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 4px;
}

.cart-item-remove:hover {
    color: var(--danger);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}

.cart-item-qty button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: 1rem;
}

.cart-item-qty input {
    width: 40px;
    height: 32px;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.9rem;
    background: var(--theme-card-bg);
    color: var(--theme-text);
}

.cart-item-qty input:focus {
    outline: none;
}

/* Cart Summary */
.cart-summary {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: calc(var(--header-height) + 16px);
}

.cart-summary-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.cart-summary-row.total {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border-color);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* Account Layout */
.account-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 8px;
}

@media (min-width: 768px) {
    .account-layout {
        grid-template-columns: 220px 1fr;
        gap: 28px;
    }
}

.account-sidebar {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.account-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.account-nav-link:hover {
    background: var(--bg-light);
}

.account-nav-link.active {
    background: var(--bg-light);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.account-nav-link.logout {
    color: var(--danger);
    border-top: 1px solid var(--border-color);
}

.account-nav-link.logout:hover {
    background: #fef2f2;
}

[data-theme="dark"] .account-nav-link.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.account-nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.account-content {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 24px;
    min-height: 300px;
}

.btn-checkout {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-checkout:hover {
    background: var(--primary-dark);
}

.continue-shopping {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Empty Cart */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-white);
    border-radius: var(--border-radius);
}

.empty-cart-icon {
    font-size: 4rem;
    color: var(--border-color);
    margin-bottom: 16px;
}

.empty-cart h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.empty-cart p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    background: var(--theme-footer-bg);
    color: var(--theme-footer-text);
    padding: 40px 0 24px;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

@media (min-width: 576px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .footer-grid {
        grid-template-columns: 2fr repeat(3, 1fr);
    }
}

.footer-brand {
    max-width: 300px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
    display: block;
}

.footer-desc {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.footer-social {
    display: flex;
    gap: 12px;
}

.footer-social a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    transition: var(--transition);
}

.footer-social a:hover {
    background: var(--primary);
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-light);
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
    padding-left: 4px;
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

@media (min-width: 768px) {
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.footer-copyright {
    color: var(--text-light);
    font-size: 0.85rem;
}

.footer-payments {
    display: flex;
    gap: 8px;
    justify-content: center;
}

@media (min-width: 768px) {
    .footer-payments {
        justify-content: flex-end;
    }
}

.footer-payments img {
    height: 24px;
    opacity: 0.7;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--theme-link);
    color: var(--theme-button-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    background: var(--theme-link-hover);
    color: var(--theme-button-text);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--theme-border);
    color: var(--theme-text);
}

.btn-outline:hover {
    border-color: var(--theme-link);
    color: var(--theme-link);
    transform: translateY(-1px);
}

/* ============================================
   Alerts & Toasts
   ============================================ */
.toast-container {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + 16px);
    left: 16px;
    right: 16px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

@media (min-width: 768px) {
    .toast-container {
        bottom: 24px;
        left: auto;
        right: 24px;
        width: 360px;
    }
}

.toast {
    background: var(--bg-dark);
    color: white;
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    flex: 1;
    font-size: 0.95rem;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    opacity: 0.7;
    font-size: 1.25rem;
    padding: 0;
}

.toast-close:hover {
    opacity: 1;
}

/* ============================================
   Breadcrumbs
   ============================================ */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow-x: auto;
    white-space: nowrap;
}

.breadcrumbs a {
    color: var(--text-muted);
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs i {
    font-size: 0.7rem;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 32px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    color: var(--theme-text);
    background: var(--theme-card-bg);
    border: 1px solid var(--theme-border);
    transition: var(--transition);
}

.pagination a:hover {
    border-color: var(--theme-link);
    color: var(--theme-link);
    box-shadow: var(--theme-shadow);
    transform: translateY(-2px);
}

.pagination .active {
    background: var(--theme-link);
    border-color: var(--theme-link);
    color: var(--theme-button-text);
    box-shadow: var(--theme-shadow);
}

.pagination .disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ============================================
   Theme Switcher
   ============================================ */
.theme-switcher {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 16px;
    gap: 12px;
    will-change: transform; /* Performance optimization */
}

.theme-switcher-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    background: transparent;
    overflow: hidden; /* Performance optimization */
}

.theme-switcher-button:hover {
    transform: scale(1.1);
    border-color: white;
}

.theme-switcher-button.active {
    border-color: #991b1b;
    box-shadow: 0 0 0 3px #0a0a0a, 0 0 0 5px #7f1d1d;
}

.theme-switcher-button.light {
    background: #f8fafc;
    color: #1e293b !important;
    border-color: rgba(30, 41, 59, 0.2);
}

.theme-switcher-button.dark {
    background: #0f172a;
    color: white !important;
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-switcher-button.light.active {
    border-color: #991b1b;
    box-shadow: 0 0 0 3px #0a0a0a, 0 0 0 5px #7f1d1d;
}

.theme-switcher-button.dark.active {
    border-color: #991b1b;
    box-shadow: 0 0 0 3px #0a0a0a, 0 0 0 5px #7f1d1d;
}

/* Override general dark mode icon rules for theme switcher */
[data-theme="dark"] .theme-switcher-button.light .bi {
    color: #1e293b !important;
}

[data-theme="light"] .theme-switcher-button.dark .bi {
    color: white !important;
}

/* ============================================
   Dark Mode Comprehensive Overrides
   ============================================ */
[data-theme="dark"] .quantity-btn {
    background: var(--bg-light);
    color: var(--theme-text);
}

[data-theme="dark"] .quantity-btn:hover {
    background: var(--bg-gray);
}

[data-theme="dark"] .cart-item-qty button {
    color: var(--theme-text);
}

[data-theme="dark"] .quantity-control {
    border-color: var(--border-color);
}

[data-theme="dark"] .cart-item-qty {
    border-color: var(--border-color);
}

[data-theme="dark"] .thumbnail {
    border-color: var(--border-color);
}

[data-theme="dark"] .hero-search .search-input {
    background: var(--theme-input-bg);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

[data-theme="dark"] select,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] textarea {
    background-color: var(--theme-input-bg) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}

[data-theme="dark"] select option {
    background: var(--theme-card-bg);
    color: var(--theme-text);
}

[data-theme="dark"] ::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.7;
}

/* Dark mode product detail inline styles override */
[data-theme="dark"] .product-detail-info [style*="background:var(--bg-light)"],
[data-theme="dark"] .product-detail-info [style*="background:#f8f9fa"] {
    background: var(--bg-light) !important;
}

/* ============================================
   Loading States
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-gray) 25%, var(--bg-light) 50%, var(--bg-gray) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes skeleton {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.fw-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-auto { margin-top: auto; }
.d-none { display: none; }
.d-flex { display: flex; }
.gap-2 { gap: 16px; }

@media (min-width: 768px) {
    .d-md-block { display: block; }
    .d-md-none { display: none; }
}
