
/* --- Modal stacking context fix ---
   Ensure modal and backdrop overlay the fixed header and any higher z-index UI.
   This addresses the issue where the header overlaps the modal dialog/backdrop. */
.modal-backdrop {
    z-index: 2050 !important;
}
.modal {
    z-index: 2060 !important; /* above backdrop and header */
}

/* Make modal content render above inner clipping and give it breathing room from header */
.modal.show .modal-dialog {
    margin-top: 1.75rem; /* keep dialog away from sticky header */
    margin-bottom: 1.25rem;
}
.modal-content {
    overflow: visible; /* avoid clipping labels or dropdowns near edges */
}

/* Form labels inside modals should sit above inputs and never look like links */
.modal .form-label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 600;
    text-decoration: none !important;
}
html[dir="rtl"] .modal .form-label { text-align: right; }
html[dir="ltr"] .modal .form-label { text-align: left; }

.modal .form-control,
.modal .form-select { width: 100%; }

/* Optional: give a bit more top spacing on small screens so header doesn't feel glued */
@media (max-width: 576px) {
    .modal.show .modal-dialog {
        margin-top: 1.25rem;
        margin-bottom: 1.25rem;
    }
}
/* ===== متغيرات التصميم (Design System) ===== */
:root {
    /* الألوان الأساسية */
    --primary-color: #667eea;
    --primary-light: #764ba2;
    --primary-dark: #4c63d2;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* متغيرات توافقية للاستخدامات القديمة */
    --primary: #667eea;                 /* بعض الأجزاء تستخدم var(--primary) */
    --primary-rgb: 102, 126, 234;       /* لطبقات الشفافية والنبض */
    --secondary: #764ba2;               /* للـ gradients مثل زر السلة الثابت */
    --secondary-rgb: 118, 75, 162;
    
    /* الألوان الثانوية */
    --secondary-color: #f093fb;
    --secondary-light: #f5b7b1;
    --secondary-dark: #e91e63;
    
    /* الألوان المحايدة */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* ألوان العلامة التجارية */
    --brand-primary: #2563eb;
    --brand-secondary: #1d4ed8;
    --brand-accent: #3b82f6;
    
    /* ألوان الحالة */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* الخطوط */
    --font-primary: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-secondary: 'Tajawal', 'Cairo', Arial, sans-serif;
    --font-price: 'IBM Plex Sans Arabic', 'Tajawal', monospace;
    
    /* أحجام الخط */
    --text-xs: 0.8rem;
    --text-sm: 0.9rem;
    --text-base: 1rem;
    --text-lg: 1.15rem;
    --text-xl: 1.3rem;
    --text-2xl: 1.6rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;
    
    /* أحجام الأسعار */
    --price-sm: 0.85rem;
    --price-base: 1rem;
    --price-lg: 1.2rem;
    --price-xl: 1.4rem;
    
    /* المسافات */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    
    /* نصف القطر */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* الظلال */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    /* التأثيرات الانتقالية */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
    
    /* نقاط الانقطاع */
    --mobile: 480px;
    --tablet: 768px;
    --desktop: 1024px;
    --wide: 1280px;
}

/* ===== إعادة تعيين الأساسيات ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
    padding-bottom: 76px; /* space for fixed cart bar; page-specific components may override their own padding */
}
/* NOTE: Removed transform/backface on body to keep position:fixed elements (like .toast-container)
   attached to the viewport even when the page is scrolled; transforms on ancestors can break fixed positioning. */

main {
    padding-bottom: var(--space-20);
}

/* دعم اللغة العربية RTL */
[dir="rtl"] {
    font-family: var(--font-secondary);
}

/* ===== الطباعة ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: var(--space-4);
    color: var(--gray-900);
    font-family: var(--font-secondary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
    margin-bottom: var(--space-4);
    color: var(--gray-600);
    line-height: 1.7;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== مكونات التخطيط ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.container--narrow {
    max-width: 800px;
}

.container--wide {
    max-width: 1400px;
}

/* متغيرات إضافية (يمكن إعادة تعريفها لاحقاً) */
:root { --header-sticky-offset: 72px; }
@media (min-width: 768px) { :root { --header-sticky-offset: 84px; } }

/* ===== Breadcrumb – Modern Polish (global) ===== */
/* Base breadcrumb container (for pages without .breadcrumb-bar wrapper) */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .35rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: .5rem .75rem;
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-md);
}
/* Breadcrumb items and separators */
.breadcrumb .breadcrumb-item { display: inline-flex; align-items: center; color: var(--gray-600); }
.breadcrumb .breadcrumb-item + .breadcrumb-item { position: relative; }
.breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: '›';
    color: var(--gray-400);
    margin: 0 .25rem;
}
html[dir="rtl"] .breadcrumb .breadcrumb-item + .breadcrumb-item::before { content: '‹'; }
/* Link chips */
.breadcrumb .breadcrumb-item a {
    color: var(--gray-700);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .6rem;
    border-radius: 999px;
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid var(--gray-200);
    font-weight: 600;
    transition: var(--transition-normal);
}
.breadcrumb .breadcrumb-item a:hover {
    background: var(--primary-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
/* Active crumb styled like a soft chip (no link) */
.breadcrumb .breadcrumb-item.active {
    color: var(--gray-700);
    font-weight: 700;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    padding: .35rem .6rem;
}

/* شريط المسار مثبت أسفل الهيدر */
/* Sticky breadcrumb wrapper (when present) with glass effect */
.breadcrumb-bar {
    position: sticky;
    top: var(--header-sticky-offset, 56px);
    /* Keep breadcrumb below header (z-index: header 1200) and above content */
    z-index: 1100;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.86));
    border-bottom: 1px solid var(--gray-200);
    backdrop-filter: saturate(140%) blur(8px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}
.breadcrumb-bar .container { padding-top: var(--space-2); padding-bottom: var(--space-2); }
/* Inside sticky bar, keep breadcrumb minimal with chip items and no extra container chrome */
.breadcrumb-bar .breadcrumb {
        margin: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 0;
}
.breadcrumb-spacer { height: 0; }
/* Optional util: add .with-sticky-breadcrumb on a wrapper to reserve space on anchor jumps */
body .with-sticky-breadcrumb { scroll-margin-top: calc(var(--header-sticky-offset, 56px) + 8px); }
.breadcrumb-bar .breadcrumb .breadcrumb-item a { color: var(--gray-700); }
.breadcrumb-bar .breadcrumb .breadcrumb-item a:hover { color: #fff; }
.breadcrumb-bar .breadcrumb .breadcrumb-item.active { color: var(--gray-800); background: rgba(15, 23, 42, 0.06); }

/* Mobile ergonomics: allow horizontal scroll for long paths */
@media (max-width: 768px) {
    .breadcrumb { overflow-x: auto; scrollbar-width: thin; }
    .breadcrumb::-webkit-scrollbar { height: 6px; }
    .breadcrumb::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 999px; }
}

/* ===== مكون الهيدر ===== */
.header {
    background: var(--primary-gradient);
    color: var(--white);
    padding: var(--space-4) 0;
    box-shadow: var(--shadow-lg);
    /* default sticky; can be overridden to static via class */
    position: sticky;
    top: 0;
    z-index: 1200; /* keep header above content but below toasts */
    will-change: transform;
    transform: translateZ(0);
}
.header.is-sticky { position: sticky; }
.header.not-sticky { position: static; top: auto; }

.header__container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}
/* Flip layout naturally based on document direction:
   - RTL: brand on the right, actions on the left
   - LTR: brand on the left, actions on the right */
