/* ═══════════════════════════════════════════════════════════
   Product Detail Page — product_detail.css
   Uses CSS variables from style.css
═══════════════════════════════════════════════════════════ */

/* ── Breadcrumb ──────────────────────────────────────────── */
.pd-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-block: 1.2rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.pd-breadcrumb a {
    color: var(--muted);
    transition: color 0.2s;
}
.pd-breadcrumb a:hover { color: var(--brand); }
.pd-breadcrumb-sep { color: var(--border); }
.pd-breadcrumb-current { color: var(--brand); font-weight: 500; }

/* ── Main Two-Column Layout ──────────────────────────────── */
.pd-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3.5rem;
    align-items: start;
    padding-bottom: 4rem;
}
@media (max-width: 900px) {
    .pd-layout { grid-template-columns: 1fr; gap: 2rem; }
}

/* ── Gallery — desktop: thumb strip + main image ─────────── */
.pd-gallery {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: flex-start;
}
/* RTL: thumbnail strip moves to the right */
body.rtl .pd-gallery { flex-direction: row-reverse; }

/* ── Thumbnail strip (vertical on desktop) ───────────────── */
.pd-thumbs-strip {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex-shrink: 0;
    width: 70px;
}
.pd-thumb-btn {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    background: var(--surface-soft);
    flex-shrink: 0;
    transition: border-color 0.18s;
    display: block;
}
.pd-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pd-thumb-btn:hover  { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.pd-thumb-btn.active { border-color: var(--brand); }

/* ── Main image area ─────────────────────────────────────── */
.pd-main-wrap {
    flex: 1;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-soft);
    aspect-ratio: 1 / 1;
    cursor: zoom-in;
}
.pd-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.22s ease;
}
.pd-main-img.is-loading { opacity: 0.45; }

/* Sale badge over main image */
.pd-sale-badge {
    position: absolute;
    top: 0.85rem;
    inset-inline-start: 0.85rem;
    z-index: 2;
    background: #c0392b;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.28rem 0.7rem;
    border-radius: 20px;
    letter-spacing: 0.02em;
    pointer-events: none;
}
body.rtl .pd-sale-badge { letter-spacing: 0; }

/* ‹ › arrows overlaid on the main image */
.pd-gal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: var(--brand);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.14);
    transition: background 0.15s, transform 0.15s;
}
.pd-gal-arrow:hover {
    background: var(--surface-soft);
    transform: translateY(-50%) scale(1.07);
}
.pd-gal-arrow--prev { left: 0.7rem; }
.pd-gal-arrow--next { right: 0.7rem; }
/* RTL: swap sides */
body.rtl .pd-gal-arrow--prev { left: auto; right: 0.7rem; }
body.rtl .pd-gal-arrow--next { right: auto; left: 0.7rem; }

/* ── Info panel — sticky on desktop ──────────────────────── */
/* No max-height/overflow — panel sizes naturally, page scroll handles it.
   This prevents content being clipped on shorter viewport screens.       */
.pd-info {
    position: sticky;
    top: 1.5rem;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Mobile layout ───────────────────────────────────────── */
@media (max-width: 900px) {
    /* Stack: main image on top, thumbs below */
    .pd-gallery          { flex-direction: column; gap: 0.6rem; }
    body.rtl .pd-gallery { flex-direction: column; }

    .pd-thumbs-strip {
        flex-direction: row;
        width: 100%;
        justify-content: flex-start;
        gap: 0.4rem;
        order: 2;   /* thumbs sit below the main image */
    }
    .pd-thumb-btn { width: 72px; height: 72px; }

    .pd-main-wrap {
        order: 1;
        border-radius: var(--radius-sm);
    }

    /* Larger arrows on mobile for thumb-friendly tapping */
    .pd-gal-arrow {
        width: 44px;
        height: 44px;
        font-size: 1.55rem;
    }

    /* Info panel: no sticky on mobile */
    .pd-info {
        position: static;
    }
}

/* ── Lightbox ────────────────────────────────────────────── */
.pd-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.93);
    align-items: center;
    justify-content: center;
}
.pd-lightbox.is-open { display: flex; }

