@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

/* ================================================================
   LibreCOD — Website Templates (shop archive / product)
   Everything lives under .wt-shop / .wt-product so it can never bleed
   into the active theme's own chrome — only the WC template slot
   itself is swapped, header/footer are untouched. These wrappers are
   rendered by the override templates INSIDE the active theme's own
   woocommerce_before_main_content/after_main_content container (e.g.
   Astra's .ast-container), so they deliberately set no max-width of
   their own — width:100% always means "the theme's content width".
   ================================================================ */
.wt-shop, .wt-product {
    font-family: 'Cairo', sans-serif;
    color: #1e293b;
}
.wt-shop *, .wt-shop *::before, .wt-shop *::after,
.wt-product *, .wt-product *::before, .wt-product *::after {
    box-sizing: border-box;
    font-family: inherit;
}

/* ── Hero — a single contained image, optional overlay text ─────── */
.wt-hero {
    position: relative;
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    margin: 24px 0 8px;
}
.wt-hero picture,
.wt-hero img {
    display: block;
    width: 100%;
    height: auto;
}
.wt-hero-overlay-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    padding: 28px 36px;
    background: linear-gradient(to top, rgba(0, 0, 0, .5), transparent 65%);
    color: #fff;
}
.wt-hero-overlay-content.wt-hero-pos-left   { align-items: flex-start; text-align: left; }
.wt-hero-overlay-content.wt-hero-pos-center { align-items: center; text-align: center; }
.wt-hero-overlay-content.wt-hero-pos-right  { align-items: flex-end; text-align: right; }
.wt-hero-overlay-content h1 {
    font-size: 2rem;
    font-weight: 900;
    margin: 0 0 10px;
    color: #fff;
    line-height: 1.25;
    max-width: 560px;
}
.wt-hero-overlay-content p {
    font-size: 1.05rem;
    margin: 0 0 18px;
    opacity: .95;
    max-width: 560px;
}
.wt-hero-cta {
    display: inline-block;
    padding: 14px 36px;
    background: var(--wt-primary, #EF4444);
    color: #fff !important;
    font-weight: 700;
    border-radius: 50px;
    text-decoration: none !important;
    transition: transform .2s ease, filter .15s;
}
.wt-hero-cta:hover {
    transform: translateY(-2px);
    filter: brightness(.94);
}

/* ── Extra Banners — optional 4-slot asymmetric grid below the hero ──
   Plain source order (1,2,3,4) with no explicit column placement, so
   CSS Grid's direction-aware flow mirrors correctly under dir="rtl"
   without any extra rules. ─────────────────────────────────────── */
.wt-extra-banners {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
    margin: 8px 0 32px;
}
.wt-extra-banner {
    position: relative;
    display: block;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none !important;
}
.wt-extra-banner-1, .wt-extra-banner-4 { grid-row: span 2; }
.wt-extra-banner-2, .wt-extra-banner-3 { aspect-ratio: 3 / 2; }
.wt-extra-banner picture,
.wt-extra-banner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.wt-extra-banner-label {
    position: absolute;
    inset-inline-start: 16px;
    bottom: 14px;
    z-index: 1;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

/* ── Trust strip ──────────────────────────────────────────────── */
.wt-trust-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px;
    padding: 22px 16px;
    background: #fff7ed;
    border-bottom: 1px solid #fde8da;
}
.wt-trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: .92rem;
    color: #7c2d12;
}
.wt-trust-icon { font-size: 1.2rem; }

.wt-section-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 28px;
    color: #1e293b;
}

