:root {
    --adminuiux-content-font: "Open Sans", serif;
    --adminuiux-content-font-weight: 400;
    --adminuiux-title-font: "Sarala", sans-serif;
    --adminuiux-title-font-weight: 700;
}

/* Fix: RTL offcanvas-end stays off-screen because theme CSS
   [dir=rtl] .offcanvas.offcanvas-end { transform: translateX(-100%) }
   has the same specificity as .offcanvas.show:not(.hiding) { transform: none }
   and comes later in the cascade. This higher-specificity rule wins. */
[dir="rtl"] .offcanvas.offcanvas-end.show:not(.hiding),
[dir="rtl"] .offcanvas.offcanvas-end.showing { transform: none !important; }

/* Fix: theme defines Bootstrap 5.3 logical utilities with physical properties.
   Override them for RTL so borders and rounded corners flip correctly. */
html[dir="rtl"] .border-start-0 { border-left: 1px solid var(--bs-border-color) !important; border-right: 0 !important; }
html[dir="rtl"] .border-end-0 { border-right: 1px solid var(--bs-border-color) !important; border-left: 0 !important; }
html[dir="rtl"] .rounded-start-pill { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; border-top-right-radius: var(--bs-border-radius-pill) !important; border-bottom-right-radius: var(--bs-border-radius-pill) !important; }
html[dir="rtl"] .rounded-end-pill { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; border-top-left-radius: var(--bs-border-radius-pill) !important; border-bottom-left-radius: var(--bs-border-radius-pill) !important; }

/* Fix: theme defines me-* as margin-right and ms-* as margin-left (physical).
   Flip them for RTL. */
html[dir="rtl"] .me-0 { margin-right: 0 !important; margin-left: 0 !important; }
html[dir="rtl"] .me-1 { margin-right: 0 !important; margin-left: .25rem !important; }
html[dir="rtl"] .me-2 { margin-right: 0 !important; margin-left: .5rem !important; }
html[dir="rtl"] .me-3 { margin-right: 0 !important; margin-left: 1rem !important; }
html[dir="rtl"] .me-4 { margin-right: 0 !important; margin-left: 1.5rem !important; }
html[dir="rtl"] .me-5 { margin-right: 0 !important; margin-left: 3rem !important; }
html[dir="rtl"] .ms-0 { margin-left: 0 !important; margin-right: 0 !important; }
html[dir="rtl"] .ms-1 { margin-left: 0 !important; margin-right: .25rem !important; }
html[dir="rtl"] .ms-2 { margin-left: 0 !important; margin-right: .5rem !important; }
html[dir="rtl"] .ms-3 { margin-left: 0 !important; margin-right: 1rem !important; }
html[dir="rtl"] .ms-4 { margin-left: 0 !important; margin-right: 1.5rem !important; }
html[dir="rtl"] .ms-5 { margin-left: 0 !important; margin-right: 3rem !important; }
/* Also flip pe-* and ps-* (padding-end / padding-start) */
html[dir="rtl"] .pe-0 { padding-right: 0 !important; padding-left: 0 !important; }
html[dir="rtl"] .pe-1 { padding-right: 0 !important; padding-left: .25rem !important; }
html[dir="rtl"] .pe-2 { padding-right: 0 !important; padding-left: .5rem !important; }
html[dir="rtl"] .pe-3 { padding-right: 0 !important; padding-left: 1rem !important; }
html[dir="rtl"] .pe-4 { padding-right: 0 !important; padding-left: 1.5rem !important; }
html[dir="rtl"] .pe-5 { padding-right: 0 !important; padding-left: 3rem !important; }
html[dir="rtl"] .ps-0 { padding-left: 0 !important; padding-right: 0 !important; }
html[dir="rtl"] .ps-1 { padding-left: 0 !important; padding-right: .25rem !important; }
html[dir="rtl"] .ps-2 { padding-left: 0 !important; padding-right: .5rem !important; }
html[dir="rtl"] .ps-3 { padding-left: 0 !important; padding-right: 1rem !important; }
html[dir="rtl"] .ps-4 { padding-left: 0 !important; padding-right: 1.5rem !important; }
html[dir="rtl"] .ps-5 { padding-left: 0 !important; padding-right: 3rem !important; }

