:root {
    --admin-main: var(--primary-color, #22381f);
    --admin-hover: #162614;
    --admin-light: rgba(34, 56, 31, 0.05);
    --admin-soft: rgba(34, 56, 31, 0.12);
    --admin-glow: rgba(34, 56, 31, 0.25);
    --gray-bg: #f8fafc;
    --gray-border: #e2e8f0;
    --gray-text: #64748b;
    --dark-text: #0f172a;
    --discount-red: #ef4444;
    --gold: #f59e0b;
    --card-shadow: 0 18px 40px -15px rgba(0, 0, 0, 0.07);
}

body {
    background-color: #fafbfc;
    color: var(--dark-text);
}

.product-detail-wrapper {
    /* #main-content is a flex column and `margin: 0 auto` disables stretch,
       so without an explicit width this wrapper shrink-wraps its content.
       The active tab panel then decided the page width (and, through the
       1:1 gallery, the product card's height) — switching tabs resized it.
       width: 100% makes it always fill up to max-width, independent of
       which tab is open. */
    width: 100%;
    max-width: 1220px;
    margin: 0 auto;
    padding: 20px 18px 75px;
}

/* Breadcrumb */
.breadcrumb-nav {
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--gray-text);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: #fff;
    padding: 9px 18px;
    border-radius: 50px;
    border: 1px solid var(--gray-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    width: fit-content;
}

.breadcrumb-nav a {
    color: var(--gray-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-nav a:hover {
    color: var(--admin-main);
}

.breadcrumb-nav .sep {
    font-size: 0.72rem;
    color: #cbd5e1;
}

/* ========================================================
   Product Wrapper (الحجم المتوازن الوسط بدون مبالغة)
   ======================================================== */
.product-wrapper {
    background: #ffffff;
    border-radius: 28px;
    padding: 34px 32px;
    border: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: var(--card-shadow);
}

.product-wrapper.row {
    margin-left: 0;
    margin-right: 0;
}

/* Gallery Section */
.product-image-container {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--gray-border);
    background: var(--gray-bg, #f8fafc);
}

.product-image-container .carousel-inner,
.product-image-container .carousel-item {
    width: 100%;
    height: 100%;
}

.product-image-container .carousel-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-image-container:hover .carousel-inner img {
    transform: scale(1.02);
}

.carousel-control-prev,
.carousel-control-next {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(6px);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.7);
    opacity: 0.85;
    transition: all 0.25s ease;
}

.carousel-control-prev { left: 14px; }
.carousel-control-next { right: 14px; }

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background: var(--admin-main) !important;
    opacity: 1;
    transform: translateY(-50%) scale(1.08);
}

.carousel-control-prev:hover .carousel-control-prev-icon,
.carousel-control-next:hover .carousel-control-next-icon {
    filter: brightness(0) invert(1);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    filter: invert(0.2);
    width: 17px;
    height: 17px;
}

.gallery-thumbs {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    max-width: 560px;
    margin-inline: auto;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 6px;
}

.gallery-thumb-item {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md, 14px);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    scroll-snap-align: center;
    transition: border-color 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
    background: var(--gray-bg, #f8fafc);
    opacity: 0.7;
    padding: 0;
    font: inherit;
}

.gallery-thumb-item:focus-visible {
    outline: 2px solid var(--admin-main);
    outline-offset: 2px;
}

.gallery-thumb-item.active,
.gallery-thumb-item:hover {
    border-color: var(--admin-main);
    opacity: 1;
}
.gallery-thumb-item.active { box-shadow: 0 4px 12px var(--admin-glow); }
@media (max-width: 575px) {
    .gallery-thumb-item { width: 60px; height: 60px; }
}
@media (hover: none) {
    .gallery-zoom-icon { opacity: 1; transform: none; }
}

/* Gallery zoom trigger — the whole main image is a real <button>, so
   clicking/tapping it (or reaching it with the keyboard) opens the
   lightbox. A subtle magnifier badge in the corner signals it's zoomable
   without shouting over the product photo itself. */
.gallery-zoom-trigger {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
    position: relative;
}

.gallery-zoom-icon {
    position: absolute;
    bottom: 14px;
    inset-inline-end: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    color: var(--admin-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.product-image-container:hover .gallery-zoom-icon,
.gallery-zoom-trigger:focus-visible .gallery-zoom-icon {
    opacity: 1;
    transform: translateY(0);
}

.gallery-zoom-trigger:focus-visible {
    outline: 2px solid var(--admin-main);
    outline-offset: -2px;
}

/* No product/gallery image at all, or a broken URL caught by onerror —
   the same tasteful neutral fallback everywhere (never the browser's
   broken-image icon). */
.carousel-item.img-fallback,
.pd-gallery-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-bg);
    color: #cbd5e1;
    font-size: 3.5rem;
}

/* ============ Lightbox ============ */
.pd-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-lightbox[hidden] { display: none; }
.pd-lightbox { touch-action: none; overscroll-behavior: contain; }

.pd-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 10, 0.92);
    backdrop-filter: blur(4px);
}

