/* Product page (mobile first). Every class starts with "pd-" so the site theme can not override it. */
.pd {
    --pd-ink: #111111;
    --pd-ink-2: #3a3a3a;
    --pd-muted: #8a8f98;
    --pd-line: #ececec;
    --pd-bg: #f6f6f7;
    --pd-accent: #fe7e00;
    --pd-accent-dark: #e57100;
    --pd-accent-soft: #fff4e8;
    --pd-danger: #e5484d;
    --pd-radius: 18px;
    --pd-shadow: 0 1px 2px rgba(17, 17, 17, .04), 0 8px 24px rgba(17, 17, 17, .06);
    background: var(--pd-bg);
    color: var(--pd-ink);
    padding-bottom: 96px;
}
.pd *, .pd *::before, .pd *::after { box-sizing: border-box; }
.pd a { color: inherit; text-decoration: none; }
.pd img { max-width: 100%; }
.pd button { font-family: inherit; }
.pd-container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* breadcrumb */
.pd-crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; list-style: none; margin: 0; padding: 14px 0; font-size: 13px; color: var(--pd-muted); }
.pd-crumbs li { display: flex; align-items: center; gap: 6px; }
.pd-crumbs li + li::before { content: "\203A"; font-size: 16px; line-height: 1; }
[dir="rtl"] .pd-crumbs li + li::before { content: "\2039"; }
.pd-crumbs a:hover { color: var(--pd-accent); }
.pd-crumbs li:last-child { color: var(--pd-ink); font-weight: 600; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* main card */
.pd-card { background: #fff; border-radius: var(--pd-radius); box-shadow: var(--pd-shadow); }
.pd-top { display: grid; gap: 20px; padding: 0; overflow: hidden; }

/* gallery */
.pd-gallery { position: relative; min-width: 0; }
.pd-stage { position: relative; background: #fafafa; overflow: hidden; }
.pd-slides {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
    scrollbar-width: none; -ms-overflow-style: none;
}
.pd-slides::-webkit-scrollbar { display: none; }
.pd-slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.pd-slide img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.pd-badge {
    position: absolute; top: 14px; inset-inline-start: 14px; z-index: 2;
    background: var(--pd-danger); color: #fff; font-weight: 800; font-size: 14px;
    padding: 5px 12px; border-radius: 10px; unicode-bidi: isolate;
}
.pd-badge--out { background: var(--pd-ink); }
.pd-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(255, 255, 255, .92); box-shadow: 0 2px 10px rgba(0, 0, 0, .12); color: var(--pd-ink);
    display: none; align-items: center; justify-content: center;
}
.pd-nav svg { width: 20px; height: 20px; }
.pd-nav--prev { inset-inline-start: 12px; }
.pd-nav--next { inset-inline-end: 12px; }
[dir="rtl"] .pd-nav svg { transform: scaleX(-1); }
.pd-dots { display: flex; justify-content: center; gap: 6px; padding: 12px 0 4px; }
.pd-dots button { width: 7px; height: 7px; border-radius: 4px; border: 0; padding: 0; background: #d6d6d6; cursor: pointer; transition: width .2s, background .2s; }
.pd-dots button.is-active { width: 20px; background: var(--pd-accent); }
.pd-thumbs { display: none; }

/* info */
.pd-info { padding: 4px 16px 20px; min-width: 0; }
.pd-title { font-size: 21px; line-height: 1.45; font-weight: 800; margin: 0 0 10px; color: var(--pd-ink); }
.pd-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.pd-price__now { font-size: 28px; font-weight: 800; color: var(--pd-accent); }
.pd-price__old { font-size: 16px; color: var(--pd-muted); text-decoration: line-through; }
.pd-price__save { font-size: 12px; font-weight: 700; color: var(--pd-danger); background: #fdecec; padding: 3px 8px; border-radius: 8px; }
.pd-rating { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--pd-muted); margin-bottom: 12px; }
.pd-rating svg { width: 15px; height: 15px; }
.pd-rating .on { color: #f5a623; }
.pd-rating .off { color: #d9d9d9; }

.pd-brand {
    display: flex; align-items: center; gap: 12px; padding: 12px 0; margin: 6px 0 4px;
    border-top: 1px solid var(--pd-line); border-bottom: 1px solid var(--pd-line); font-size: 14px;
}
.pd-brand__logo { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--pd-line); object-fit: contain; background: #fff; flex: none; }
.pd-brand__text span { color: var(--pd-muted); display: block; font-size: 12px; }
.pd-brand__text strong { font-size: 15px; }
.pd-brand a:hover strong { color: var(--pd-accent); }

.pd-option { margin-top: 16px; }
.pd-option__label { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.pd-option__label span { color: var(--pd-muted); font-weight: 600; }
.pd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-chip { position: relative; }
.pd-chip input { position: absolute; opacity: 0; pointer-events: none; }
.pd-chip span {
    display: inline-flex; align-items: center; justify-content: center; min-width: 52px; height: 44px; padding: 0 14px;
    border: 1.5px solid var(--pd-line); border-radius: 22px; font-weight: 700; font-size: 14px; cursor: pointer;
    background: #fff; transition: all .15s;
}
.pd-chip span:hover { border-color: #c9c9c9; }
.pd-chip input:checked + span { border-color: var(--pd-ink); background: var(--pd-ink); color: #fff; }
.pd-chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(254, 126, 0, .3); }
.pd-swatch span { min-width: 0; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--pd-line); }
.pd-swatch input:checked + span { background: inherit; box-shadow: 0 0 0 2px var(--pd-ink); }
.pd-hint { font-size: 13px; color: var(--pd-muted); margin: 0; }

/* buy block: inline on desktop, sticky bottom bar on mobile */
.pd-buy {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 1030;
    display: flex; align-items: center; gap: 10px;
    background: #fff; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 30px rgba(17, 17, 17, .10); border-radius: 20px 20px 0 0;
}
.pd-qty { display: inline-flex; align-items: center; height: 52px; border: 1.5px solid var(--pd-line); border-radius: 14px; flex: none; background: #fff; }
.pd-qty button { width: 42px; height: 100%; border: 0; background: none; cursor: pointer; color: var(--pd-ink); display: inline-flex; align-items: center; justify-content: center; }
.pd-qty button:disabled { color: #c9c9c9; cursor: not-allowed; }
.pd-qty svg { width: 16px; height: 16px; }
.pd-qty input { width: 36px; border: 0; text-align: center; font-weight: 800; font-size: 16px; background: none; -moz-appearance: textfield; padding: 0; }
.pd-qty input::-webkit-outer-spin-button, .pd-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pd-qty input:focus { outline: 0; }
.pd-add {
    flex: 1; height: 52px; border: 0; border-radius: 14px; cursor: pointer;
    background: var(--pd-accent); color: #fff; font-size: 16px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    transition: background .2s, transform .1s;
}
.pd-add:hover { background: var(--pd-accent-dark); }
.pd-add:active { transform: scale(.99); }
.pd-add:disabled { opacity: .65; cursor: progress; }
.pd-add svg { width: 22px; height: 22px; }
.pd-add--out { background: #e4e4e4; color: var(--pd-muted); cursor: not-allowed; }
.pd-add--out:hover { background: #e4e4e4; }
.pd-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: pd-spin .7s linear infinite; display: none; }
.pd-add.is-loading .pd-spinner { display: inline-block; }
.pd-add.is-loading svg { display: none; }
@keyframes pd-spin { to { transform: rotate(360deg); } }

.pd-actions { display: flex; gap: 10px; margin-top: 16px; }
.pd-action {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; border: 1.5px solid var(--pd-line); border-radius: 14px; background: #fff; cursor: pointer;
    font-size: 14px; font-weight: 700; color: var(--pd-ink-2) !important; transition: border-color .2s, color .2s;
}
.pd-action:hover { border-color: var(--pd-accent); color: var(--pd-accent) !important; }
.pd-action svg { width: 20px; height: 20px; }
.pd-meta { display: grid; gap: 6px; margin-top: 16px; font-size: 13px; color: var(--pd-muted); }
.pd-meta div { display: flex; align-items: center; gap: 8px; }
.pd-meta svg { width: 16px; height: 16px; color: var(--pd-accent); flex: none; }

/* specs */
.pd-specs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--pd-line); border-radius: 14px; overflow: hidden; margin: 0 16px 20px; }
.pd-spec { background: #fafafa; padding: 16px 12px; text-align: center; }
.pd-spec strong { display: block; font-size: 14px; margin-bottom: 4px; }
.pd-spec span { font-size: 13px; color: var(--pd-muted); line-height: 1.6; }

/* description */
.pd-section { margin-top: 16px; }
.pd-desc { padding: 0; }
.pd-desc > summary {
    list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    padding: 18px 20px; font-size: 17px; font-weight: 800;
}
.pd-desc > summary::-webkit-details-marker { display: none; }
.pd-desc > summary svg { width: 20px; height: 20px; transition: transform .2s; }
.pd-desc[open] > summary svg { transform: rotate(180deg); }
.pd-desc__body { padding: 0 20px 20px; font-size: 15px; line-height: 1.9; color: var(--pd-ink-2); overflow-wrap: anywhere; }
.pd-desc__body img { height: auto; }

/* similar products */
.pd-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 28px 0 14px; }
.pd-head h2 { font-size: 20px; font-weight: 800; margin: 0; padding-bottom: 8px; position: relative; }
.pd-head h2::after { content: ""; position: absolute; bottom: 0; inset-inline-start: 0; width: 48px; height: 3px; border-radius: 2px; background: var(--pd-accent); }
.pd-head a { color: var(--pd-accent) !important; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.pd-head a svg { width: 16px; height: 16px; }
[dir="rtl"] .pd-head a svg { transform: scaleX(-1); }

.pd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pd-product { position: relative; display: flex; flex-direction: column; padding: 10px; transition: box-shadow .2s, transform .2s; }
.pd-product:hover { box-shadow: 0 12px 30px rgba(17, 17, 17, .10); }
.pd-product__img { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; background: #fafafa; overflow: hidden; display: block; }
.pd-product__img img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s; }
.pd-product:hover .pd-product__img img { transform: scale(1.04); }
.pd-product__badge { position: absolute; top: 8px; inset-inline-start: 8px; background: var(--pd-danger); color: #fff; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 8px; unicode-bidi: isolate; }
.pd-product__fav {
    position: absolute; top: 16px; inset-inline-end: 16px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .1); display: flex; align-items: center; justify-content: center; color: var(--pd-ink-2) !important;
}
.pd-product__fav:hover { color: var(--pd-danger) !important; }
.pd-product__fav svg { width: 18px; height: 18px; }
.pd-product__brand { font-size: 12px; color: var(--pd-muted); margin: 10px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-product__name {
    font-size: 14px; font-weight: 700; line-height: 1.5; margin: 2px 0 6px; min-height: 42px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pd-product__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-bottom: 10px; margin-top: auto; }
.pd-product__price strong { color: var(--pd-accent); font-size: 16px; font-weight: 800; }
.pd-product__price del { color: var(--pd-muted); font-size: 12px; }
.pd-product__btn {
    height: 40px; border-radius: 10px; border: 0; cursor: pointer; width: 100%;
    background: var(--pd-accent); color: #fff !important; font-size: 13px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .2s;
}
.pd-product__btn:hover { background: var(--pd-accent-dark); }
.pd-product__btn:disabled { opacity: .6; }
.pd-product__btn svg { width: 16px; height: 16px; }

/* features strip */
.pd-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 28px; padding: 16px; }
.pd-feature { display: flex; align-items: center; gap: 10px; }
.pd-feature__icon { width: 44px; height: 44px; border-radius: 50%; background: var(--pd-accent-soft); color: var(--pd-accent); display: flex; align-items: center; justify-content: center; flex: none; }
.pd-feature__icon svg { width: 22px; height: 22px; }
.pd-feature strong { display: block; font-size: 13px; }
.pd-feature span { display: block; font-size: 12px; color: var(--pd-muted); line-height: 1.5; }

/* lightbox */
.pd-lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, .9); display: none; align-items: center; justify-content: center; padding: 16px; }
.pd-lightbox.is-open { display: flex; }
.pd-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pd-lightbox button { position: absolute; top: 16px; inset-inline-end: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; font-size: 26px; cursor: pointer; }

/* ---------- tablet ---------- */
@media (min-width: 640px) {
    .pd-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
    .pd-specs { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- desktop ---------- */
@media (min-width: 992px) {
    .pd { padding-bottom: 40px; }
    .pd-top { grid-template-columns: 84px minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; padding: 24px; }
    .pd-gallery { display: contents; }
    .pd-thumbs { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; scrollbar-width: thin; }
    .pd-thumb { width: 84px; height: 84px; flex: none; border-radius: 12px; border: 2px solid transparent; background: #fafafa; padding: 0; cursor: pointer; overflow: hidden; transition: border-color .2s; }
    .pd-thumb img { width: 100%; height: 100%; object-fit: contain; }
    .pd-thumb.is-active { border-color: var(--pd-accent); }
    .pd-stage { border-radius: 16px; align-self: start; }
    .pd-nav { display: inline-flex; }
    .pd-dots { position: absolute; bottom: 10px; inset-inline: 0; padding: 0; }
    .pd-info { padding: 8px 0 0; }
    .pd-title { font-size: 26px; }
    .pd-price__now { font-size: 32px; }
    .pd-buy { position: static; box-shadow: none; padding: 0; border-radius: 0; margin-top: 20px; z-index: auto; }
    .pd-specs { grid-column: 1 / -1; margin: 0; }
    .pd-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
    .pd-features { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 20px 24px; }
    .pd-feature + .pd-feature { border-inline-start: 1px solid var(--pd-line); padding-inline-start: 16px; }
    .pd-head h2 { font-size: 24px; }
}

/* names wrap to a second line */
.pd-product__name, .pd-title { white-space: normal; overflow-wrap: anywhere; }

/* the site layout styles every .addToWishlist (hidden on hover, extra margin on mobile): keep ours */
.pd .pd-action.addToWishlist { height: 46px !important; margin: 0 !important; display: inline-flex !important; }
.pd .pd-product__fav.addToWishlist { height: 34px !important; margin: 0 !important; display: flex !important; }
.pd .pd-action.addToWishlist:hover { color: var(--pd-accent) !important; background-color: #fff !important; }
.pd .pd-product__fav.addToWishlist:hover { color: var(--pd-danger) !important; background-color: #fff !important; }

/* ---------- price amounts (desktop: new price then the old one in one row) ---------- */
.pd-price__amounts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }

/* ---------- mobile only elements, hidden on desktop ---------- */
.pd-appbar, .pd-under, .pd-brand__more { display: none; }
[dir="ltr"] .pd-flip { transform: scaleX(-1); }

/* ---------- mobile: same look as the mobile app ---------- */
@media (max-width: 991.98px) {
    .pd { background: #fff; padding-bottom: 92px; }
    .pd-crumbs, .pd-actions, .pd-features, .pd-head a, .pd-badge { display: none !important; }

    /* top bar */
    .pd-appbar {
        display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
        position: sticky; top: 0; z-index: 1020; height: 60px; padding: 0 8px;
        background: #f5f5f7; border-bottom: 1px solid var(--pd-line);
    }
    .pd-appbar__title { text-align: center; font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pd-appbar__btn { position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--pd-ink) !important; }
    .pd-appbar__btn:last-child { justify-self: end; }
    .pd-appbar__btn svg { width: 26px; height: 26px; }
    .pd-appbar__count {
        position: absolute; top: 0; inset-inline-end: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
        background: var(--pd-accent); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
    }
    .pd-appbar__count[hidden] { display: none; }

    /* full width product, no card */
    .pd-top { margin: 0 -16px; border-radius: 0; box-shadow: none; gap: 0; }
    .pd-stage { background: #fff; }
    .pd-dots { padding-top: 8px; }

    .pd-under { display: flex; flex-direction: row-reverse; justify-content: space-between; padding: 4px 16px 0; }
    .pd-under__btn {
        width: 48px; height: 48px; border: 0; background: none; padding: 0; cursor: pointer;
        display: inline-flex !important; align-items: center; justify-content: center; color: var(--pd-ink) !important; margin: 0 !important;
    }
    .pd-under__btn svg { width: 30px; height: 30px; }
    .pd .pd-under__btn.addToWishlist:hover { color: var(--pd-danger) !important; background: none !important; }

    .pd-info { padding: 8px 20px 12px; }
    /* same order as the app: name, price, size / color, then brand and barcode */
    .pd-info { display: flex; flex-direction: column; }
    .pd-title { order: 1; }
    .pd-price { order: 2; }
    #pd-form { order: 3; }
    .pd-brand { order: 4; }
    .pd-rating { order: 5; margin-top: 8px; }
    .pd-meta { order: 6; }
    .pd-title { text-align: center; font-size: 20px; margin: 8px 0 18px; }

    /* price: old price over the new one, discount pill on the other side */
    .pd-price { justify-content: space-between; align-items: center; margin-bottom: 4px; }
    .pd-price__amounts { flex-direction: column-reverse; align-items: flex-start; gap: 0; }
    .pd-price__now { color: var(--pd-ink); font-size: 20px; }
    .pd-price__old { color: var(--pd-accent); font-size: 17px; }
    .pd-price__save { background: var(--pd-danger); color: #fff; font-size: 16px; font-weight: 600; padding: 8px 26px; border-radius: 14px; }

    .pd-option { margin-top: 14px; }
    .pd-option__label { font-size: 17px; font-weight: 600; }
    .pd-option__label::after { content: " :"; }
    .pd-chip span { min-width: 56px; height: 46px; border-color: #c9c9c9; border-radius: 23px; font-weight: 600; }

    /* brand: "brand : name"  ...  "more >" */
    .pd-brand { justify-content: space-between; border-bottom: 0; margin-top: 20px; padding-top: 16px; }
    .pd-brand__logo { display: none; }
    .pd-brand__text { display: flex; gap: 6px; align-items: baseline; font-size: 16px; }
    .pd-brand__text span { display: inline; color: var(--pd-ink); font-size: 16px; }
    .pd-brand__text span::after { content: " :"; }
    .pd-brand__text strong { font-size: 16px; font-weight: 500; }
    .pd-brand__more { display: inline-flex; align-items: center; gap: 2px; font-size: 15px; color: var(--pd-ink) !important; }
    .pd-brand__more svg { width: 20px; height: 20px; }

    .pd-meta { margin-top: 4px; font-size: 15px; color: var(--pd-ink); font-weight: 600; }
    .pd-meta svg { display: none; }

    /* description: plain section with a line */
    .pd-desc { border-radius: 0; box-shadow: none; border-top: 1px solid var(--pd-line); margin: 8px -16px 0; }
    .pd-desc > summary { font-size: 20px; padding: 16px 20px; }

    /* "similar products": centered title between two lines */
    .pd-head { justify-content: center; margin: 24px 0 16px; }
    .pd-head h2 { display: flex; align-items: center; gap: 16px; width: 100%; padding: 0; font-size: 22px; font-weight: 700; }
    .pd-head h2::before, .pd-head h2::after { content: ""; position: static; flex: 1; height: 1px; width: auto; background: #bdbdbd; border-radius: 0; }

    /* bottom bar: outlined "buy now" + gray quantity buttons */
    .pd-buy { border-radius: 0; box-shadow: 0 -2px 12px rgba(17, 17, 17, .08); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); gap: 18px; }
    .pd-add { order: -1; height: 50px; background: #fff; color: var(--pd-accent); border: 1.5px solid var(--pd-accent); border-radius: 14px; font-weight: 700; }
    .pd-add:hover { background: var(--pd-accent-soft); }
    .pd-add svg { display: none !important; }
    .pd-add .pd-spinner { border-color: rgba(254, 126, 0, .3); border-top-color: var(--pd-accent); }
    .pd-add--out { border-color: #d6d6d6; color: var(--pd-muted); background: #f3f3f3; }
    .pd-qty { border: 0; height: 50px; gap: 6px; }
    .pd-qty button { width: 40px; height: 40px; background: #ececec; border-radius: 4px; color: #9a9a9a; }
    .pd-qty button:disabled { color: #c9c9c9; background: #f3f3f3; }
    .pd-qty input { width: 34px; font-size: 18px; font-weight: 500; color: #555; }
}