html[dir="rtl"] .header__container { flex-direction: row-reverse; }

.header__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--white);
    transition: var(--transition-normal);
    flex: 1;
    min-width: 0;
}

.header__brand:hover {
    transform: translateY(-2px);
    color: var(--white);
    text-decoration: none;
}

.header__logo {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    border: 3px solid var(--white);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    flex-shrink: 0;
}

.header__logo:hover {
    transform: scale(1.05);
}

.header__title {
    font-size: var(--text-xl);
    font-weight: 800;
    margin: 0;
    color: var(--white);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-secondary);
}

.header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}
/* LTR: enforce visual order on the right as [menu, branch, language] (rightmost to leftmost) */
html[dir="ltr"] .header__actions .language-toggle { order: 1; }
html[dir="ltr"] .header__actions .branch-toggle { order: 2; }
html[dir="ltr"] .header__actions .sidebar-toggle { order: 3; }
/* Keep actions on the right in RTL by making actions the first flex item */
html[dir="rtl"] .header__brand { order: 2; }
html[dir="rtl"] .header__actions { order: 1; }
/* Ensure menu button appears before language toggle visually */
.header__actions .sidebar-toggle { order: 0; }
.header__actions .language-toggle { order: 1; }

/* Remove homepage special-casing; all buttons stay grouped together */

.language-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--white);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-weight: 600;
    transition: var(--transition-normal);
    backdrop-filter: blur(10px);
    font-size: var(--text-sm);
    white-space: nowrap;
    font-family: var(--font-secondary);
    cursor: pointer;
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===== أيقونات الهيدر ===== */
.header__icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
}

.header__icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.header__icon-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--error);
    color: var(--white);
    border-radius: var(--radius-full);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
}

html[dir="ltr"] .header__icon-btn .badge { left: -5px; right: auto; }

/* ===== قسم الفئات ===== */
.categories-section {
    background: var(--white);
    border-bottom: 2px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    will-change: transform;
    transform: translateZ(0);
    position: sticky;
    top: var(--categories-sticky-top, var(--header-sticky-offset, 70px)); /* أسفل الهيدر، يصبح 0 عند إخفاء/عدم تثبيت الهيدر */
    z-index: 1100; /* below header, above content */
}

.categories-container {
    /* Vertically center content inside desired bar height */
    padding: calc(max(0px, (var(--categories-bar-height, 56px) - 40px) / 2)) var(--space-6);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
    -webkit-overflow-scrolling: touch;
}

.categories-list {
    display: flex;
    gap: var(--space-3);
    padding: 0;
    min-width: max-content;
}

.category-btn {
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    color: var(--gray-700);
    /* Derive vertical padding from target bar height so button + paddings fit nicely */
    padding: calc(max(6px, (var(--categories-bar-height, 56px) - 28px) / 2)) var(--space-5);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--categories-bar-font-size, var(--text-sm));
    transition: var(--transition-normal);
    cursor: pointer;
    white-space: nowrap;
    font-family: var(--font-secondary);
    position: relative;
    overflow: hidden;
}