.pd-lightbox-stage {
    position: absolute;
    inset: 0;
    z-index: 1;
    padding: calc(64px + env(safe-area-inset-top, 0px)) 72px calc(24px + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.pd-lightbox-stage::after {
    content: "";
    position: absolute;
    top: 50%; inset-inline-start: 50%;
    width: 28px; height: 28px; margin: -14px;
    border: 2px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: pdSpin 0.8s linear infinite;
    transition: opacity 0.15s ease;
}
.pd-lightbox-stage.is-loading::after { opacity: 1; }
.pd-lightbox-stage.is-loading img { opacity: 0.35; }
@keyframes pdSpin { to { transform: rotate(360deg); } }

.pd-lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    pointer-events: auto;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    transform-origin: 50% 50%;
    will-change: transform;
    transition: opacity 0.18s ease;
}

.pd-lightbox-counter {
    position: absolute;
    top: calc(22px + env(safe-area-inset-top, 0px));
    inset-inline-start: 20px;
    z-index: 2;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.92);
    font-size: 0.82rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    direction: ltr;
}
.pd-lightbox-counter[hidden] { display: none; }

.pd-lightbox-close {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    inset-inline-end: 16px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease;
}
.pd-lightbox-close:hover { background: rgba(255,255,255,0.22); }
.pd-lightbox-close:focus-visible,
.pd-lightbox-nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.pd-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease;
}
.pd-lightbox-nav[hidden] { display: none; }
.pd-lightbox-nav:hover { background: rgba(255,255,255,0.22); }
.pd-lightbox-nav:active { background: rgba(255,255,255,0.3); }
.pd-lightbox-prev { inset-inline-start: max(14px, env(safe-area-inset-left, 0px)); }
.pd-lightbox-next { inset-inline-end: max(14px, env(safe-area-inset-right, 0px)); }
[dir="rtl"] .pd-lightbox-nav svg.lucide { transform: scaleX(-1); }