/* RTL Form Floating Fix */
html[dir="rtl"] .form-floating > label {
    left: auto !important;
    right: 0 !important;
    transform-origin: 100% 0 !important;
}
html[dir="rtl"] .form-floating > .form-control,
html[dir="rtl"] .form-floating > .form-select {
    text-align: right;
}

/* Pageloader fix to prevent CLS */
.pageloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 9999;
}
/* --- الكارت بدون حواف والمتوافق مع الـ Theme --- */
.product-card-modern {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
}

/* --- الصورة بأبعاد الريلز --- */
.media-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    border-radius: 20px;
    overflow: hidden;
    background-color: var(--bs-secondary-bg); /* يتغير مع الدارك مود */
    margin-bottom: 12px;
    transform: translateZ(0);
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.media-wrapper:hover .product-img {
    transform: scale(1.05);
}

/* --- المقاسات والمربعات --- */
.variants-container {
    min-height: 38px;
    display: flex;
    align-items: center;
}

.box-options { display: flex; gap: 6px; flex-wrap: wrap; }

.opt-box {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 10px;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* عند التحديد هياخد فئة التمبلت الديناميكية عبر الجافاسكريبت */
.opt-box:hover:not(.disabled) { border-color: var(--bs-primary); }
.opt-box.disabled { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }

/* --- الدروب داون المتوافق مع التمبلت --- */
.modern-select-wrapper { position: relative; width: 100%; }
.modern-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 38px;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    padding: 0 14px 0 35px;
    color: var(--bs-body-color);
    font-size: 13px;
    font-weight: 700;
    outline: none;
    cursor: pointer;
}
.modern-select-wrapper::after {
    content: '\F282'; /* أيقونة السهم من Bootstrap Icons */
    font-family: 'bootstrap-icons';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--bs-body-color);
}

/* --- كبسولة الإضافة الذكية --- */
.smart-capsule {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 100px;
    padding: 4px;
    height: 52px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.smart-capsule:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.qty-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 0 6px;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.qty-val {
    font-size: 14px;
    font-weight: 800;
    color: var(--bs-body-color);
    width: 16px;
    text-align: center;
}

/* زر الشراء مدمج ليعتمد على كلاس btn-theme الخاص بالتمبلت */
.btn-capsule-add {
    height: 100%;
    border-radius: 100px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 700;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ---------- glp-card (unified mall card) ---------- */
.glp-card {
    flex: 0 0 auto;
    width: 170px;
    scroll-snap-align: start;
    border-radius: 16px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}
.glp-card:active { transform: scale(0.97); }

#filtered-products-grid .glp-card {
    width: 100%;
    flex: 1 1 auto;
    scroll-snap-align: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}
#filtered-products-grid .glp-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}
#filtered-products-grid .glp-card-footer {
    margin-top: auto;
    padding-right: 42px;
}

.glp-favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--bs-heading-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.glp-favorite-btn:hover {
    transform: scale(1.15);
    background: #fff;
    color: #dc3545;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}

.glp-cart-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--store-primary, var(--adminuiux-theme-1, #FF6B35));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.glp-cart-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}
.glp-cart-btn i { font-size: 0.9rem; }

.glp-cart-btn-absolute {
    position: absolute;
    bottom: 14px;
    right: 10px;
    z-index: 3;
}

.glp-store-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    right: auto;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.8);
    border-radius: 10px;
    padding: 5px 8px;
    max-width: 70%;
}
.glp-store-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: contain;
    background: #fff;
    flex-shrink: 0;
}
.glp-store-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    direction: rtl;
}

.glp-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--bs-secondary-bg);
    flex: 0 0 auto;
}
.glp-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.glp-card-body { padding: 10px 10px 12px; }
.glp-card-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-body-color);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}
.glp-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.glp-card-price {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--store-primary, var(--adminuiux-theme-1, #FF6B35));
    direction: ltr;
    flex: 1;
}

/* --- Header Search --- */
.header-icons-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
}

