/* —— Language dropdown: عرض حسب النص والعلم —— */
#lang-change .ctb-lang-menu.dropdown-menu {
    min-width: 0 !important;
    width: max-content;
    max-width: min(260px, calc(100vw - 1rem));
    padding: 0.25rem 0;
    margin-top: 0.2rem;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    /* ثبات ترتيب: اسم اللغة ثم العلم (بدون فراغ يمين/شمال زائد) */
    direction: ltr;
    text-align: left;
}

#lang-change .ctb-lang-menu > li {
    list-style: none;
}

#lang-change .ctb-lang-menu .dropdown-item.ctb-lang-item {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
    line-height: 1.25;
    white-space: nowrap;
}

#lang-change .ctb-lang-menu .ctb-lang-flag {
    width: 18px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
    margin: 0 !important;
    vertical-align: middle;
}

#lang-change .ctb-lang-menu .ctb-lang-name {
    flex: 0 1 auto;
}

#lang-change .ctb-lang-menu .dropdown-item.active,
#lang-change .ctb-lang-menu .dropdown-item:active {
    font-weight: 600;
}

/* —— قائمة الهيدر: أسلوب نظيف + خط سفلي متحرك (::after) —— */

/* إخفاء التسطير القديم على الـ <li> حتى لا يتكرر مع الخط الجديد على الرابط */
.hor-swipe > .list-inline-item.animate-underline-white::after {
    display: none !important;
    content: none !important;
}

/* صف المينو سطح المكتب: flex + مسافات (هيدر 1–4، 6 + هيدر 5) */
.bottom-background-color-visibility ul.hor-swipe.list-inline,
.header-menus-container ul.hor-swipe.list-inline {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: clamp(1.5rem, 2.2vw, 2rem);
    margin-bottom: 0 !important;
    padding-left: 0;
    list-style: none;
}

@media (min-width: 1200px) {
    .bottom-background-color-visibility ul.hor-swipe.list-inline,
    .header-menus-container ul.hor-swipe.list-inline {
        justify-content: flex-start;
    }
}

.bottom-background-color-visibility ul.hor-swipe > .list-inline-item,
.header-menus-container ul.hor-swipe > .list-inline-item {
    display: flex;
    margin: 0 !important;
    margin-right: 0 !important;
}