@media (max-width: 576px) {
    .pd-lightbox-stage { padding-inline: 12px; }
    .pd-lightbox-nav { width: 40px; height: 40px; top: auto; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: none; }
    .pd-lightbox-stage { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
    .pd-lightbox-prev { inset-inline-start: calc(50% - 52px); }
    .pd-lightbox-next { inset-inline-end: calc(50% - 52px); }
    .pd-lightbox-close { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    .pd-lightbox-stage::after { animation: none; }
    .pd-lightbox-stage img,
    .product-image-container .carousel-item img,
    .gallery-thumb-item { transition: none; }
}

/* Product video presentation — native playback only; one fullscreen trigger. */
.reel-fullscreen-btn {
    position: absolute;
    bottom: 12px;
    inset-inline-end: 12px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    color: #1e1915;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    transition: background-color 0.18s ease;
}
.reel-fullscreen-btn:hover { background: #fff; }
.reel-fullscreen-btn:focus-visible { outline: 2px solid var(--admin-main); outline-offset: 2px; }
.tab-reel-card video:fullscreen { pointer-events: auto; object-fit: contain; background: #000; }
.tab-reel-card video:-webkit-full-screen { pointer-events: auto; object-fit: contain; background: #000; }

/* ============ Related Products ============
   Section layout is bespoke to this page; the card itself is the
   canonical component from store/templates/store/partials/_product_card.html
   (same one used on Store/Category/Search/Favorites/Home), so it always
   matches pricing, ratings, wishlist and Add-to-Cart everywhere else. */
/* A secondary, compact continuation of the page — never a second storefront.
   Backend caps related_products at 3 (store/views.py), so this is a plain,
   predictable 3-column row: no stretching to fill leftover width, no
   auto-fit/auto-fill guessing a column count from available space. The grid
   itself is capped and centered inside .product-detail-wrapper (max-width
   1220px above) rather than spanning it edge-to-edge, which combined with
   the .pd-title rename above (that rename is the actual fix for "titles the
   size of the page H1") is what keeps these cards visually restrained. */
.related-products-section {
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid var(--border-color, rgba(15, 23, 42, 0.08));
}

.related-products-heading,
.recently-viewed-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--dark-text);
    margin-bottom: 20px;
}

.related-products-heading svg.lucide,
.recently-viewed-heading svg.lucide { color: var(--admin-main); font-size: 1.05rem; }

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin-inline: auto;
}

.related-products-item { min-width: 0; height: 100%; }

/* Tablet: 2 comfortable columns, the 3rd card naturally wraps to its own
   row rather than being squeezed into a 3rd shrinking column. */
@media (max-width: 991px) {
    .related-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
        max-width: 620px;
    }
}

/* Phones: a touch-swipeable horizontal carousel — pure CSS scroll-snap,
   no JS/library, no autoplay. The strip scrolls inside itself only
   (overscroll-behavior contains the gesture), so the page never moves
   sideways. Each card is ~62% of the strip, so the next card always peeks
   in from the edge as a visual "swipe for more" cue. The strip bleeds into
   .product-detail-wrapper's side padding (--rp-bleed) so cards slide out to
   the screen edge, while scroll-padding keeps the snapped card aligned with
   the rest of the page content. Card markup/links are untouched. */
@media (max-width: 767px) {
    .related-products-section { --rp-bleed: 18px; }

    .related-products-grid {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: min(62%, 260px);
        gap: 12px;
        max-width: none;
        margin-inline: calc(var(--rp-bleed) * -1);
        padding: 8px var(--rp-bleed) 14px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: var(--rp-bleed);
    }

    .related-products-item {
        scroll-snap-align: start;
        scroll-snap-stop: normal;
    }
}

@media (max-width: 576px) {
    /* Matches .product-detail-wrapper's phone side padding below. */
    .related-products-section { --rp-bleed: 10px; }
}

@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
    .related-products-grid { scroll-behavior: smooth; }
}

/* ============ Mobile sticky purchase bar ============
   Hidden by default (both the HTML `hidden` attribute and this class);
   JS toggles it via IntersectionObserver watching the normal Add to Cart
   button, so it only appears once that button scrolls out of view. */
.pd-sticky-bar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1040;
    display: none;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 24px rgba(0,0,0,0.09);
    border-top: 1px solid var(--gray-border);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.pd-sticky-bar.is-visible {
    display: flex;
}

/* A tiny delay lets `display` take effect before the transform runs, so
   the slide-up animation actually plays instead of popping in instantly. */
.pd-sticky-bar.is-visible.is-shown {
    transform: translateY(0);
}

.pd-sticky-price {
    flex: none;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.pd-sticky-price-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--admin-main);
}

.pd-sticky-price-currency {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-text);
}

.pd-sticky-add-btn {
    height: 48px;
    font-size: 0.98rem;
    border-radius: 14px;
}

/* Reserve room at the bottom of the page while the sticky bar is showing
   so Reviews / Related Products / the footer are never hidden behind it. */
body.has-pd-sticky-bar .product-detail-wrapper {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
    /* Desktop always has the normal purchase panel comfortably in view —
       the sticky bar is a mobile/tablet-only pattern. */
    .pd-sticky-bar { display: none !important; }
    body.has-pd-sticky-bar .product-detail-wrapper { padding-bottom: 75px; }
}

@media (prefers-reduced-motion: reduce) {
    .pd-sticky-bar { transition: none; }
}