.header-search-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.header-search-toggle {
    flex-shrink: 0;
}

.header-search-form {
    overflow: hidden;
    width: 0;
    opacity: 0;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    display: flex;
    align-items: center;
    margin: 0;
}

.header-search-wrapper.active .header-search-form {
    width: 220px;
    opacity: 1;
    margin-inline-end: 4px;
}

.header-search-input {
    border-radius: 50rem;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    padding: 0.4rem 1rem;
    height: 38px;
    font-size: 0.875rem;
    color: var(--bs-body-color);
    min-width: 0;
    width: 100%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search-input:focus {
    border-color: var(--adminuiux-theme-1, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 4px 16px rgba(0, 0, 0, 0.1);
    outline: none;
    background: var(--bs-body-bg);
}

.header-search-input::placeholder {
    color: var(--bs-secondary-color);
    opacity: 0.6;
}

/* --- Header Search Dropdown (Live Suggestions) --- */
.header-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 24px);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 1050;
    overflow: hidden;
    display: none;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-height: 420px;
    overflow-y: auto;
}

.header-search-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Scrollbar styling */
.header-search-dropdown::-webkit-scrollbar { width: 6px; }
.header-search-dropdown::-webkit-scrollbar-track { background: transparent; }
.header-search-dropdown::-webkit-scrollbar-thumb {
    background: var(--bs-secondary-color);
    border-radius: 3px;
    opacity: 0.3;
}

.header-search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--bs-body-color);
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.05));
    transition: background 0.12s ease, transform 0.12s ease;
    cursor: pointer;
}

.header-search-suggestion-item:hover,
.header-search-suggestion-item.active {
    background: var(--bs-tertiary-bg, #f8f9fa);
    transform: translateX(-2px);
}

.header-search-suggestion-item:last-of-type {
    border-bottom: none;
}

.header-search-thumb {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bs-tertiary-bg, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-search-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.header-search-suggestion-item:hover .header-search-thumb img {
    transform: scale(1.08);
}

.header-search-no-img {
    color: var(--bs-secondary-color);
    font-size: 1.2rem;
    opacity: 0.4;
}

.header-search-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.header-search-name {
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    color: var(--bs-body-color);
}

.header-search-store {
    font-size: 0.68rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 3px;
}

.header-search-store::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--bs-secondary-color);
    opacity: 0.5;
    flex-shrink: 0;
}

.header-search-price {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--adminuiux-theme-1, #3b82f6);
    white-space: nowrap;
    flex-shrink: 0;
    direction: ltr; /* prices always read left-to-right */
}

.header-search-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 16px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--adminuiux-theme-1, #3b82f6);
    background: var(--bs-tertiary-bg, #f8f9fa);
    transition: background 0.15s ease;
    border-top: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.05));
}