.pd-lightbox-img-wrap {
    max-width: min(90vw, 900px);
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pd-lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    display: block;
}
.pd-lightbox-close {
    position: absolute;
    top: 1.2rem;
    inset-inline-end: 1.4rem;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.pd-lightbox-close:hover { background: rgba(255,255,255,0.25); }

.pd-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 2.4rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}
.pd-lightbox-nav:hover { background: rgba(255,255,255,0.22); }
.pd-lightbox-prev { left: 1rem; }
.pd-lightbox-next { right: 1rem; }
body.rtl .pd-lightbox-prev { left: auto; right: 1rem; }
body.rtl .pd-lightbox-next { right: auto; left: 1rem; }

.pd-lightbox-counter {
    position: absolute;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
}

.pd-category-tag {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand);
    background: var(--brand-soft);
    padding: 0.25rem 0.9rem;
    border-radius: 20px;
    margin-bottom: 0.85rem;
}
body.rtl .pd-category-tag { letter-spacing: 0; }

.pd-title {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    line-height: 1.1;
    color: var(--brand);
    margin-bottom: 0.5rem;
}
body.rtl .pd-title { font-family: 'Cairo', sans-serif; }

.pd-subtitle {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Rating row */
.pd-rating-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
}
.pd-stars { color: #f5a623; font-size: 1rem; letter-spacing: 1px; }
.pd-review-count { font-size: 0.85rem; color: var(--muted); }
.pd-review-link { font-size: 0.85rem; color: var(--brand); text-decoration: underline; }

/* Price block */
.pd-price-block {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}
.pd-price-current {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--brand);
    font-family: 'Cormorant Garamond', serif;
}
body.rtl .pd-price-current { font-family: 'Cairo', sans-serif; font-size: 1.6rem; }

.pd-price-original {
    font-size: 1.1rem;
    color: var(--muted);
    text-decoration: line-through;
}
.pd-stock-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    background: #e6f4ea;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}
.pd-stock-badge.out-of-stock {
    background: #fdecea;
    color: #c62828;
    border-color: #ffcdd2;
}
.pd-stock-badge.limited {
    background: #fff8e1;
    color: #f57f17;
    border-color: #ffe082;
}
.pd-stock-badge.made-to-order {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: #c8dbc8;
}

.pd-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin-block: 1.2rem;
}

/* ── Selectors ───────────────────────────────────────────── */
.pd-selector-group {
    margin-bottom: 1.2rem;
}
.pd-selector-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.7rem;
    font-size: 0.9rem;
}
.pd-selector-label-text {
    color: var(--muted);
    font-weight: 500;
}
.pd-selector-value {
    color: var(--brand);
    font-weight: 700;
}

/* Fabric swatches */
.pd-swatches {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.pd-swatch-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border);
    padding: 2px;
    cursor: pointer;
    background: var(--surface);
    transition: border-color 0.2s, transform 0.15s;
    overflow: hidden;
    position: relative;
}
.pd-swatch-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.pd-swatch-color-dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}
.pd-swatch-btn:hover { transform: scale(1.1); border-color: var(--brand); }
.pd-swatch-btn.active { border-color: var(--brand); border-width: 2.5px; }
.pd-swatch-btn.active::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--brand);
    pointer-events: none;
}
.pd-swatch-btn:disabled,
.pd-swatch-btn.unavailable { opacity: 0.3; cursor: not-allowed; transform: none; }

/* Size buttons */
.pd-size-buttons,
.pd-sheet-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.pd-size-btn,
.pd-sheet-btn {
    padding: 0.5rem 1.1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    white-space: nowrap;
}
.pd-size-btn:hover,
.pd-sheet-btn:hover { border-color: var(--brand); color: var(--brand); }
.pd-size-btn.active,
.pd-sheet-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
}
.pd-size-btn:disabled,
.pd-sheet-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    text-decoration: line-through;
}
/* Size unavailable for the selected sheet type — dimmed strikethrough */
.pd-size-btn.unavailable {
    opacity: 0.38;
    text-decoration: line-through;
    cursor: not-allowed;
    border-style: dashed;
    color: var(--muted);
}

/* Unavailable message */
.pd-unavailable-msg {
    display: none;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    color: #7c5800;
    margin-bottom: 1rem;
}