.category-btn:hover {
    background: var(--gray-200);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.category-btn.selected {
    background: var(--primary-gradient);
    border-color: var(--primary-color);
    color: var(--white);
    box-shadow: var(--shadow-lg);
}

/* ===== قسم البحث وعناصر التحكم ===== */
.search-section {
    padding: var(--space-6) 0;
    background: var(--white);
}

.search-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.search-input {
    width: 100%;
    padding: var(--space-4) var(--space-12) var(--space-4) var(--space-12);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-2xl);
    font-size: var(--text-base);
    background: var(--white);
    transition: var(--transition-normal);
    font-family: var(--font-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: var(--text-lg);
}

/* Camera scan icon button next to search input */
.scan-icon-btn {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    color: var(--gray-700);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}
.scan-icon-btn:hover { background: var(--gray-200); border-color: var(--primary-color); color: var(--primary-color); }
html[dir="rtl"] .scan-icon-btn { left: var(--space-4); right: auto; }

.view-options {
    display: flex;
    gap: var(--space-2);
    background: var(--white);
    padding: var(--space-1);
    border-radius: var(--radius-lg);
    border: 2px solid var(--gray-200);
    align-self: center;
    flex-wrap: wrap;
    justify-content: center;
}

.view-btn {
    padding: var(--space-2) var(--space-3);
    border: none;
    background: transparent;
    color: var(--gray-600);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    font-weight: 600;
    min-width: 80px;
    justify-content: center;
    font-family: var(--font-secondary);
}

.view-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.view-btn.active {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

/* ===== قسم المنتجات ===== */
.products-section {
    padding: var(--space-6) 0 var(--space-8);
    scroll-margin-top: 150px;
}

.products-header {
    margin-bottom: var(--space-6);
    text-align: center;
    padding: var(--space-6) var(--space-4);
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
    border-radius: var(--radius-2xl);
    border: 2px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    margin: var(--space-4) 0 var(--space-6);
}

.products-title {
    font-size: var(--text-2xl);
    color: var(--gray-900);
    margin: 0;
    font-weight: 700;
    font-family: var(--font-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.products-count {
    background: var(--primary-gradient);
    color: var(--white);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    min-width: 40px;
    text-align: center;
}

/* طرق عرض الشبكة */
.products-grid {
    display: grid;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    transition: var(--transition-normal);
    will-change: contents;
}

.products-grid--grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.products-grid--grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.products-grid--list {
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

/* ===== مكون بطاقة المنتج ===== */
.product-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    border: 1px solid var(--gray-200);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    will-change: transform;
    transform: translateZ(0);
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-2xl);
    border-color: var(--primary-color);
}

.product-card--list {
    flex-direction: row;
    height: auto;
    min-height: 140px;
}

.product-card__image-container {
    position: relative;
    overflow: hidden;
    background: var(--gray-100);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
}

/* Out of stock overlay */
.oos-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
    font-size: .95rem;
    pointer-events: none;
}
.oos-overlay span {
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,.25);
    padding: 6px 10px;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
}

/* Featured badge ("مميز") on product cards */
.featured-badge {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-weight: 700;
    font-size: var(--text-xs);
    padding: 4px 8px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    box-shadow: var(--shadow-md);
    line-height: 1;
}

html[dir="rtl"] .featured-badge {
    left: var(--space-2);
    right: auto;
}

.featured-badge i {
    color: #fff;
    font-size: 0.85rem;
}

.product-card--list .product-card__image-container {
    width: 160px;
    min-height: 140px;
    flex-shrink: 0;
    padding: var(--space-2);
}

.product-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: var(--radius-md);
    transition: var(--transition-slow);
}

.product-card:hover .product-card__image {
    transform: scale(1.05);
}

.product-card__content {
    padding: var(--space-4);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card--list .product-card__content {
    padding: var(--space-3);
}

.product-card__title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
    line-height: 1.4;
    font-family: var(--font-secondary);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__description {
    color: var(--gray-600);
    font-size: var(--text-sm);
    line-height: 1.6;
    margin-bottom: var(--space-3);
    flex: 1;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__price {
    font-size: var(--price-lg);
    font-weight: 700;
    color: var(--primary-color);
    font-family: var(--font-price);
    margin-bottom: var(--space-3);
}

.product-card__actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.add-to-cart-btn {
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    justify-content: center;
    font-family: var(--font-secondary);
}

.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.add-to-cart-btn:disabled,
.add-to-cart-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.2);
    box-shadow: none;
}

/* ===== القائمة الجانبية ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1600;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    background: var(--white);
    z-index: 1700;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar.show {
    right: 0;
}

.sidebar__header {
    padding: var(--space-4);
    background: var(--primary-gradient);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 80px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar__title {
    font-size: var(--text-lg);
    font-weight: 700;
    margin: 0;
    font-family: var(--font-secondary);
}

.sidebar__close {
    background: none;
    border: none;
    color: var(--white);
    font-size: var(--text-xl);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar__content {
    padding: var(--space-4);
    /* Leave room at bottom so the last item isn't obscured by viewport chrome or fixed bars */
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px) + 24px);
    flex: 1;
    overflow-y: auto;
}

.sidebar__menu {
    list-style: none;
    margin: 0;
    padding: 0;
    /* Ensure extra breathing room at the end for easy tapping of the last item */
    padding-bottom: var(--space-2);
}

.sidebar__menu-item {
    margin-bottom: var(--space-2);
}

.sidebar__menu-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
    font-family: var(--font-secondary);
}

.sidebar__menu-link:hover {
    background: var(--gray-100);
    color: var(--primary-color);
    text-decoration: none;
}

.sidebar__menu-link--danger {
    color: var(--danger) !important;
}

.sidebar__menu-link--danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger) !important;
}

.sidebar__menu-divider {
    height: 1px;
    background: var(--gray-200);
    margin: var(--space-3) 0;
    list-style: none;
}

.sidebar-badge {
    background: var(--primary-color);
    color: var(--white);
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: auto;
}

.cart-full-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: var(--primary-gradient);
    box-shadow: var(--shadow-xl);
    /* Keep below the sidebar (1700) and overlay (1600) but above normal content */
    z-index: 1200;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.cart-full-bar__btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--white);
    background: transparent;
    border: none;
    padding: var(--space-4) var(--space-6);
    min-height: var(--review-order-btn-height, 56px);
    font-weight: 700;
    font-size: var(--review-order-btn-font-size, var(--text-lg));
    cursor: pointer;
}

.cart-full-bar__btn i { font-size: var(--text-xl); }
.cart-full-bar__text { white-space: nowrap; }
.cart-full-bar__spacer { flex: 1; }
.cart-full-bar__count {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: var(--radius-full);
    padding: 2px 10px;
    min-width: 36px;
    text-align: center;
    font-weight: 800;
}
.cart-full-bar__total { font-weight: 800; }

/* ===== صفحة تفاصيل المنتج ===== */
.product-details-page {
    padding: var(--space-6) 0;
}

.product-images {
    position: sticky;
    top: 100px;
}

.main-image {
    margin-bottom: var(--space-4);
}

.product-main-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.gallery-thumbnails {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.gallery-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-fast);
}

.gallery-thumb:hover,
.gallery-thumb.active {
    border-color: var(--primary-color);
}

.product-info {
    padding-left: var(--space-6);
}

.product-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-3);
}