.gallery-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Info */
.meta-tags-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.stock-badge {
    padding: 5px 13px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.in-stock-badge { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.in-stock-badge.low-stock-badge { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.out-stock-badge { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

.category-badge {
    background: var(--admin-light);
    color: var(--admin-main);
    border: 1px solid var(--admin-soft);
    padding: 5px 13px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Renamed from the collision-prone ".product-title" (this page's own <style>
   block loads AFTER product_card.css in <head>, so with equal specificity a
   bare ".product-title" here was silently overriding the canonical card's
   title style — including inside every card in "You May Also Like" below,
   which is exactly what made related-product titles render at page-H1 size.
   This page's own product name now has its own, non-colliding class. */
.pd-title {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--dark-text);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

/* Optional Size / Measurement (Product.measurement — translated via
   modeltranslation, see store/translation.py, so it already reads in
   whichever language is active). Secondary to the title: smaller, muted,
   no background, sitting quietly between the name and the wishlist/price
   so it never competes with either. */
.product-measurement-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--gray-text);
}
.product-measurement-detail svg.lucide {
    font-size: 0.82rem;
    color: var(--gray-text);
    opacity: 0.85;
}

/* Rating row — same calculation as the canonical Product Card
   (product.average_rating / product.active_testimonials_count), just
   presented inline. Clicking jumps to the Reviews section below. */
.product-rating-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    text-decoration: none !important;
    color: var(--dark-text);
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
}
.product-rating-row:hover .product-rating-value { text-decoration: underline; }
.product-rating-row .stars-outer svg.lucide { color: var(--gold); font-size: 0.9rem; }
.product-rating-row .stars-outer svg.lucide + svg.lucide { margin-inline-start: 1px; }
.product-rating-count { color: var(--gray-text); font-weight: 600; }

/* Compact icon-only wishlist control — sits beside Add to Cart so it
   complements the primary action instead of competing with it. */
.wishlist-icon-btn {
    flex: none;
    width: 58px;
    height: 58px;
    border-radius: var(--radius-md, 14px);
    background: #ffffff;
    color: var(--gray-text);
    border: 1.5px solid var(--gray-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.wishlist-icon-btn:hover:not(.is-disabled) {
    border-color: var(--discount-red);
    color: var(--discount-red);
    background: #fff5f5;
    transform: translateY(-2px);
}

.wishlist-icon-btn:focus-visible {
    outline: 2px solid var(--admin-main);
    outline-offset: 2px;
}

.wishlist-icon-btn.active {
    background: #fff1f2;
    border-color: #fecdd3;
    color: var(--discount-red);
}

.wishlist-icon-btn.active svg.lucide { animation: pdHeartPulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes pdHeartPulse { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* Out of stock and not already favorited: kept visible, but greyed out
   and inert — a new add is rejected server-side anyway (see
   store.views.wishlist_toggle). Never applied to a product that's
   already in the wishlist, so removal always stays available. */
.wishlist-icon-btn.is-disabled {
    cursor: not-allowed;
    color: #cbd5e1;
    border-color: var(--gray-border);
    background: #f8fafc;
}
.wishlist-icon-btn.is-disabled:hover {
    transform: none;
    color: #cbd5e1;
    border-color: var(--gray-border);
    background: #f8fafc;
}

@media (prefers-reduced-motion: reduce) {
    .wishlist-icon-btn.active svg.lucide { animation: none; }
}

/* Price Box */
.price-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 20px;
    background: var(--gray-bg);
    border-radius: 18px;
    border: 1px solid var(--gray-border);
    margin-bottom: 22px;
    width: fit-content;
}

.product-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--admin-main);
    letter-spacing: -0.02em;
    line-height: 1;
}

.old-price-detail {
    font-size: 1.25rem;
    font-weight: 500;
    color: #64748b;
    text-decoration: line-through;
}

.discount-savings-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 4px 11px;
    border-radius: 20px;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.25);
}

/* Quantity Controls */
.pd-qty-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gray-text);
    margin-bottom: 8px;
}

.qty-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    padding: 6px;
    border-radius: var(--radius-md, 14px);
    border: 1.5px solid var(--gray-border);
    margin-bottom: 22px;
}

.qty-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--gray-bg);
    color: var(--dark-text);
    border: 1px solid var(--gray-border);
    font-size: 16px;
    font-weight: 700;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: none;
}

.qty-btn:hover:not(:disabled) {
    background: var(--admin-main);
    color: var(--on-primary, #fff);
    border-color: var(--admin-main);
}

.qty-btn:focus-visible {
    outline: 2px solid var(--admin-main);
    outline-offset: 2px;
}

/* A real, typeable quantity input (not just a static counter) — clamped
   and normalized in JS (see the shared quantity logic at the bottom of
   this file), so a manually typed value can never go below 1, above the
   sane ceiling, or be non-numeric. */
.qty-value-input {
    width: 56px;
    height: 44px;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--dark-text);
    text-align: center;
    -moz-appearance: textfield;
}
.qty-value-input::-webkit-outer-spin-button,
.qty-value-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.qty-value-input:focus-visible {
    outline: 2px solid var(--admin-main);
    outline-offset: 2px;
    border-radius: 8px;
}