.header-search-view-all:hover {
    background: var(--bs-secondary-bg, #e9ecef);
}

.header-search-view-all i {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

[dir="rtl"] .header-search-view-all i {
    transform: scaleX(-1);
}

.header-search-view-all:hover i {
    transform: translateX(3px);
}

[dir="rtl"] .header-search-view-all:hover i {
    transform: scaleX(-1) translateX(3px);
}

.header-search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 16px;
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
}

.header-search-no-results i {
    font-size: 2rem;
    opacity: 0.3;
}

/* --- Responsive --- */
@media (max-width: 991px) {
    .header-search-wrapper.active .header-search-form {
        width: 180px;
    }
    .header-search-dropdown {
        width: 340px;
    }
}

@media (max-width: 767px) {
    .header-search-wrapper.active .header-search-form {
        width: 140px;
    }
    .header-search-input {
        height: 36px;
        font-size: 0.8rem;
        padding: 0.35rem 0.85rem;
    }
    .header-search-dropdown {
        width: 300px;
        max-width: calc(100vw - 16px);
        border-radius: 14px;
        max-height: 360px;
    }
    .header-search-thumb {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    .header-search-name {
        font-size: 0.78rem;
    }
    .header-search-price {
        font-size: 0.76rem;
    }
    .header-search-suggestion-item {
        padding: 8px 12px;
        gap: 10px;
    }
}

@media (max-width: 400px) {
    .header-search-wrapper.active .header-search-form {
        width: 110px;
    }
    .header-search-dropdown {
        width: 280px;
        max-width: calc(100vw - 12px);
    }
    .header-search-store {
        display: none;
    }
}

/* --- Hero Search Overlay & Bar --- */
.hero-search-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: transparent;
    z-index: 1038;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.hero-search-bar {
    position: fixed;
    top: var(--header-height, 64px); left: 0; right: 0;
    background: var(--bs-body-bg, #fff);
    border-bottom: 1px solid var(--bs-border-color, rgba(0,0,0,0.08));
    padding: 10px 16px;
    z-index: 1050;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.hero-search-bar.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.hero-search-inner {
    max-width: 100%;
    margin: 0;
    position: relative;
}

@media (min-width: 992px) {
    .hero-search-inner {
        max-width: 600px;
        margin: 0 auto;
    }
    body.adminuiux-sidebar-standard .hero-search-bar {
        left: var(--adminuiux-sidebar-width, 280px) !important;
        right: 0 !important;
        width: auto !important;
    }
    body.adminuiux-sidebar-standard.sidebar-close .hero-search-bar {
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
    }
    /* RTL: sidebar is on the right, so offset from right */
    html[dir="rtl"] body.adminuiux-sidebar-standard .hero-search-bar {
        left: 0 !important;
        right: var(--adminuiux-sidebar-width, 280px) !important;
    }
    html[dir="rtl"] body.adminuiux-sidebar-standard.sidebar-close .hero-search-bar {
        left: 0 !important;
        right: 0 !important;
    }
}

.hero-search-inner > .d-flex {
    display: none !important;
}

.hero-search-card {
    position: relative;
}

.hero-search-form {
    display: flex;
    align-items: center;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 50rem;
    padding: 2px 3px 2px 0;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hero-search-form:focus-within {
    border-color: var(--adminuiux-theme-1, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.hero-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px 0 16px;
    color: var(--adminuiux-theme-1, #3b82f6);
    flex-shrink: 0;
}

.hero-search-icon i { font-size: 1.1rem; }

.hero-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--bs-body-color, #333);
    padding: 8px 16px 8px 6px;
    height: auto;
    text-align: start; /* follows page direction */
    direction: inherit;  /* inherits from page (rtl or ltr) */
}

.hero-search-input::placeholder {
    color: var(--bs-secondary-color, #999);
    opacity: 0.65;
}

.hero-search-btn {
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
    background: var(--adminuiux-theme-1, #3b82f6);
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.hero-search-btn i { font-size: 0.95rem; }

.hero-search-btn:hover {
    opacity: 0.92;
    transform: scale(1.05);
}
.hero-search-btn:active { transform: scale(0.95); }

/* Hero search dropdown */
.hero-search-dropdown {
    position: absolute;
    top: calc(100% + 16px);
    inset-inline: 0;
    width: 100%;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 20px;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1050;
    overflow: hidden;
    display: none;
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 480px;
    overflow-y: auto;
}

.hero-search-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.hero-search-dropdown::-webkit-scrollbar { width: 6px; }
.hero-search-dropdown::-webkit-scrollbar-track { background: transparent; }
.hero-search-dropdown::-webkit-scrollbar-thumb {
    background: var(--bs-secondary-color);
    border-radius: 3px;
    opacity: 0.3;
}

.hero-suggestion-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--bs-body-color);
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.05));
    transition: background 0.12s ease;
    cursor: pointer;
}

.hero-suggestion-item:hover,
.hero-suggestion-item.active {
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.hero-suggestion-item:last-of-type { border-bottom: none; }

.hero-suggestion-thumb {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bs-tertiary-bg, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-suggestion-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.hero-suggestion-item:hover .hero-suggestion-thumb img {
    transform: scale(1.08);
}

.hero-suggestion-no-img {
    color: var(--bs-secondary-color);
    font-size: 1.3rem;
    opacity: 0.35;
}

.hero-suggestion-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hero-suggestion-name {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.hero-suggestion-store {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.hero-suggestion-store::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--bs-secondary-color);
    opacity: 0.5;
    flex-shrink: 0;
}

.hero-suggestion-price {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--adminuiux-theme-1, #3b82f6);
    white-space: nowrap;
    flex-shrink: 0;
    direction: ltr; /* prices always read left-to-right */
}

.hero-suggestion-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--adminuiux-theme-1, #3b82f6);
    background: var(--bs-tertiary-bg, #f8f9fa);
    transition: background 0.15s ease;
    border-top: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.05));
}

.hero-suggestion-view-all:hover { background: var(--bs-secondary-bg, #e9ecef); }

.hero-suggestion-view-all i {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

[dir="rtl"] .hero-suggestion-view-all i { transform: scaleX(-1); }
.hero-suggestion-view-all:hover i { transform: translateX(3px); }
[dir="rtl"] .hero-suggestion-view-all:hover i { transform: scaleX(-1) translateX(3px); }

.hero-suggestion-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px 20px;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}

.hero-suggestion-no-results i { font-size: 2.2rem; opacity: 0.25; }

/* Hero Search Responsive */
@media (max-width: 767px) {
    .hero-search-bar { padding: 8px 12px; }
    .hero-search-form { padding: 2px 2px 2px 0; }
    .hero-search-icon { padding: 0 8px 0 12px; }
    .hero-search-icon i { font-size: 1rem; }
    .hero-search-input { font-size: 0.88rem; padding: 7px 5px; }
    .hero-search-btn { width: 30px; height: 30px; }
    .hero-search-btn i { font-size: 0.85rem; }
    .hero-suggestion-thumb { width: 42px; height: 42px; border-radius: 11px; }
    .hero-suggestion-name { font-size: 0.82rem; }
    .hero-suggestion-price { font-size: 0.8rem; }
    .hero-suggestion-item { padding: 9px 14px; gap: 11px; }
    .hero-search-dropdown { top: calc(100% + 10px); border-radius: 14px; max-height: 360px; }
}

@media (max-width: 400px) {
    .hero-search-btn { width: 28px; height: 28px; }
    .hero-suggestion-store { display: none; }
}

@media (min-width: 576px) {
    .glp-scroll-row .glp-card { width: 190px; }
}
@media (min-width: 992px) {
    .glp-scroll-row .glp-card { width: 210px; }
}

/* Discount Badge Overlay */
.glp-discount-badge {
    position: absolute;
    top: 15px; /* Space for the string */
    right: 15px; /* Or left based on RTL/LTR */
    z-index: 10;
    pointer-events: none;
    filter: drop-shadow(0 3px 4px rgba(0,0,0,0.3)); /* Shadow for the custom shape */
}
[dir="rtl"] .glp-discount-badge {
    right: auto;
    left: 10px;
    /* Anchor the scaled/swinging tag to the LEFT in RTL (mirror of LTR's top-right),
       otherwise the top-right transform-origin visually pushes it inward/right. */
    transform-origin: top left;
}
.glp-discount-badge-inner {
    background-color: #e51a2d; /* Red color similar to reference */
    color: white;
    padding: 18px 8px 8px; /* Extra top padding for the triangle point */
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    clip-path: polygon(50% 0%, 100% 20%, 100% 100%, 0% 100%, 0% 20%);
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}
/* The hole in the tag */
.glp-discount-badge-inner::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 7px;
    height: 7px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5); /* Inner shadow for realistic hole */
}
/* The black string */
.glp-discount-badge::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-30%) rotate(25deg);
    width: 22px;
    height: 25px;
    border: 1.5px solid #222;
    border-radius: 50% 40% 0 0;
    z-index: -1;
    border-bottom: none;
    border-left-color: transparent; /* Open string look */
}
.glp-discount-text {
    font-size: 0.55rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    text-transform: uppercase;
    line-height: 1;
}
.glp-discount-percent {
    font-size: 1.2rem;
    font-weight: 900;
    line-height: 1;
}
.glp-discount-off {
    font-size: 0.6rem;
    font-weight: bold;
    margin-top: 2px;
    line-height: 1;
}

/* Auth pages: prevent body scroll on mobile, allow card to scroll internally if too tall */
@media (max-width: 991px) {
    .sidebar-open .adminuiux-sidebar {
        z-index: 1040 !important;
    }
    .adminuiux-content.overflow-hidden .login-box {
        max-height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .adminuiux-content.overflow-hidden .login-box .card {
        max-height: calc(100dvh - 2rem);
    }
}

/* =====================================================================
   Language switcher (مبدّل اللغة) + RTL/LTR helpers
   ===================================================================== */

/* Toggle button: icon + short language code, auto width so "EN"/"AR" fit
   even when the theme renders header buttons as fixed squares. */
.lang-switcher { display: inline-flex; }
.lang-switcher .lang-switcher-toggle {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}
.adminuiux-header .lang-switcher .lang-switcher-toggle.btn-square,
.lang-switcher .lang-switcher-toggle.btn-square {
    width: auto;
    min-width: 2.25rem;
    padding-inline: .5rem;
}
.lang-switcher .lang-switcher-code {
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}
.lang-switcher .lang-switcher-menu { min-width: 12rem; }
.lang-switcher .lang-switcher-menu .dropdown-item {
    cursor: pointer;
    font: inherit;
}
/* Active language uses the store theme color instead of default blue. */
.lang-switcher .dropdown-item.active,
.lang-switcher .dropdown-item:active {
    background-color: var(--adminuiux-theme-1, #ff6600);
    color: #fff;
}

/* Sidebar language options are <button> elements styled like nav links. */
.adminuiux-sidebar .lang-switcher-form-btn,
.adminuiux-sidebar form .nav-link {
    font: inherit;
    cursor: pointer;
}

/* On narrow screens hide the language code text in the header, keep the icon. */
@media (max-width: 575.98px) {
    .adminuiux-header .lang-switcher .lang-switcher-code { display: none; }
}

/* ---- LTR (English) overrides for the RTL-first theme --------------------
   The AdminUIUX theme (app.js) sets <html dir="rtl"> for Arabic and dir=""
   (empty) for English, so LTR is targeted with :not([dir="rtl"]). Arabic (RTL)
   is never matched here, so it stays exactly as before. */
html:not([dir="rtl"]) body { text-align: left; }
html:not([dir="rtl"]) .adminuiux-mobile-footer .nav-text { direction: ltr; }

/* Product cards sit inside carousels (.productSwiper/.categoryTicker) that force
   dir="ltr" on themselves for correct swipe order. That makes logical props +
   inherited direction resolve LTR INSIDE the card even on an Arabic page, which
   pushed the card contents to the wrong side. So we drive the card's own content
   direction AND its absolutely-positioned controls from the PAGE direction
   (html[dir]) with physical left/right — fully decoupled from the swiper. */
html[dir="rtl"] .glp-card { direction: rtl; text-align: right; }
html:not([dir="rtl"]) .glp-card { direction: ltr; text-align: left; }

/* English page: store badge = left; wishlist heart + cart = right. */
html:not([dir="rtl"]) .glp-store-badge       { left: 8px !important;  right: auto !important; }
html:not([dir="rtl"]) .glp-favorite-btn      { right: 8px !important; left: auto !important; }
html:not([dir="rtl"]) .glp-cart-btn-absolute { right: 10px !important; left: auto !important; }
html:not([dir="rtl"]) .glp-card-footer       { padding-right: 44px !important; padding-left: 0 !important; }
html:not([dir="rtl"]) .glp-store-name        { direction: ltr !important; }

/* Arabic page: store badge = right; wishlist heart + cart = left. */
html[dir="rtl"] .glp-store-badge       { right: 8px !important; left: auto !important; }
html[dir="rtl"] .glp-favorite-btn      { left: 8px !important;  right: auto !important; }
html[dir="rtl"] .glp-cart-btn-absolute { left: 10px !important; right: auto !important; }
html[dir="rtl"] .glp-card-footer       { padding-left: 44px !important; padding-right: 0 !important; }