.product-category {
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.product-rating {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.stars {
    display: flex;
    gap: 2px;
}

.stars .fa-star {
    color: var(--gray-300);
    font-size: var(--text-sm);
}

.stars .fa-star.active {
    color: var(--warning);
}

.product-price {
    margin-bottom: var(--space-6);
}

.current-price {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--primary-color);
}

.product-description {
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
}

.product-options {
    margin-bottom: var(--space-6);
}

.option-group {
    margin-bottom: var(--space-4);
}

.option-label {
    display: block;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.required {
    color: var(--danger);
}

.radio-options,
.checkbox-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.radio-option,
.checkbox-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.radio-option:hover,
.checkbox-option:hover {
    border-color: var(--primary-color);
    background: var(--gray-50);
}

.radio-option input,
.checkbox-option input {
    margin: 0;
}

.price-modifier {
    color: var(--primary-color);
    font-weight: 500;
    margin-left: var(--space-2);
}

.product-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.quantity-controls button {
    background: var(--gray-100);
    border: none;
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-fast);
}

.quantity-controls button:hover {
    background: var(--gray-200);
}

.quantity-controls input {
    border: none;
    padding: var(--space-2);
    width: 60px;
    text-align: center;
    font-weight: 600;
}

.add-to-cart-btn-large {
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
}

.add-to-cart-btn-large:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.additional-info {
    border-top: 1px solid var(--gray-200);
    padding-top: var(--space-4);
}

.info-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    color: var(--gray-600);
}

.product-tabs-section {
    margin: var(--space-12) 0;
    border-top: 1px solid var(--gray-200);
    padding-top: var(--space-6);
}

.nav-tabs {
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--space-6);
}

.nav-tabs .nav-link {
    color: var(--gray-600);
    font-weight: 500;
    padding: var(--space-3) var(--space-4);
    border: none;
    border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: none;
}

.description-content,
.reviews-content {
    padding: var(--space-4) 0;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.review-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.review-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.reviewer-name {
    font-weight: 600;
    color: var(--gray-900);
}

.review-rating {
    display: flex;
    gap: 2px;
}

.review-date {
    color: var(--gray-500);
    font-size: var(--text-sm);
    margin-left: auto;
}

.review-comment {
    color: var(--gray-700);
    line-height: 1.6;
}

.no-reviews {
    text-align: center;
    padding: var(--space-8);
    color: var(--gray-500);
}

.related-products-section {
    margin-top: var(--space-12);
    border-top: 1px solid var(--gray-200);
    padding-top: var(--space-6);
}

.related-products-section h3 {
    margin-bottom: var(--space-6);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--gray-900);
}

/* ===== صفحة البحث المخصصة ===== */
.search-page-container {
    padding: var(--space-6) 0;
    min-height: 70vh;
}

.search-page-header .page-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.search-subtitle {
    color: var(--gray-600);
    margin: 0;
}

.results-info {
    display: flex;
    flex-direction: column;
    align-items: end;
    gap: var(--space-1);
}

.results-count {
    font-weight: 600;
    color: var(--primary-color);
}

.page-info {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.search-controls-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-6);
}

.search-input-group {
    position: relative;
    display: flex;
}

.search-input-group .search-input {
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    border-right: none;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
}

/* RTL/LTR adjustments for search input */
html[dir="rtl"] .search-input-group .search-input {
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    border-right: 1px solid var(--gray-300);
    border-left: none;
    text-align: right;
    direction: rtl;
}

html[dir="ltr"] .search-input-group .search-input {
    text-align: left;
    direction: ltr;
}

.search-submit-btn {
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    min-width: 48px;
}

.search-submit-btn:hover {
    background: var(--primary-dark);
}