/* عنصر القائمة = الرابط */
.header_menu_links {
    opacity: 1;
    position: relative;
    display: inline-block;
    padding-bottom: 6px;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    font-size: clamp(0.875rem, 0.15vw + 0.82rem, 1rem);
    font-weight: 600 !important;
    letter-spacing: 0.5px;
    color: var(--theme-text-color, #000000) !important;
    text-decoration: none !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: color 0.2s ease;
}

/* عربي: Cairo + Tajawal — بدون تباعد أحرف اصطناعي */
html[dir="rtl"] .header_menu_links {
    font-family: 'Cairo', 'Tajawal', sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none;
}

/* لاتيني: أسلوب أقرب لـ BBW */
html:not([dir="rtl"]) .header_menu_links {
    text-transform: uppercase;
    letter-spacing: 0.5px !important;
}

.header_menu_links:hover,
.header_menu_links:focus-visible {
    color: var(--theme-text-color, #222) !important;
    opacity: 0.88;
    outline: none;
}

/* خط سفلي متحرك — بدون text-decoration */
.header_menu_links::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--theme-accent-color, #1a73e8);
    transition: width 0.3s ease;
}

html[dir="rtl"] .header_menu_links::after {
    left: auto;
    right: 0;
}

.header_menu_links:hover::after,
.header_menu_links:focus-visible::after {
    width: 100%;
}

.header_menu_links.active::after {
    width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .header_menu_links,
    .header_menu_links::after {
        transition: none !important;
    }
}

/* الموبايل / الشريط الجانبي: نفس الطباعة؛ عناصر عمودية */
.aiz-top-menu-sidebar .header_menu_links {
    width: 100%;
    padding-bottom: 8px;
    border-bottom: 1px solid transparent;
}

.aiz-top-menu-sidebar .header_menu_links::after {
    bottom: 4px;
}

/* —— شريط علوي متحرك (Easy Top Bar Builder — ctb_topbar_items) —— */
.ctb-marquee-bar {
    overflow: hidden;
    min-height: 34px;
    display: flex;
    align-items: center;
}

.ctb-topbar-ticker.ctb-topbar-marquee {
    width: 100%;
    overflow: hidden;
}

.ctb-topbar-track {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    align-items: center;
    gap: 0;
    direction: ltr;
    animation: ctb-topbar-marquee var(--ctb-marquee-duration, 22s) linear infinite;
    will-change: transform;
}

a.ctb-topbar-item,
a.ctb-topbar-item:link,
a.ctb-topbar-item:visited {
    flex: 0 0 auto;
    padding: 0.45rem 1.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: color 0.15s ease, opacity 0.15s ease;
}

a.ctb-topbar-item:hover,
a.ctb-topbar-item:focus-visible {
    color: var(--theme-accent-color, #1a73e8) !important;
    opacity: 1;
    text-decoration: none !important;
    cursor: pointer !important;
}

@keyframes ctb-topbar-marquee {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ctb-topbar-track {
        animation: none;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        row-gap: 0.25rem;
    }
}

/* —— CTB: عناوين المنتجات (بطاقات + صفحة المنتج) —— */

.aiz-main-wrapper .aiz-card-box h3.fs-13.text-truncate-2,
.aiz-main-wrapper .aiz-card-box h3.text-truncate-2 {
    margin-top: 8px !important;
    margin-bottom: 4px !important;
    height: auto !important;
    max-height: none !important;
    min-height: 2.85em;
    padding-top: 0 !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    font-size: clamp(15px, 0.2vw + 14px, 17px) !important;
    color: var(--text-color, var(--theme-text-color, #222)) !important;
}

html:not([dir="rtl"]) .aiz-main-wrapper .aiz-card-box h3.fs-13.text-truncate-2,
html:not([dir="rtl"]) .aiz-main-wrapper .aiz-card-box h3.text-truncate-2 {
    font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    letter-spacing: 0.5px !important;
}

html[dir="rtl"] .aiz-main-wrapper .aiz-card-box h3.fs-13.text-truncate-2,
html[dir="rtl"] .aiz-main-wrapper .aiz-card-box h3.text-truncate-2 {
    font-family: "Cairo", "Tajawal", sans-serif !important;
    letter-spacing: 0 !important;
}

.aiz-main-wrapper .aiz-card-box h3.text-truncate-2 > a.d-block {
    text-decoration: none !important;
    color: inherit !important;
    font: inherit !important;
    line-height: inherit !important;
    transition: color 0.2s ease;
}

.aiz-main-wrapper .aiz-card-box h3.text-truncate-2 > a.d-block:hover,
.aiz-main-wrapper .aiz-card-box h3.text-truncate-2 > a.d-block:focus-visible {
    color: var(--primary-color, var(--theme-primary-color, #d43533)) !important;
}

/* صفحة المنتج — العنوان الرئيسي */
.product-details h1.fs-20 {
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: var(--text-color, var(--theme-text-color, #222)) !important;
    font-size: clamp(1.125rem, 1.15vw + 0.9rem, 1.5rem) !important;
}

html:not([dir="rtl"]) .product-details h1.fs-20 {
    font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    letter-spacing: 0.5px !important;
}

html[dir="rtl"] .product-details h1.fs-20 {
    font-family: "Cairo", "Tajawal", sans-serif !important;
    letter-spacing: 0 !important;
}

/* —— بطاقة المنتج: زر السلة ظاهر دائماً (موبايل + بدون الاعتماد على hover) —— */
.frontend-store .aiz-card-box .cart-btn {
    transform: translateY(0) !important;
}
.aiz-card-box .cart-btn.absolute-bottom-left {
    background:rgba(0, 0, 0, 0.30) !important;
    background-color: rgba(0, 0, 0, 0.30) !important;
    background-image: none !important;
}
.frontend-store .aiz-card-box .cart-btn .cart-btn-text {
    margin-top: -40px !important;
}
.frontend-store .aiz-card-box a.cart-btn.d-none.d-sm-flex {
    display: flex !important;
}

/* —— بطاقة المنتج: hover لا يزال يعمل للأيقونات —— */
.aiz-card-box:hover .cart-btn {
    transform: translateY(0) !important;
}

.aiz-card-box:hover .aiz-p-hov-icon a {
    transform: translateX(0) !important;
}

html[dir="rtl"] .aiz-p-hov-icon a {
    transform: translateX(calc(-100% - 15px)) !important;
}

html[dir="rtl"] .aiz-card-box:hover .aiz-p-hov-icon a {
    transform: translateX(0) !important;
}

@media (max-width: 575.98px) {
    .aiz-card-box:hover .aiz-p-hov-icon-mobile a {
        transform: translateY(0) !important;
    }
}

/* —— Dynamic stack popup: شريط العد التنازلي (يُتحكم به بـ startTimer) —— */
.modal.website-popup .mirror-card {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.modal.website-popup .loader-container {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
    z-index: 2;
}

.modal.website-popup .loader-fill {
    height: 100%;
    width: 0;
    background-color: var(--primary-color, var(--theme-primary-color, var(--primary, #d43533)));
}

/* —— Hero slider: نص فوق السلايدر (من الداشبورد، عربي/إنجليزي، responsive) —— */
.ctb-hero-slide {
    overflow: hidden;
}

.ctb-hero-slide-media {
    position: relative;
    z-index: 0;
}

.ctb-hero-slide-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(0.35rem, 1.2vw, 0.85rem);
    padding: clamp(0.75rem, 3vw, 2.5rem) clamp(0.85rem, 4vw, 3rem);
    pointer-events: none;
    text-align: end;
}

html:not([dir="rtl"]) .ctb-hero-slide-overlay {
    align-items: flex-end;
    text-align: end;
}

html[dir="rtl"] .ctb-hero-slide-overlay {
    align-items: flex-start;
    text-align: start;
}

.ctb-hero-slide-overlay .ctb-hero-slide-btn {
    pointer-events: auto;
    margin-top: 0.15rem;
    font-size: clamp(0.8rem, 1.1vw + 0.55rem, 0.95rem);
    padding: 0.45rem clamp(1rem, 2.5vw, 1.5rem);
    font-weight: 600;
}

.ctb-hero-slide-title {
    font-size: clamp(1.35rem, 2.8vw + 0.65rem, 2.65rem);
    font-weight: 700;
    line-height: 1.15;
    max-width: min(95%, 22ch);
    color: var(--theme-text-color, #1a1a1a);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.65);
}

.ctb-hero-slide-sub {
    font-size: clamp(0.85rem, 1.1vw + 0.55rem, 1.1rem);
    line-height: 1.35;
    max-width: min(95%, 36ch);
    color: var(--theme-text-color, #1a1a1a);
    opacity: 0.92;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.55);
}

html:not([dir="rtl"]) .ctb-hero-slide-title,
html:not([dir="rtl"]) .ctb-hero-slide-sub {
    font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html[dir="rtl"] .ctb-hero-slide-title,
html[dir="rtl"] .ctb-hero-slide-sub {
    font-family: "Cairo", "Tajawal", sans-serif;
}

@media (max-width: 575.98px) {
    .ctb-hero-slide-overlay {
        justify-content: flex-end;
        align-items: stretch;
        text-align: center;
        padding: 1rem 0.75rem 1.25rem;
        background: linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.58) 0%,
            rgba(0, 0, 0, 0.22) 55%,
            transparent 100%
        );
    }

    html[dir="rtl"] .ctb-hero-slide-overlay {
        align-items: stretch;
        text-align: center;
    }

    .ctb-hero-slide-title,
    .ctb-hero-slide-sub {
        color: #fff;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
        max-width: 100%;
    }

    .ctb-hero-slide-overlay .ctb-hero-slide-btn {
        align-self: center;
    }
}

/* فوتر المتجر: لون النص من secondary_base_color (لوحة المظهر) */
.frontend-store .hc-footer-text-theme,
.frontend-store .hc-footer-text-theme h1,
.frontend-store .hc-footer-text-theme h4,
.frontend-store .hc-footer-text-theme h5,
.frontend-store .hc-footer-text-theme p,
.frontend-store .hc-footer-text-theme .footer-text-control,
.frontend-store .hc-footer-text-theme .text-dark,
.frontend-store .hc-footer-text-theme .text-gray-dark,
.frontend-store .hc-footer-text-theme .text-secondary,
.frontend-store .hc-footer-text-theme .text-soft-light,
.frontend-store .hc-footer-text-theme .text-light,
.frontend-store .hc-footer-text-theme .fs-14:not(.btn) {
    color: var(--secondary-base) !important;
}

.frontend-store .hc-footer-text-theme a.text-reset:not(.btn) {
    color: var(--secondary-base) !important;
}

.frontend-store .hc-footer-text-theme a.text-reset:not(.btn):hover {
    color: var(--hov-secondary-base, var(--secondary-base)) !important;
}

.frontend-store .hc-footer-text-theme .toggle-btn.text-primary {
    color: var(--secondary-base) !important;
}

.frontend-store .hc-footer-policies svg path,
.frontend-store .hc-footer-policies svg rect {
    fill: var(--secondary-base) !important;
}

.frontend-store .hc-footer-text-theme .btn-primary {
    color: #fff !important;
}

.frontend-store .hc-footer-text-theme .form-control.text-white,
.frontend-store .hc-footer-text-theme input.form-control {
    color: #fff !important;
}

.frontend-store .hc-footer-text-theme .form-control::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

/* صفحة المنتج: Swiper عمودي يحسب ارتفاع الشريحة من ارتفاع الحاوية.
   بدون حدّ واضح، عمود المصغّرات يمتد بارتفاع الصف (stretch) فيصبح الارتفاع آلاف البكسل وكل مصغّرة تتضخم. */
#hc-product-gallery.hc-product-gallery-row > .order-md-1 {
    align-self: flex-start;
}

#hc-product-gallery .thumb-container {
    min-height: 0;
}

/* موبايل: مصغّرات أفقية — لا نفرض ارتفاع ضخم */
@media (max-width: 767.98px) {
    #hc-product-gallery .hc-pd-thumb-swiper {
        height: auto;
        min-height: 72px;
    }
}

/* تابلت فأعلى: مصغّرات عمودية — ارتفاع محدد لـ Swiper */
@media (min-width: 768px) {
    #hc-product-gallery .thumb-container {
        height: min(520px, 58vh);
        max-height: min(520px, 58vh);
    }

    #hc-product-gallery .hc-pd-thumb-swiper {
        height: 100%;
        max-height: 100%;
    }

    #hc-product-gallery .hc-pd-thumb-swiper .swiper-slide {
        box-sizing: border-box;
    }

    #hc-product-gallery .hc-pd-thumb-swiper .swiper-slide > img {
        max-height: 100%;
        width: 100%;
        object-fit: cover;
    }
}

#hc-product-gallery .hc-pd-main-swiper {
    min-height: 200px;
}

@media (min-width: 768px) {
    #hc-product-gallery .hc-pd-main-swiper {
        min-height: 320px;
    }
}

/* كاروسيلات ذات صلة / من البائع: احتياط إذا انهارت ارتفاعات الصور */
.related-product-container .carousel-box > .img,
.frequently-bought-container .carousel-box > .img {
    min-height: 90px;
    min-width: 90px;
}

/* —— Lightbox منتج: كان بدون CSS في المشروع → الصورة تظهر بحجمها الطبيعي فوق الصفحة —— */
.lightbox-modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    z-index: 100050;
    background: rgba(0, 0, 0, 0.9);
    overflow: hidden;
    box-sizing: border-box;
    touch-action: none;
}

.lightbox-modal .lightbox-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 48px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.lightbox-modal .lightbox-toolbar .toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}

.lightbox-modal .lightbox-toolbar button {
    background: transparent;
    border: 0;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: #222;
    border-radius: 6px;
}

.lightbox-modal .lightbox-toolbar button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.lightbox-modal #lightboxImage.lightbox-content,
.lightbox-modal img#lightboxImage {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: auto;
    touch-action: manipulation;
}

.lightbox-modal .lightbox-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.lightbox-modal .lightbox-arrow.prev {
    left: max(10px, env(safe-area-inset-left, 0px));
}

.lightbox-modal .lightbox-arrow.next {
    right: max(10px, env(safe-area-inset-right, 0px));
}