/* SKU / lead time row */
.pd-sku-row {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Actions */
.pd-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.pd-btn-cart {
    flex: 1;
    min-width: 180px;
    padding: 1rem 1.5rem;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s, transform 0.1s;
}
.pd-btn-cart:hover:not(:disabled) { background: var(--brand-dark); }
.pd-btn-cart:active:not(:disabled) { transform: scale(0.98); }
.pd-btn-cart:disabled {
    background: var(--border);
    color: var(--muted);
    cursor: not-allowed;
}

.pd-btn-whatsapp {
    padding: 1rem 1.2rem;
    background: #25d366;
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.pd-btn-whatsapp:hover { background: #1ebe57; }

/* ── Details Section (Tabs) ──────────────────────────────── */
.pd-details {
    padding-block: 3rem;
    border-top: 1px solid var(--border);
}
.pd-tabs-header {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.8rem;
}
.pd-tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.95rem;
    color: var(--muted);
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s, border-color 0.2s;
}
.pd-tab-btn.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
    font-weight: 700;
}
.pd-tab-btn:hover { color: var(--brand); }

.pd-tab-panel { display: none; }
.pd-tab-panel.active { display: block; }

.pd-description-text {
    font-size: 0.98rem;
    line-height: 1.85;
    color: var(--text);
    max-width: 720px;
}
.pd-description-text p { margin-bottom: 0.75rem; }

.pd-material-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.pd-material-card {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.3rem;
}
.pd-material-card-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.4rem;
}
body.rtl .pd-material-card-label { letter-spacing: 0; }
.pd-material-card-value {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
}

/* ── Reviews Section ─────────────────────────────────────── */
.pd-reviews-section {
    padding-block: 3rem;
    border-top: 1px solid var(--border);
}
.pd-reviews-title {
    font-size: clamp(1.6rem, 2.5vw, 2.2rem);
    color: var(--brand);
    margin-bottom: 0.4rem;
}
.pd-reviews-meta {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pd-reviews-avg-stars { color: #f5a623; font-size: 1rem; }

.pd-reviews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
}
.pd-review-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.3rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pd-review-stars { color: #f5a623; font-size: 0.95rem; }
.pd-review-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand);
}
.pd-review-body {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.6;
}
.pd-review-author {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.pd-review-verified {
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
}

/* ── Quantity selector ───────────────────────────────────── */
.pd-qty-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.pd-qty-controls {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.pd-qty-btn {
    width: 36px;
    height: 36px;
    background: var(--surface-soft);
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.pd-qty-btn:hover { background: var(--border); }
.pd-qty-display {
    min-width: 40px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--brand);
    background: var(--surface);
    line-height: 36px;
    padding: 0 4px;
}

/* ── Related products ────────────────────────────────────── */
.pd-related-section {
    padding-block: 3rem;
    border-top: 1px solid var(--border);
}
.pd-related-title {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    color: var(--brand);
    margin-bottom: 1.6rem;
}
.pd-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
}
.pd-related-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: box-shadow 0.2s, transform 0.2s;
}
.pd-related-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.09);
    transform: translateY(-2px);
}
.pd-related-image {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--surface-soft);
}
.pd-related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.pd-related-card:hover .pd-related-image img { transform: scale(1.04); }
.pd-related-badge {
    position: absolute;
    top: 0.6rem;
    inset-inline-start: 0.6rem;
    background: #c0392b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    letter-spacing: 0.04em;
}
.pd-related-info {
    padding: 0.9rem 1rem;
}
.pd-related-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand);
    line-height: 1.3;
    margin-bottom: 0.4rem;
}
.pd-related-price {
    font-size: 0.88rem;
    color: var(--muted);
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}
.pd-related-sale-price { color: #c0392b; font-weight: 700; }
.pd-related-orig-price { text-decoration: line-through; font-size: 0.8rem; }

/* ── Mobile adjustments ──────────────────────────────────── */
@media (max-width: 600px) {
    .pd-price-current { font-size: 1.5rem; }
    .pd-thumb { width: 58px; height: 58px; }
    .pd-actions { flex-direction: column; }
    .pd-btn-cart, .pd-btn-whatsapp { width: 100%; justify-content: center; }
}