/* RTL/LTR adjustments for search submit button */
html[dir="rtl"] .search-submit-btn {
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

html[dir="ltr"] .search-submit-btn {
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* === Global RTL/LTR logical fixes === */
/* Use inline-start/end for margins in key components */
html[dir="rtl"] .ms-auto { margin-right: auto !important; margin-left: 0 !important; }
html[dir="rtl"] .me-2 { margin-left: .5rem !important; margin-right: 0 !important; }
html[dir="rtl"] .ms-2 { margin-right: .5rem !important; margin-left: 0 !important; }
html[dir="rtl"] .text-start { text-align: right !important; }
html[dir="rtl"] .text-end { text-align: left !important; }
html[dir="rtl"] .form-check { padding-right: 1.5em; padding-left: 0; }
html[dir="rtl"] .form-check-input { float: right; margin-right: 0; margin-left: .5em; }
html[dir="rtl"] .breadcrumb .breadcrumb-item + .breadcrumb-item::before { content: '\\'; }
/* Dropdown caret/icon flip */
html[dir="rtl"] .dropdown-toggle::after { margin-right: .255em; margin-left: 0; }
/* Sidebar slide from right in RTL already; ensure LTR slides from left */
html[dir="ltr"] .sidebar { right: auto; left: -320px; }
html[dir="ltr"] .sidebar.show { left: 0; }

.search-results-section {
    min-height: 400px;
}

.no-results {
    text-align: center;
    padding: var(--space-12);
    color: var(--gray-500);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.no-results-suggestions {
    margin: var(--space-6) 0;
    text-align: left;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.no-results-suggestions h5 {
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.no-results-suggestions ul {
    list-style: none;
    padding: 0;
}

.no-results-suggestions li {
    padding: var(--space-1) 0;
    color: var(--gray-600);
}

.no-results-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== الحالة التحميل ===== */
.loading-products {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-4);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== الاستجابة للجوال ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-3);
    }
    
    .header__container {
        flex-wrap: nowrap;
        gap: var(--space-2);
    }
    
    .header__title {
        font-size: var(--text-lg);
    }
    
    .header__logo {
        width: 40px;
        height: 40px;
    }
    
    .categories-container {
        padding: var(--space-3);
    }
    
    .search-controls {
        padding: 0 var(--space-3);
    }
    
    .view-btn {
        padding: var(--space-2);
        min-width: 60px;
    }
    
    .view-btn span {
        display: none;
    }
    
    .products-grid--grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: var(--space-3);
    }
    
    .products-grid--grid-2 {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .product-card__image-container {
        min-height: 150px;
    }
    
    .product-card__content {
        padding: var(--space-3);
    }
}

/* ===== Cart Modern Polish (overrides) ===== */
.cart-page { background: #f7f8fb; }
.cart-items { border: 1px solid var(--gray-200); overflow: hidden; box-shadow: var(--shadow-lg); }
.cart-header { background: linear-gradient(135deg, #ffffff, #f8fafc); border-bottom: 1px solid var(--gray-200); }
.cart-item { background: #fff; border: 1px dashed #e5e7eb; }
.cart-item:hover { border-color: var(--primary-color); box-shadow: 0 6px 20px rgba(102,126,234,.12); }
.quantity-controls { background: #f8fafc; border: 1px solid #e5e7eb; }
.quantity-btn { box-shadow: 0 1px 0 #e5e7eb; }
.quantity-btn:hover { background: var(--primary-gradient); color: #fff; }
.btn-remove { border: 1px solid #fee2e2; background: #fff; }
.btn-remove:hover { background: #fee2e2; color: #991b1b; }
.order-summary { border: 1px solid var(--gray-200); box-shadow: var(--shadow-lg); }
.order-totals .total-row { font-weight: 600; }
.order-totals .total-final { background: #0f172a; color: #fff; border-radius: 12px; padding: 10px 12px; }
.empty-cart { border: 1px solid var(--gray-200); }

@media (max-width: 480px) {
    .header__actions {
        gap: var(--space-1);
    }
    
    .header__icon-btn {
        width: 36px;
        height: 36px;
    }
    
    .products-grid--grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .products-grid--grid-2 {
        grid-template-columns: 1fr;
    }
    
    .product-card__title {
        font-size: var(--text-base);
    }
    
    .product-card__description {
        font-size: var(--text-xs);
    }
    
    .sidebar {
        width: 280px;
    }
}

/* ===== تأثيرات إضافية ===== */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 30000; /* above any modal/backdrop */
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none; /* let clicks pass to UI except toast close buttons */
}

/* ===== Auth Pages (Login/Register) Modern Polish ===== */
.auth-page .card { border-radius: var(--radius-2xl); box-shadow: var(--shadow-xl); }
.auth-page .input-group-text { background: #f8fafc; }
/* LTR input-group corners in auth */
html[dir="ltr"] .auth-page .input-group > .input-group-text { border-right: none; }
html[dir="ltr"] .auth-page .input-group > .form-control { border-left: none; border-radius: 0 var(--radius-md) var(--radius-md) 0; }
html[dir="ltr"] .auth-page .input-group > .input-group-text:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
/* RTL input-group corners in auth */
html[dir="rtl"] .auth-page .input-group > .input-group-text { border-left: none; }
html[dir="rtl"] .auth-page .input-group > .form-control { border-right: none; border-radius: var(--radius-md) 0 0 var(--radius-md); }
html[dir="rtl"] .auth-page .input-group > .input-group-text:first-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.auth-page .nav-pills .nav-link { font-weight: 700; border: 2px solid var(--gray-200); }
.auth-page .nav-pills .nav-link.active { background: var(--primary-gradient); border-color: transparent; box-shadow: var(--shadow-md); }
.auth-page .btn-lg { padding-top: .9rem; padding-bottom: .9rem; font-weight: 700; }
.auth-page .form-label { font-weight: 600; color: var(--gray-800); }

/* Auth pages responsive tweaks (mobile-first overrides) */
@media (max-width: 768px) {
    .auth-page .card-body { padding: var(--space-5) !important; }
    .auth-page h2.fw-bold { font-size: 1.4rem; }
    .auth-page .nav-pills .nav-link { padding: .55rem .9rem; font-size: .95rem; border-width: 1.5px; }
    .auth-page .input-group-lg .form-control,
    .auth-page .input-group-lg .input-group-text,
    .auth-page .input-group-lg .btn { padding: .6rem .8rem; font-size: 1rem; }
    .auth-page .btn-lg { padding: .7rem 1rem; font-size: 1rem; }
    .auth-page .form-label { font-size: .95rem; }
    .auth-page .form-text { font-size: .8rem; }
    .auth-page img[alt="logo"] { height: 48px !important; }
    .auth-page .mb-4 { margin-bottom: 1rem !important; }
    .auth-page .mb-3 { margin-bottom: .85rem !important; }
}

@media (max-width: 480px) {
    .auth-page .card-body { padding: var(--space-4) !important; }
    .auth-page h2.fw-bold { font-size: 1.25rem; }
    .auth-page .text-muted { font-size: .9rem; }
    .auth-page #authTabs { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; gap: .5rem !important; }
    .auth-page #authTabs .nav-item { flex: 0 0 auto; }
    .auth-page .nav-pills .nav-link { font-size: .9rem; padding: .5rem .75rem; border-radius: var(--radius-md); }
    .auth-page .input-group-lg .form-control,
    .auth-page .input-group-lg .input-group-text,
    .auth-page .input-group-lg .btn { padding: .55rem .7rem; font-size: .95rem; }
    .auth-page .btn-lg { padding: .65rem .9rem; font-size: .95rem; }
    .auth-page img[alt="logo"] { height: 42px !important; }
}

.toast {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transform: translateX(100%);
    transition: var(--transition-normal);
    max-width: 300px;
    border-left: 4px solid var(--info);
}

.toast.show {
    transform: translateX(0);
}

.toast--success {
    border-left-color: var(--success);
}

.toast--error {
    border-left-color: var(--error);
}

.toast--warning {
    border-left-color: var(--warning);
}

.toast__icon {
    font-size: var(--text-lg);
    color: var(--info);
}

.toast--success .toast__icon {
    color: var(--success);
}

.toast--error .toast__icon {
    color: var(--error);
}

.toast--warning .toast__icon {
    color: var(--warning);
}

.toast__message {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--gray-700);
    font-family: var(--font-secondary);
}

/* Login redirect toast with progress bar */
.toast--login {
    border-left-color: var(--warning);
    min-width: 320px;
    max-width: 380px;
}
.toast__progress {
    width: 100%;
    height: 6px;
    background: rgba(0,0,0,0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}
.toast__progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    transition: width 100ms linear;
}

.toast__close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.toast__close:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

/* ===== مجموعات الفئات (عرض جميع المنتجات) ===== */
.category-group {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
    overflow: hidden;
}

.category-group__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
    border-bottom: 1px solid var(--gray-200);
}

.category-group__title {
    margin: 0;
    font-size: var(--text-xl);
}

.category-group__toggle {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition-normal);
}

.category-group__toggle:hover {
    background: var(--gray-200);
}

.category-group__toggle.rotated i {
    transform: rotate(180deg);
    transition: var(--transition-normal);
}

.category-group__content {
    display: none;
    padding: 0 var(--space-5) var(--space-5);
}

.category-group__content.expanded {
    display: block;
}

.category-group__products {
    margin-top: var(--space-4);
}

/* ===== Checkout Page Styles ===== */
.checkout-page {
    padding: var(--space-6) 0;
    background-color: var(--gray-50);
    min-height: calc(100vh - 120px);
}

.checkout-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.checkout-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: var(--space-4);
    gap: var(--space-3);
    flex-wrap: wrap;
}

.checkout-steps .step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.06); /* رمادي خفيف مرئي فوق الخلفية البيضاء */
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    transition: var(--transition-normal);
}

.checkout-steps .step.active {
    background: var(--primary-gradient);
    color: var(--white);
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.checkout-steps .step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--white);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 800;
}

.checkout-steps .step.active .step-number {
    background: rgba(255,255,255,0.95);
    color: var(--primary-dark);
}

.checkout-form {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
}

/* Modern option cards for order type */
.checkout-page .options { gap: var(--space-3); }
.checkout-page .option-card {
    position: relative;
    cursor: pointer;
    user-select: none;
    margin: 0;
}
.checkout-page .option-card input[type="radio"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.checkout-page .option-card .option-body {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(180deg, #fff, #fcfcff);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    font-weight: 700;
    color: var(--gray-800);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}
.checkout-page .option-card .option-body i { color: var(--primary-color); font-size: 1.1rem; }
.checkout-page .option-card:hover .option-body { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.checkout-page .option-card input[type="radio"]:checked + .option-body {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), .06);
    box-shadow: 0 8px 24px rgba(102,126,234,.12);
}

/* Section titles with subtle icon chip */
.checkout-page .section-title i {
    background: rgba(var(--primary-rgb), .1);
    color: var(--primary-color);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
}

/* Form controls polish in checkout */
.checkout-page .form-label { font-weight: 700; color: var(--gray-800); }
.checkout-page .form-control,
.checkout-page .form-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding-top: .6rem;
    padding-bottom: .6rem;
}
.checkout-page .form-control:focus,
.checkout-page .form-select:focus { box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .12); border-color: var(--primary-color); }
.checkout-page .input-group > .form-control { border-left: none; }
html[dir="rtl"] .checkout-page .input-group > .form-control { border-right: none; border-left: 2px solid var(--gray-200); }
.checkout-page .input-group-text { background: #f8fafc; font-weight: 700; border: 2px solid var(--gray-200); }
html[dir="ltr"] .checkout-page .input-group > .input-group-text:first-child { border-right: none; border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
html[dir="rtl"] .checkout-page .input-group > .input-group-text:last-child { border-left: none; border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }

/* Branch meta panel */
.checkout-page .branch-meta {
    margin-top: .5rem;
    background: #f9fafb;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: .6rem .75rem;
    display: flex;
    gap: .75rem 1rem;
    flex-wrap: wrap;
}
.checkout-page .branch-meta .meta-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .6rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    font-size: var(--text-sm);
    color: var(--gray-700);
}
.checkout-page .branch-meta .meta-chip i { color: var(--primary-color); }

/* Actions */
.checkout-page .form-actions .btn { border-width: 2px; font-weight: 800; }
.checkout-page .form-actions .btn-primary { background: var(--primary-gradient); border-color: transparent; box-shadow: var(--shadow-md); }
.checkout-page .form-actions .btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }

.form-section {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--gray-200);
}

/* Mobile layout: show 3 order-type options per row */
@media (max-width: 576px) {
    .checkout-page .options {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-2);
    }
    .checkout-page .option-card { width: 100%; }
    .checkout-page .option-card .option-body {
        padding: var(--space-3) var(--space-2);
        justify-content: center;
        font-size: var(--text-sm);
        text-align: center;
    }
    .checkout-page .option-card .option-body i { font-size: 1rem; }
}

@media (max-width: 360px) {
    .checkout-page .option-card .option-body { font-size: .9rem; padding: var(--space-2) var(--space-2); }
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-4);
}

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.payment-option {
    position: relative;
}

.payment-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.payment-label {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-normal);
    background: var(--white);
}