/* ========================================================
   Purchase actions — Add to Cart (primary, strongest visual weight) +
   compact Wishlist icon sitting right beside it.
   ======================================================== */
/* Primary actions: Add to Cart + Order via WhatsApp side by side, favourites as a compact icon. */
.purchase-actions-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 48px;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 8px;
}
.purchase-actions-row .add-cart-btn { height: auto; min-height: 48px; font-size: 1rem; padding: 6px 10px; box-shadow: 0 4px 14px var(--admin-soft); }
.purchase-actions-row .wishlist-icon-btn { width: 48px; height: auto; min-height: 48px; }
/* No WhatsApp number configured: Add to Cart takes the free column. */
.purchase-actions-row .add-cart-btn:nth-last-child(2) { grid-column: span 2; }
/* Very narrow phones: Add to Cart on its own line, WhatsApp + favourites share the next one. */
@media (max-width: 359px) {
    .purchase-actions-row { grid-template-columns: minmax(0, 1fr) 48px; }
    .purchase-actions-row .add-cart-btn { grid-column: 1 / -1; }
    .purchase-actions-row .add-cart-btn:nth-last-child(2) { grid-column: 1 / 2; }
}
@media (min-width: 577px) { .purchase-actions-row .add-cart-btn, .purchase-actions-row .pd-wa-order { min-height: 50px; } }

.pd-specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
    line-height: 1.7;
}
.pd-specs-table th,
.pd-specs-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: start;
    vertical-align: top;
    overflow-wrap: anywhere;
}
.pd-specs-table th {
    width: 38%;
    font-weight: 600;
    color: var(--admin-main);
    background: rgba(0, 0, 0, 0.02);
}
.pd-specs-table td { color: #475569; }

/* Inquiry ("Ask on WhatsApp"): a quiet secondary text action beside Share. */
.pd-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 4px;
    font-size: .875rem;
    font-weight: 500;
    color: #475569;
    background: transparent;
    border: 0;
    text-decoration: underline;
    text-decoration-color: rgba(71, 85, 105, .35);
    text-underline-offset: 4px;
    transition: color .2s ease, text-decoration-color .2s ease;
}
.pd-whatsapp-btn:hover,
.pd-whatsapp-btn:focus-visible {
    color: #0b6b3a;
    text-decoration-color: currentColor;
    background: transparent;
}
.pd-whatsapp-btn svg.lucide { width: 16px; height: 16px; }

.pd-cart-state { margin-bottom: 12px; }
.pd-cart-qty { margin: 0 0 6px; font-weight: 700; color: var(--admin-main); }
.pd-cart-added {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin: 0;
    padding: 10px 14px;
    border-radius: var(--radius-md, 14px);
    background: var(--admin-soft);
}
.pd-cart-added[hidden], .pd-cart-qty[hidden] { display: none; }
.pd-cart-added-label { font-weight: 700; }
.pd-cart-added a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-weight: 700;
    color: var(--admin-main);
    text-decoration: underline;
}
.pd-review-done, .pd-review-reward { font-weight: 600; overflow-wrap: anywhere; }
.pd-review-reward { margin: 0 0 12px; color: var(--admin-main); }

.add-cart-btn {
    flex: 1 1 auto;
    min-width: 0;
    height: 58px;
    font-size: 1.08rem;
    font-weight: 700;
    border-radius: var(--radius-md, 14px);
    background: var(--admin-main) !important;
    color: var(--on-primary, #fff) !important;
    border: none;
    box-shadow: 0 8px 25px var(--admin-soft);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-cart-btn-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.add-cart-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.7s ease;
}

.add-cart-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px var(--admin-soft);
}

.add-cart-btn:hover:not(:disabled)::before {
    left: 100%;
}

.add-cart-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.add-cart-btn:focus-visible {
    outline: 2px solid var(--admin-main);
    outline-offset: 3px;
}

.add-cart-btn:disabled {
    background: #cbd5e1 !important;
    box-shadow: none;
    cursor: not-allowed;
}

/* Loading / success states shared by the normal CTA and the sticky bar's
   CTA (see the shared addProductToCart() JS function). */
.add-cart-btn.is-loading { pointer-events: none; }
.add-cart-btn.is-loading svg.lucide { animation: pdCartSpin 0.7s linear infinite; }
.add-cart-btn.is-success { background: #059669 !important; }

@keyframes pdCartSpin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .add-cart-btn.is-loading svg.lucide { animation: none; }
}