/* ── Product grid (shop archive) ──────────────────────────────────── */
.wt-product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.wt-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #f1e4d8;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none !important;
    color: #1e293b !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
    transition: box-shadow .2s ease, transform .2s ease;
}
.wt-product-card:hover {
    box-shadow: 0 8px 22px rgba(0, 0, 0, .1);
    transform: translateY(-2px);
}
.wt-product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.wt-product-name {
    padding: 12px 14px 0;
    font-weight: 600;
    font-size: .92rem;
    line-height: 1.4;
}
.wt-product-price {
    padding: 6px 14px 14px;
    font-weight: 700;
    color: var(--wt-theme, #EF4444);
}

/* ── Template-1 ("Bayt") product card link + actions ─────────────────
   The card itself (.wt-product-card) is a non-link <div> so the
   add-to-cart button below is never nested inside an <a> — the link
   wraps just the image/name/price, click-through to the product. ──── */
.wt-product-card-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none !important;
    color: inherit !important;
}
.wt-discount-ribbon {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    z-index: 1;
    background: var(--wt-primary, #EF4444);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 4px;
}
.wt-product-card-actions {
    padding: 0 14px 14px;
}
.wt-product-card-actions .add_to_cart_button,
.wt-product-card-actions .product_type_simple,
.wt-product-card-actions .button {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    background: transparent;
    color: var(--wt-primary, #EF4444) !important;
    font-weight: 700;
    font-size: .85rem;
    border: 1.5px solid var(--wt-primary, #EF4444);
    border-radius: 8px;
    text-decoration: none !important;
    transition: background-color .15s ease, color .15s ease;
}
.wt-product-card-actions a.button:hover {
    background: var(--wt-primary, #EF4444);
    color: #fff !important;
}
.wt-product-card-actions a.added {
    display: none;
}
.wt-product-card-actions a.added_to_cart {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 8px;
    font-size: .8rem;
    font-weight: 700;
}

/* ── Shop archive — width:100% inherits the theme's own container ──── */
.wt-shop {
    width: 100%;
    padding: 0 20px 56px;
}
.wt-shop-title {
    margin: 32px 0 8px;
}
.wt-shop-grid {
    margin-top: 16px;
}
.wt-shop .woocommerce-result-count,
.wt-shop .woocommerce-ordering {
    margin-bottom: 16px;
}
.wt-shop .woocommerce-pagination {
    margin-top: 36px;
    text-align: center;
}

/* ── Single product — width:100% inherits the theme's own container ── */
.wt-product {
    width: 100%;
    padding: 32px 20px 56px;
}
.wt-product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}
.wt-product-gallery img { border-radius: 16px; }
.wt-trust-strip--buybox {
    margin-top: 22px;
    padding: 16px;
    background: #fff7ed;
    border-radius: 14px;
    justify-content: flex-start;
    border-bottom: none;
}
.wt-product-below {
    margin-top: 48px;
}
.wt-product-below .woocommerce-tabs {
    max-width: 800px;
    margin: 0 auto 40px;
}
.wt-product-below .related.products > h2 {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 24px;
}
.wt-product-below .related.products ul.products {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    list-style: none;
    padding: 0;
    margin: 0;
    scroll-snap-type: x mandatory;
}
.wt-product-below .related.products ul.products li.product {
    flex: 0 0 220px;
    scroll-snap-align: start;
}

/* ================================================================
   Template-2 — "Souk" (سوق): bolder, sharper corners, brand color as
   solid blocks rather than accents. Scoped under .wt-souk so it never
   touches "Bayt" (template-1) styling above.
   ================================================================ */
.wt-souk .wt-hero-cta,
.wt-souk .wt-product-card,
.wt-souk .wt-cat-tile,
.wt-souk .wt-pill {
    border-radius: 4px;
}

/* Trust strip up top, bolder */
.wt-trust-strip--souk {
    background: var(--wt-primary, #EF4444);
    border-bottom: none;
}
.wt-trust-strip--souk .wt-trust-item { color: #fff; }

/* Split hero + pure-CSS auto-fading carousel */
.wt-souk-hero {
    width: 100%;
    padding: 48px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}
.wt-souk-hero-text h1 {
    font-size: 2.3rem;
    font-weight: 900;
    margin: 0 0 12px;
    line-height: 1.25;
}
.wt-souk-hero-text p {
    font-size: 1.05rem;
    margin: 0 0 22px;
    color: #475569;
}
.wt-souk-hero .wt-hero-cta {
    background: var(--wt-primary, #EF4444);
}
.wt-souk-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 4px;
    overflow: hidden;
    background: #f1e4d8;
}
.wt-souk-carousel img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    animation: wt-carousel-fade 16s infinite;
}
@keyframes wt-carousel-fade {
    0%   { opacity: 0; }
    5%   { opacity: 1; }
    25%  { opacity: 1; }
    30%  { opacity: 0; }
    100% { opacity: 0; }
}

/* Category pill filter bar */
.wt-pill-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}
.wt-pill-bar--shop {
    margin: 24px 0 8px;
}
.wt-pill {
    display: inline-block;
    padding: 9px 20px;
    background: #f1f5f9;
    color: #1e293b !important;
    font-weight: 700;
    font-size: .88rem;
    text-decoration: none !important;
    border: 1px solid #e2e8f0;
}
.wt-pill--active,
.wt-pill:hover {
    background: var(--wt-primary, #EF4444);
    color: #fff !important;
    border-color: transparent;
}

/* Dense grid + ribbons */
.wt-product-grid--dense {
    grid-template-columns: repeat(4, 1fr);
}
.wt-ribbon {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    z-index: 1;
    background: var(--wt-primary, #EF4444);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 3px;
}
.wt-ribbon--bestseller {
    background: #1e293b;
}
.wt-final-cta--souk .wt-hero-cta {
    background: var(--wt-primary, #EF4444);
}

/* Single product — stacked gallery-then-buybox + sticky CTA */
.wt-souk .wt-product-stack {
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.wt-souk .wt-product-gallery img { border-radius: 4px; }
.wt-souk .wt-product-below { padding-bottom: 64px; }
.wt-souk .wt-trust-strip--buybox {
    border-radius: 4px;
}

.wt-sticky-cta {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: #fff;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .12);
    transform: translateY(100%);
    transition: transform .25s ease;
}
.wt-sticky-cta--visible {
    transform: translateY(0);
}
.wt-sticky-cta-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.wt-sticky-cta-name {
    font-weight: 700;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wt-sticky-cta-price {
    font-weight: 700;
    color: var(--wt-theme, #EF4444);
    font-size: .85rem;
}
.wt-sticky-cta-btn {
    flex-shrink: 0;
    padding: 12px 28px;
    background: var(--wt-primary, #EF4444);
    color: #fff !important;
    font-weight: 700;
    border-radius: 4px;
    text-decoration: none !important;
}

/* Tabs restyled into a single-open accordion — same ul.tabs/.panel markup
   WC renders by default, its own tabs.js already shows one panel/hides the
   rest on click, so this is pure CSS restacking, no behavior change. */
.wt-souk .wt-product-below .woocommerce-tabs { max-width: 800px; margin: 0 auto 40px; }
.wt-souk .wt-product-below .woocommerce-tabs ul.tabs {
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 0;
    margin: 0;
    border: none;
}
.wt-souk .wt-product-below .woocommerce-tabs ul.tabs li {
    margin: 0 0 -1px;
    border: 1px solid #e2e8f0;
}
.wt-souk .wt-product-below .woocommerce-tabs ul.tabs li a {
    display: block;
    padding: 14px 18px;
    font-weight: 700;
    text-decoration: none !important;
}
.wt-souk .wt-product-below .woocommerce-tabs .panel {
    padding: 18px;
    border: 1px solid #e2e8f0;
    border-top: none;
    margin: 0 0 16px;
}

/* Related products — 2-column grid (vs. Bayt's horizontal row) */
.wt-souk .wt-product-below .related.products ul.products {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: visible;
}

@media (max-width: 900px) {
    .wt-product-grid { grid-template-columns: repeat(2, 1fr); }
    .wt-product-grid--dense { grid-template-columns: repeat(2, 1fr); }
    .wt-product-layout { grid-template-columns: 1fr; gap: 24px; }
    .wt-souk-hero { grid-template-columns: 1fr; }
    .wt-extra-banners { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
    .wt-extra-banner-1, .wt-extra-banner-4 { grid-row: span 1; aspect-ratio: 3 / 2; }
}
@media (max-width: 540px) {
    .wt-hero-overlay-content h1 { font-size: 1.5rem; }
    .wt-hero-overlay-content { padding: 20px 22px; }
    .wt-product-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .wt-product-grid--dense { grid-template-columns: 1fr 1fr; }
    .wt-extra-banners { grid-template-columns: 1fr; grid-template-rows: none; }
    .wt-extra-banner-1, .wt-extra-banner-4 { grid-row: auto; aspect-ratio: 3 / 2; }
    .wt-souk .wt-product-below .related.products ul.products { grid-template-columns: 1fr; }
}