.payment-option input[type="radio"]:checked + .payment-label {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

.payment-label i {
    font-size: var(--text-xl);
    color: var(--primary);
}

.payment-info {
    display: flex;
    flex-direction: column;
}

.payment-title {
    font-weight: 600;
    color: var(--gray-900);
}

.payment-desc {
    font-size: var(--text-sm);
    color: var(--gray-600);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-8);
}

/* ===== Reviews Page Styles ===== */
.reviews-page {
    padding: var(--space-6) 0;
    background-color: var(--gray-50);
    min-height: calc(100vh - 120px);
}

.reviews-stats {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
}

.stats-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-6);
    text-align: center;
}

.overall-rating {
    text-align: center;
    margin-bottom: var(--space-6);
}

.rating-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-2);
}

.rating-stars {
    margin-bottom: var(--space-2);
}

.rating-stars .fa-star {
    color: var(--gray-300);
    font-size: var(--text-lg);
    margin: 0 2px;
}

.rating-stars .fa-star.active {
    color: var(--warning);
}

.rating-count {
    color: var(--gray-600);
    font-size: var(--text-sm);
}

.rating-breakdown {
    margin-top: var(--space-6);
}

.rating-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.star-label {
    min-width: 60px;
    font-size: var(--text-sm);
    color: var(--gray-600);
}

.rating-bar {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.rating-fill {
    height: 100%;
    background: var(--warning);
    transition: width 0.3s ease;
}

.add-review-form {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
}

.form-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-6);
    text-align: center;
}