/* Trust Badges Strip */
.trust-badges-strip {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px dashed var(--gray-border);
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.84rem;
    color: var(--gray-text);
    font-weight: 600;
}

.trust-item svg.lucide {
    font-size: 1.15rem;
    color: var(--admin-main);
}

/* Delivery Info Card */
.delivery-info-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
    padding: 16px 18px;
    background: var(--admin-light);
    border: 1px solid var(--admin-soft);
    border-radius: var(--radius-md, 14px);
}

.delivery-info-icon {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md, 14px);
    background: #fff;
    border: 1px solid var(--admin-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--admin-main);
    font-size: 1.05rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.delivery-info-body {
    min-width: 0;
}

.delivery-info-title {
    font-weight: 800;
    font-size: 0.96rem;
    color: var(--dark-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.delivery-info-card.is-free .delivery-info-title svg.lucide {
    color: #059669;
}

.delivery-info-meta {
    margin-top: 3px;
    font-size: 0.84rem;
    color: var(--gray-text);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.delivery-info-fee {
    color: var(--admin-main);
    font-weight: 800;
}

.delivery-info-dot {
    color: var(--gray-border);
}

@media (max-width: 576px) {
    .delivery-info-card { padding: 14px; gap: 11px; }
    .delivery-info-icon { width: 36px; height: 36px; font-size: 0.95rem; }
}

/* Tabs Section */
.product-tabs-container {
    margin-top: 45px;
    background: #ffffff;
    border-radius: 26px;
    border: 1px solid var(--gray-border);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.custom-tabs-header {
    display: flex;
    background: var(--gray-bg);
    border-bottom: 1px solid var(--gray-border);
    padding: 10px 14px 0;
    gap: 8px;
}

.custom-tab-button {
    background: transparent;
    border: none;
    padding: 15px 24px;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--gray-text);
    cursor: pointer;
    transition: all 0.25s ease;
    border-start-start-radius: 14px;
    border-start-end-radius: 14px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    position: relative;
}

.custom-tab-button:hover {
    color: var(--admin-main);
    background: rgba(255,255,255,0.6);
}

.custom-tab-button:focus-visible {
    outline: 2px solid var(--admin-main);
    outline-offset: -2px;
}

.custom-tab-button.active {
    color: var(--admin-main);
    background: #ffffff;
}

.custom-tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    inset-inline-start: 0;
    inset-inline-end: 0;
    height: 3px;
    background: var(--admin-main);
    border-start-start-radius: 4px;
    border-start-end-radius: 4px;
}

.custom-tab-panel {
    display: none;
    padding: 36px;
    animation: fadeInTab 0.3s ease;
}

.custom-tab-panel.active { display: block; }

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Shipping Info (Shipping & Returns tab) */
.shipping-info-block {
    max-width: 800px;
    margin-bottom: 22px;
    padding: 22px 26px;
    background: var(--admin-light);
    border: 1px solid var(--admin-soft);
    border-radius: 18px;
}

.shipping-info-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--dark-text);
    margin: 0 0 14px;
}

.shipping-info-heading svg.lucide {
    color: var(--admin-main);
}

.shipping-info-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shipping-info-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--dark-text);
}

.shipping-info-list li svg.lucide {
    color: var(--admin-main);
    width: 18px;
    text-align: center;
}

.shipping-returns-link-row {
    margin-bottom: 18px;
}

.shipping-returns-link-row a {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--admin-main);
    text-decoration: none;
}

.shipping-returns-link-row a:hover {
    text-decoration: underline;
}

/* Return Policy Container */
.policy-container {
    background: var(--gray-bg);
    border: 1px dashed var(--gray-border);
    border-radius: 18px;
    padding: 26px;
    max-width: 800px;
}

.policy-badge-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1rem;
    padding: 7px 16px;
    border-radius: 10px;
    margin-bottom: 14px;
}

.policy-badge-box.returnable {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.policy-badge-box.non-returnable {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.policy-text-desc {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--gray-text);
}

/* ========================================================
   REELS SHOWCASE (3 فيديوهات ممتدة على الديسكتوب بدون أزرار ولا صوت)
   ======================================================== */
.tab-reels-container {
    width: 100%;
}

.tab-reels-header {
    text-align: center;
    margin-bottom: 26px;
}

.tab-reels-header .reels-pill-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--admin-light);
    color: var(--admin-main);
    padding: 7px 22px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid var(--admin-soft);
}