.rating-input {
    display: flex;
    gap: var(--space-2);
}

.rating-input input[type="radio"] {
    display: none;
}

.rating-input .star-label {
    cursor: pointer;
    color: var(--gray-300);
    font-size: var(--text-xl);
    transition: color 0.2s ease;
}

.rating-input input[type="radio"]:checked ~ .star-label,
.rating-input .star-label:hover,
.rating-input .star-label:hover ~ .star-label {
    color: var(--warning);
}

.reviews-filters {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
}

.reviews-results {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
}

.results-header {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-200);
}

.results-count {
    font-weight: 600;
    color: var(--gray-700);
}

.no-reviews {
    text-align: center;
    padding: var(--space-8);
    color: var(--gray-500);
}

.no-reviews i {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    color: var(--gray-300);
}

.review-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-4);
    transition: var(--transition-normal);
}

.review-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.reviewer-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.reviewer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-lg);
}

.reviewer-name {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: 2px;
}

.review-date {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.review-rating .fa-star {
    color: var(--gray-300);
    font-size: var(--text-sm);
}

.review-rating .fa-star.active {
    color: var(--warning);
}

.review-product {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
}

.product-thumb {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-lg);
    object-fit: cover;
}

.product-name {
    font-size: var(--text-sm);
    color: var(--gray-600);
    font-weight: 500;
}

.review-content p {
    margin: 0;
    line-height: 1.6;
    color: var(--gray-700);
}

/* ===== Track Order Page Styles ===== */
.track-order-page {
    padding: var(--space-6) 0;
    background-color: var(--gray-50);
    min-height: calc(100vh - 120px);
}

.search-form-container {
    max-width: 600px;
    margin: 0 auto;
}

.search-form {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
}

.tracking-info {
    margin-top: var(--space-8);
}

.info-card {
    text-align: center;
    padding: var(--space-6);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    height: 100%;
}

.info-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: var(--space-4);
}

.info-card h4 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-3);
}

.info-card p {
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin: 0;
}

.order-details {
    max-width: 1000px;
    margin: 0 auto;
}

.order-info-card {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
}

.order-number {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-3);
}

.order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    color: var(--gray-600);
}

.order-meta span {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.order-total {
    text-align: center;
}

.total-label {
    display: block;
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin-bottom: var(--space-2);
}

.total-amount {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.payment-status {
    margin-top: var(--space-3);
}

.delivery-progress {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
}

.progress-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    position: relative;
}

.timeline-step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    position: relative;
}

.step-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    transition: var(--transition-normal);
}

.timeline-step.completed .step-icon {
    background: var(--success);
    color: var(--white);
}

.timeline-step.current .step-icon {
    background: var(--primary);
    color: var(--white);
    animation: pulse 2s infinite;
}

.timeline-step.cancelled .step-icon {
    background: var(--error);
    color: var(--white);
}

.step-content {
    flex: 1;
    padding-top: var(--space-2);
}

.step-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.step-desc {
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin: 0;
}

.step-line {
    position: absolute;
    top: 50px;
    left: 24px;
    width: 2px;
    height: calc(100% + var(--space-6));
    background: var(--gray-200);
    z-index: 1;
}

.step-line.completed {
    background: var(--success);
}

.delivery-details .detail-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    height: 100%;
}

.card-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-4);
}

.address-info, .contact-info {
    color: var(--gray-700);
}

.address-text {
    font-weight: 500;
    margin-bottom: var(--space-2);
}

.area-info {
    margin: 0;
}

.order-items {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
}

.items-list {
    margin-bottom: var(--space-6);
}

.order-summary {
    border-top: 2px solid var(--gray-100);
    padding-top: var(--space-6);
}

/* Totals styling in checkout sidebar */
.order-summary .order-totals {
    background: #fafbff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
}

.order-summary .order-totals .total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    color: var(--gray-700);
    font-size: var(--text-sm);
}

.order-summary .order-totals .total-row.total-final {
    margin-top: var(--space-2);
    background: var(--primary-gradient);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    font-weight: 800;
    box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
    .checkout-steps { gap: var(--space-2); }
    .order-summary .order-totals { padding: var(--space-3); }
    .order-summary .order-totals .total-row { font-size: var(--text-sm); }
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.summary-row.total {
    border-top: 1px solid var(--gray-200);
    padding-top: var(--space-3);
    margin-top: var(--space-3);
    font-weight: 600;
    font-size: var(--text-lg);
    color: var(--primary);
}

.order-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(var(--primary-rgb), 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0);
    }
}

/* ===== Responsive Design for New Pages ===== */
@media (max-width: 768px) {
    .checkout-steps {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .checkout-steps .step {
        width: 100%;
        justify-content: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .order-meta {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .progress-timeline {
        padding-left: var(--space-4);
    }
    
    .timeline-step {
        flex-direction: column;
        text-align: center;
    }
    
    .step-line {
        display: none;
    }
    
    .order-actions {
        flex-direction: column;
    }
    
    .order-actions .btn {
        width: 100%;
    }
}

/* ===== Cart Page Styles ===== */
.cart-page {
    padding: var(--space-6) 0 120px; /* مساحة إضافية للأزرار الثابتة */
    background-color: var(--gray-50);
    min-height: calc(100vh - 120px);
}

.empty-cart {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.empty-cart-content {
    text-align: center;
    max-width: 400px;
}

.empty-cart-content i {
    font-size: 5rem;
    color: var(--gray-300);
    margin-bottom: var(--space-4);
}

.empty-cart-content h3 {
    font-size: var(--text-xl);
    color: var(--gray-700);
    margin-bottom: var(--space-3);
}

.empty-cart-content p {
    color: var(--gray-500);
    margin-bottom: var(--space-6);
}

.cart-items {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-200);
}

.cart-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.cart-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    transition: var(--transition-normal);
}

.cart-item:hover {
    box-shadow: var(--shadow-md);
}

.cart-item:last-child {
    margin-bottom: 0;
}

.cart-item .item-image {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
}

.cart-item .item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item .item-details {
    flex: 1;
    min-width: 0;
}

.cart-item .item-name {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.cart-item .item-name a {
    color: var(--gray-900);
    text-decoration: none;
    transition: var(--transition-fast);
}

.cart-item .item-name a:hover {
    color: var(--primary);
}

.cart-item .item-description {
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin-bottom: var(--space-3);
    line-height: 1.4;
}

.cart-item .item-options,
.cart-item .item-notes {
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

.cart-item .option-group {
    margin-bottom: var(--space-1);
}

.cart-item .option-type {
    font-weight: 600;
    color: var(--gray-700);
}

.cart-item .option-values {
    color: var(--gray-600);
}

/* legacy addons UI removed */

.cart-item .item-price {
    margin-top: var(--space-2);
}

.cart-item .unit-price {
    font-weight: 600;
    color: var(--primary);
}

.cart-item .original-price {
    font-size: var(--text-sm);
    color: var(--gray-500);
    text-decoration: line-through;
    margin-right: var(--space-2);
}

.cart-item .item-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    min-width: 120px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    padding: var(--space-1);
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--white);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--gray-700);
}

.quantity-btn:hover {
    background: var(--primary);
    color: var(--white);
}

.quantity {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    font-size: var(--text-base);
}

.cart-item .item-total {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--error);
    font-size: var(--text-lg);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.btn-remove:hover {
    background: var(--error);
    color: var(--white);
}

.sticky-summary {
    position: sticky;
    top: 100px;
}

.coupon-section {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-200);
}

.applied-coupon {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--success-light);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    border: 1px solid var(--success);
}

.coupon-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.coupon-code {
    font-weight: 600;
    color: var(--success);
}

.coupon-discount {
    background: var(--success);
    color: var(--white);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 600;
}

.btn-remove-coupon {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.btn-remove-coupon:hover {
    background: var(--error);
    color: var(--white);
}

.coupon-form .input-group {
    display: flex;
    gap: var(--space-2);
}

.coupon-form .form-control {
    flex: 1;
}

.discount-row {
    color: var(--success) !important;
}

.discount-amount {
    color: var(--success) !important;
    font-weight: 600;
}

.delivery-info {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--gray-200);
}

.info-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    color: var(--gray-600);
}

.info-item i {
    color: var(--primary);
    width: 16px;
}

/* ===== Fixed Bottom Cart Button ===== */
.fixed-cart-button {
    position: fixed;
    bottom: 80px; /* فوق شريط الفئات */
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    padding: var(--space-4);
    box-shadow: var(--shadow-xl);
    z-index: 999;
    border: none;
    width: 100%;
    font-size: var(--text-lg);
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-normal);
}

.fixed-cart-button:hover {
    transform: translateY(-2px);
    color: var(--white);
    text-decoration: none;
}

.fixed-cart-button.hidden {
    transform: translateY(100%);
}

.cart-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.cart-count {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-sm);
}

.cart-total {
    font-weight: 700;
    font-size: var(--text-lg);
}

/* ===== Fixed Bottom Categories Bar ===== */
.fixed-categories-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: var(--space-3) 0;
}

.categories-scroll {
    display: flex;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.category-btn {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4);
    font-size: var(--categories-bar-font-size, var(--text-sm));
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition-fast);
    min-width: fit-content;
}

.category-btn:hover,
.category-btn.active {
    background: var(--primary-gradient);
    color: var(--white);
    border-color: var(--primary-color);
    text-decoration: none;
}

/* ===== اتجاهات الواجهة حسب اللغة ===== */
body.ar .sidebar {
    right: -320px;
    left: auto;
}

body.ar .sidebar.show {
    right: 0;
    left: auto;
}

body.en .sidebar {
    left: -320px;
    right: auto;
}

body.en .sidebar.show {
    left: 0;
    right: auto;
}

body.ar .header__actions {
    flex-direction: row-reverse;
}

body.en .header__actions {
    flex-direction: row;
}

/* ===== Responsive Design for Cart ===== */
@media (max-width: 768px) {
    .cart-page {
        padding-bottom: 160px; /* مساحة إضافية للموبايل */
    }
    
    .cart-item {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .cart-item .item-image {
        width: 80px;
        height: 80px;
        align-self: flex-start;
    }
    
    .cart-item .item-actions {
        flex-direction: row;
        justify-content: space-between;
        min-width: auto;
    }
    
    .sticky-summary {
        position: static;
    }
    
    .fixed-cart-button {
        bottom: 60px;
        padding: var(--space-3);
        font-size: var(--text-base);
    }
    
    .fixed-categories-bar {
        padding: var(--space-2) 0;
    }
    
    .categories-scroll {
        padding: 0 var(--space-3);
        gap: var(--space-1);
    }
    
    .category-btn {
        padding: var(--space-1) var(--space-3);
    font-size: var(--categories-bar-font-size, var(--text-xs));
    }
}

/* ===== Checkout – Order Summary Item Fix ===== */
/* Prevent oversized images and tidy layout inside checkout sidebar summary */
.checkout-page .order-summary .order-items { padding: var(--space-4); }
.checkout-page .order-summary .order-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--gray-100);
}
.checkout-page .order-summary .order-item:last-child { border-bottom: none; }
.checkout-page .order-summary .item-image {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--gray-100);
    flex-shrink: 0;
}
.checkout-page .order-summary .item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.checkout-page .order-summary .item-details { flex: 1; min-width: 0; }
.checkout-page .order-summary .item-name { margin: 0 0 4px; font-size: var(--text-base); font-weight: 600; }
.checkout-page .order-summary .item-quantity { color: var(--gray-600); font-size: var(--text-sm); }
.checkout-page .order-summary .item-options { color: var(--gray-600); font-size: var(--text-xs); }
.checkout-page .order-summary .item-price {
    margin-inline-start: auto;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
}


@media (max-width: 480px) {
    .checkout-page .order-summary .item-image { width: 60px; height: 60px; }
    .checkout-page .order-summary .item-name { font-size: var(--text-sm); }
}


@media (max-width: 320px) {
    .checkout-page .order-summary .item-image { width: 48px; height: 48px; }
    .checkout-page .order-summary .item-name { font-size: var(--text-xs); }
}