.tab-reels-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    align-items: center;
}

.tab-reel-card {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    border-radius: 22px;
    overflow: hidden;
    background: #020617;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-border);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.tab-reels-grid:hover .tab-reel-card {
    opacity: 0.85;
    filter: brightness(0.95);
}

.tab-reels-grid:hover .tab-reel-card:hover {
    opacity: 1;
    filter: brightness(1.04);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.22);
    border-color: var(--admin-main);
}

.tab-reel-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reel-ambient-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.35);
    border-radius: 22px;
    z-index: 1;
}

/* Testimonial & Review Section */
.testimonial-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 26px;
    margin-bottom: 20px;
    position: relative;
    border: 1px solid var(--gray-border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.02);
}

.avatar-circle {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--admin-main), var(--admin-hover));
    color: #ffffff;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px var(--admin-glow);
}

.review-input-box {
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid var(--gray-border);
    padding: 28px;
    box-shadow: var(--card-shadow);
    margin-bottom: 35px;
}

.submit-review-btn {
    background: var(--admin-main) !important;
    color: var(--on-primary, #fff) !important;
    border: none;
    padding: 13px 30px;
    border-radius: 13px;
    font-weight: 700;
    font-size: 0.98rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px var(--admin-glow);
    cursor: pointer;
}

.submit-review-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--admin-glow);
    background: var(--admin-hover) !important;
}

.rating-wrapper {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 4px;
}

/* Kept in the tab order and screen-reader tree (visually-hidden, not
   display:none) so keyboard users can reach and select a rating. */
.rating-wrapper input {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.rating-wrapper label {
    cursor: pointer;
    width: 32px;
    height: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23cbd5e1'%3E%3Cpath d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform 0.2s ease;
    border-radius: 4px;
}

.rating-wrapper input:checked ~ label,
.rating-wrapper label:hover,
.rating-wrapper label:hover ~ label {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f59e0b'%3E%3Cpath d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") !important;
    transform: scale(1.15);
}

.rating-wrapper input:focus-visible + label {
    outline: 2px solid var(--admin-main);
    outline-offset: 2px;
}

/* ========================================================
   Overflow guard for products that have videos.
   #main-content (main.html) is a flex COLUMN, and this wrapper has
   `margin: 0 auto`. Auto margins on the cross axis disable
   `align-self: stretch`, so the wrapper is sized shrink-to-fit, svg.lucide.e.
   never narrower than its min-content width. The extra nowrap
   "Product Videos" tab button (and the 76vw reel cards when that tab
   is open) push that min-content past the phone viewport, widening the
   whole product card. min-width: 0 on the inner boxes and an explicit
   width below 992px stop intrinsic content widths from leaking up.
   ======================================================== */
.product-wrapper > [class*="col-"],
.product-tabs-container,
.custom-tab-panel,
.tab-reels-container {
    min-width: 0;
    max-width: 100%;
}

.tab-reel-card video {
    max-width: 100%;
}

/* Responsiveness */
@media (max-width: 991px) {
    .product-detail-wrapper {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .product-wrapper { padding: 24px; }
    .pd-title { font-size: 1.75rem; }
    .tab-reels-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

@media (max-width: 576px) {
    .product-detail-wrapper { padding: 14px 10px 45px; }
    .product-wrapper { padding: 18px 14px; border-radius: 22px; }
    .pd-title { font-size: 1.45rem; }
    .price-container { width: 100%; justify-content: space-between; padding: 12px 16px; }
    .product-price { font-size: 1.55rem; }
    .qty-wrapper { width: 100%; justify-content: space-between; }
    .trust-badges-strip { flex-direction: column; gap: 10px; }
    .custom-tabs-header {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .custom-tab-button { white-space: nowrap; padding: 13px 18px; font-size: 0.9rem; }
    .custom-tab-panel { padding: 22px 14px; }
    .review-input-box { padding: 20px 16px; }

    .tab-reels-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 12px;
        -webkit-overflow-scrolling: touch;
        gap: 14px;
        justify-content: flex-start;
    }
    .tab-reel-card {
        flex: 0 0 76vw;
        max-width: 300px;
        scroll-snap-align: center;
        border-radius: 18px;
    }
}
