/* ==========================================================================
   Parspistak single product page
   Loaded only on product pages (see functions.php).
   Template: woocommerce/content-single-product.php
   ========================================================================== */

.pp-product {
  --pp-bg: #F3F7F5;
  --pp-surface: #FFFFFF;
  --pp-ink: #1B2825;
  --pp-muted: #5A6C67;
  --pp-line: #DCE6E2;
  --pp-accent: #378174;
  --pp-accent-deep: #2A6359;
  --pp-accent-soft: #E4F0EC;
  --pp-r-sm: 8px;
  --pp-r-md: 14px;
  --pp-shadow: 0 12px 32px rgba(42, 99, 89, 0.09);
  --pp-top: 0px;

  font-family: 'Vazirmatn', Tahoma, sans-serif;
  color: var(--pp-ink);
  line-height: 1.9;
  background: var(--pp-bg);
  padding-bottom: 56px;
}

body.single-product #wrapper,
body.single-product #main,
body.single-product #content { background: #F3F7F5; }

@media (prefers-reduced-motion: no-preference) {
  html:has(.pp-product) { scroll-behavior: smooth; }
}

.pp-product :where(ul, ol, figure, p, h1, h2, h3) { margin: 0; padding: 0; }
.pp-product :where(ul) { list-style: none; }
.pp-product *, .pp-product *::before, .pp-product *::after { box-sizing: border-box; }
.pp-product a { color: var(--pp-accent-deep); }

.pp-wrap { max-width: 1200px; margin-inline: auto; padding-inline: 20px; }

/* ---------- breadcrumb ---------- */
.pp-crumbs { padding-block: 18px 6px; font-size: 0.85rem; color: var(--pp-muted); }
.pp-crumbs a { color: var(--pp-muted); text-decoration: none; }
.pp-crumbs a:hover { color: var(--pp-accent-deep); }
.pp-crumbs .pp-sep { margin-inline: 8px; opacity: 0.6; }

/* ---------- hero ---------- */
.pp-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  padding-block: 14px 40px;
}

/* gallery */
.pp-gallery { position: sticky; top: calc(var(--pp-top) + 70px); }
.pp-stage {
  background: var(--pp-surface);
  border: 1px solid var(--pp-line);
  border-radius: var(--pp-r-md);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.pp-stage a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.pp-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pp-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pp-thumbs button {
  width: 72px; height: 72px; padding: 0; border-radius: var(--pp-r-sm);
  background: var(--pp-surface); border: 2px solid var(--pp-line);
  overflow: hidden; cursor: pointer; line-height: 0; box-shadow: none; margin: 0; min-height: 0;
}
.pp-thumbs button img { width: 100%; height: 100%; object-fit: cover; }
.pp-thumbs button[aria-current='true'] { border-color: var(--pp-accent); }
.pp-thumbs button:focus-visible { outline: 3px solid var(--pp-accent); outline-offset: 2px; }

/* info column */
.pp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pp-chip {
  display: inline-block; padding: 2px 14px; border-radius: 999px;
  background: var(--pp-accent-soft); color: var(--pp-accent-deep) !important;
  font-size: 0.82rem; text-decoration: none; line-height: 1.9;
}
.pp-chip:hover { background: var(--pp-accent); color: #fff !important; }

.pp-product h1.pp-title {
  font-size: clamp(1.45rem, 2.6vw, 2.05rem); font-weight: 800; line-height: 1.5;
  color: var(--pp-ink); letter-spacing: 0; margin: 0 0 8px; text-transform: none;
}
.pp-rating { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--pp-muted); margin-bottom: 10px; }
.pp-rating a { color: var(--pp-muted); text-decoration: none; }
.pp-lead { color: var(--pp-muted); max-width: 62ch; margin-bottom: 14px; }

.pp-spec {
  background: var(--pp-surface); border: 1px solid var(--pp-line);
  border-radius: var(--pp-r-md); padding: 14px 18px; margin: 14px 0 18px; font-size: 0.95rem;
}
.pp-spec p + p { margin-top: 4px; }
.pp-spec strong { color: var(--pp-accent-deep); }

/* buy panel */
.pp-panel {
  background: var(--pp-surface); border: 1px solid var(--pp-line);
  border-radius: var(--pp-r-md); padding: 22px; box-shadow: var(--pp-shadow);
}
.pp-panel-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pp-price { font-size: 1.7rem; font-weight: 800; color: var(--pp-ink); line-height: 1.4; }
.pp-price del { font-size: 1rem; font-weight: 400; color: var(--pp-muted); margin-inline-end: 8px; }
.pp-price ins { text-decoration: none; }
.pp-price .woocommerce-Price-currencySymbol { font-size: 0.9rem; font-weight: 500; margin-inline-start: 4px; }
.pp-stock { font-size: 0.85rem; padding: 2px 12px; border-radius: 999px; background: var(--pp-accent-soft); color: var(--pp-accent-deep); }
.pp-stock.is-out { background: #F5E7E4; color: #8A3A2E; }

.pp-product form.cart { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; margin: 0; }
.pp-product form.cart.variations_form { display: block; }
.pp-product .woocommerce-variation-add-to-cart { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; margin-top: 14px; }
.pp-product .variations { width: 100%; border: 0; margin: 0 0 4px; }
.pp-product .variations td, .pp-product .variations th { border: 0; padding: 6px 0; display: block; text-align: start; }
.pp-product .variations label { font-weight: 700; font-size: 0.92rem; }
.pp-product .variations select {
  width: 100%; height: 46px; border-radius: var(--pp-r-sm); border: 1px solid var(--pp-line);
  background-color: #fff; box-shadow: none; margin: 0; padding-inline: 14px;
}
.pp-product .reset_variations { font-size: 0.82rem; }
.pp-product .woocommerce-variation-price .price { font-weight: 800; font-size: 1.2rem; }

.pp-product .quantity {
  display: inline-flex; align-items: stretch; margin: 0; background: #fff;
  border: 1px solid var(--pp-line); border-radius: 999px; overflow: hidden;
}
.pp-product .quantity .qty {
  width: 54px; height: 48px; border: 0; box-shadow: none; margin: 0;
  text-align: center; background: transparent; padding: 0; font-weight: 700;
}
.pp-product .quantity .ux-quantity__button,
.pp-product .quantity input[type='button'] {
  width: 42px; height: 48px; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; box-shadow: none; color: var(--pp-ink); font-size: 1.1rem; min-height: 0;
}
.pp-product .quantity .ux-quantity__button:hover { background: var(--pp-accent-soft); }

.pp-product .single_add_to_cart_button,
.pp-product button.pp-bar-btn {
  flex: 1 1 180px; min-height: 48px; margin: 0; border-radius: 999px; border: 0;
  background: var(--pp-accent); color: #fff; font-weight: 800; font-size: 1rem;
  letter-spacing: 0; text-transform: none; box-shadow: none; padding-inline: 28px; cursor: pointer;
}
.pp-product .single_add_to_cart_button:hover,
.pp-product button.pp-bar-btn:hover { background: var(--pp-accent-deep); color: #fff; }
.pp-product .single_add_to_cart_button:focus-visible,
.pp-product button.pp-bar-btn:focus-visible { outline: 3px solid var(--pp-accent-deep); outline-offset: 2px; }
.pp-product .single_add_to_cart_button.disabled { opacity: 0.5; }

.pp-assure { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--pp-line); display: grid; gap: 8px; font-size: 0.9rem; color: var(--pp-muted); }
.pp-assure li { display: flex; align-items: center; gap: 10px; }
.pp-assure svg { flex: 0 0 18px; color: var(--pp-accent); }
.pp-assure a { color: var(--pp-accent-deep); }
.pp-tools { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.pp-tools button {
  background: transparent; border: 1px solid var(--pp-line); border-radius: 999px;
  padding: 0 16px; min-height: 38px; font-size: 0.85rem; color: var(--pp-ink);
  box-shadow: none; margin: 0; text-transform: none; letter-spacing: 0; cursor: pointer;
}
.pp-tools button:hover { border-color: var(--pp-accent); color: var(--pp-accent-deep); }

/* ---------- sticky section nav ---------- */
.pp-subnav {
  position: sticky; top: var(--pp-top); z-index: 20;
  background: rgba(255, 255, 255, 0.96); border-block: 1px solid var(--pp-line);
}
.pp-subnav ul { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.pp-subnav ul::-webkit-scrollbar { display: none; }
.pp-subnav a {
  display: block; padding: 14px 18px; white-space: nowrap; text-decoration: none;
  color: var(--pp-muted); font-weight: 700; font-size: 0.95rem; border-bottom: 3px solid transparent;
}
.pp-subnav a:hover { color: var(--pp-ink); }
.pp-subnav a[aria-current='true'] { color: var(--pp-accent-deep); border-bottom-color: var(--pp-accent); }

/* ---------- sections ---------- */
.pp-section { padding-block: 44px 8px; scroll-margin-top: calc(var(--pp-top) + 64px); }
.pp-product h2.pp-h2 {
  font-size: clamp(1.25rem, 2vw, 1.6rem); font-weight: 800; line-height: 1.5;
  margin: 0 0 20px; color: var(--pp-ink); letter-spacing: 0; text-transform: none;
}
.pp-product h2.pp-h2::after {
  content: ''; display: block; width: 44px; height: 3px; margin-top: 8px;
  background: var(--pp-accent); border-radius: 3px;
}

.pp-prose { max-width: none; }
.pp-prose > p { max-width: 70ch; font-size: 1.02rem; }
.pp-prose { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.pp-prose > * { flex: 0 0 100%; margin: 0; }
.pp-prose img { max-width: 100%; height: auto; border-radius: var(--pp-r-sm); }
.pp-prose ul, .pp-prose ol { padding-inline-start: 1.4em; list-style: revert; }
.pp-prose table {
  width: 100% !important; height: auto !important; border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--pp-line); border-radius: var(--pp-r-md); background: #fff; font-size: 0.95rem; margin: 0;
}
.pp-prose td, .pp-prose th { padding: 9px 16px; border: 0; border-bottom: 1px solid var(--pp-line); width: auto !important; }
.pp-prose tr:last-child td { border-bottom: 0; }
.pp-prose tbody tr:nth-child(even) td { background: #F8FBFA; }
.pp-prose tr:first-child td[colspan] {
  background: var(--pp-accent); color: #fff; font-weight: 800; text-align: center;
  border-radius: var(--pp-r-md) var(--pp-r-md) 0 0; font-size: 1.05rem;
}
.pp-prose tbody:has(tr:first-child td[colspan]) tr:nth-child(2) td {
  background: var(--pp-accent-soft); color: var(--pp-muted); font-size: 0.8rem; font-weight: 700;
}
.pp-prose td:first-child { direction: ltr; text-align: right; font-weight: 700; }
.pp-prose td:nth-child(2) { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }
.pp-prose tr:first-child td[colspan] { direction: rtl; text-align: center; }
.pp-prose > table:not(:has(td:nth-child(3))) { flex: 1 1 240px; max-width: 340px; width: auto !important; }

.pp-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.pp-card-box {
  background: var(--pp-surface); border: 1px solid var(--pp-line);
  border-radius: var(--pp-r-md); padding: 22px 24px;
}
.pp-product h3.pp-h3 { font-size: 1.1rem; font-weight: 800; margin: 0 0 10px; color: var(--pp-accent-deep); letter-spacing: 0; text-transform: none; }
.pp-card-box p + p { margin-top: 8px; }
.pp-card-box strong { color: var(--pp-ink); }
.pp-card-box.is-warn { border-color: #E4C9C3; }
.pp-card-box.is-warn h3.pp-h3 { color: #8A3A2E; }

/* reviews: keep Flatsome markup, restyle the container */
.pp-reviews-box { background: var(--pp-surface); border: 1px solid var(--pp-line); border-radius: var(--pp-r-md); padding: 24px; }
.pp-reviews-box .woocommerce-Reviews-title { font-size: 1.1rem; font-weight: 800; }
.pp-reviews-box .submit, .pp-reviews-box input[type='submit'] {
  background: var(--pp-accent); color: #fff; border: 0; border-radius: 999px; box-shadow: none;
  padding-inline: 26px; text-transform: none; letter-spacing: 0; font-weight: 700;
}
.pp-reviews-box textarea, .pp-reviews-box input[type='text'], .pp-reviews-box input[type='email'] {
  border-radius: var(--pp-r-sm); border: 1px solid var(--pp-line); box-shadow: none;
}
.pp-reviews-box textarea:focus, .pp-reviews-box input:focus { border-color: var(--pp-accent); outline: 2px solid var(--pp-accent-soft); }

/* related */
.pp-related { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.pp-rel-card {
  display: flex; flex-direction: column; background: var(--pp-surface);
  border: 1px solid var(--pp-line); border-radius: var(--pp-r-md); overflow: hidden;
  text-decoration: none; color: var(--pp-ink) !important;
}
.pp-rel-card:hover { border-color: var(--pp-accent); }
.pp-rel-img { aspect-ratio: 1 / 1; background: #fff; display: block; }
.pp-rel-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-rel-body { padding: 14px 16px 16px; display: grid; gap: 6px; }
.pp-rel-title { font-weight: 700; font-size: 0.95rem; line-height: 1.7; }
.pp-rel-price { font-size: 0.92rem; color: var(--pp-accent-deep); font-weight: 800; }
.pp-rel-price del { color: var(--pp-muted); font-weight: 400; margin-inline-end: 6px; }
.pp-rel-price ins { text-decoration: none; }

/* mobile purchase bar */
.pp-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--pp-line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  display: none; align-items: center; justify-content: space-between; gap: 14px;
  transform: translateY(100%); visibility: hidden;
}
.pp-bar.is-on { transform: none; visibility: visible; }
.pp-bar-price { font-weight: 800; font-size: 1.05rem; line-height: 1.5; }
.pp-bar-price .woocommerce-Price-currencySymbol { font-size: 0.78rem; font-weight: 500; }
.pp-product button.pp-bar-btn { flex: 0 0 auto; padding-inline: 24px; }

/* lightbox */
.pp-lightbox {
  position: fixed; inset: 0; z-index: 100000; background: rgba(27, 40, 37, 0.88);
  display: grid; place-items: center; padding: 24px;
}
.pp-lightbox img { max-width: min(92vw, 1100px); max-height: 88vh; border-radius: 10px; background: #fff; }
.pp-lightbox-close {
  position: absolute; top: 16px; inset-inline-start: 16px; width: 44px; height: 44px;
  border-radius: 50%; border: 0; background: #fff; color: #1B2825; font-size: 1.6rem;
  line-height: 1; cursor: pointer; padding: 0; box-shadow: none; min-height: 0;
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .pp-related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .pp-hero { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .pp-gallery { position: static; }
  .pp-bar { display: flex; }
  .pp-product { padding-bottom: 92px; }
  .pp-panel { padding: 18px; }
}
@media (max-width: 480px) {
  .pp-wrap { padding-inline: 14px; }
  .pp-thumbs button { width: 60px; height: 60px; }
  .pp-prose > table:not(:has(td:nth-child(3))) { max-width: none; }
}

/* ---------- product image zoom controls ---------- */
.pp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(15, 24, 22, 0.94);
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 60px 20px 24px;
}

.pp-lightbox .pp-lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  user-select: none;
  touch-action: none;
  transform-origin: center center;
  transition: transform 0.12s ease-out;
  will-change: transform;
}

.pp-lightbox-controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  direction: ltr;
}

.pp-lightbox .pp-lightbox-control,
.pp-lightbox .pp-lightbox-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #1b2825;
  font-size: 25px;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
}

.pp-lightbox .pp-lightbox-control:hover,
.pp-lightbox .pp-lightbox-close:hover {
  background: #e4f0ec;
  color: #2a6359;
}

.pp-lightbox .pp-lightbox-control:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pp-lightbox .pp-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 30px;
}

@media (max-width: 600px) {
  .pp-lightbox {
    padding: 56px 10px 90px;
  }

  .pp-lightbox .pp-lightbox-image {
    max-width: 96vw;
    max-height: 78vh;
  }

  .pp-lightbox-controls {
    bottom: 18px;
  }

  .pp-lightbox .pp-lightbox-control,
  .pp-lightbox .pp-lightbox-close {
    width: 42px;
    height: 42px;
    min-height: 42px;
  }
}



/* ---------- Single product cart quantity UI ---------- */

.pp-product.pp-cart-js .pp-panel form.cart .single_add_to_cart_button,
.pp-product.pp-cart-js .pp-panel form.cart .quantity {
    display: none !important;
}

.pp-cart-ui[hidden],
.pp-cart-stepper[hidden],
.pp-cart-add[hidden] {
    display: none !important;
}

.pp-cart-ui {
    margin: 16px 0;
    width: 100%;
}

.pp-cart-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 52px;
    padding: 12px 20px;
    border: 1px solid #02513A;
    border-radius: 13px;
    background: #02513A;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.pp-cart-add:hover {
    background: #03694B;
    box-shadow: 0 7px 18px rgba(2, 81, 58, .18);
    transform: translateY(-1px);
    color: #fff;
}

.pp-cart-add:disabled {
    opacity: .6;
    cursor: wait;
    transform: none;
}

.pp-cart-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-height: 60px;
    padding: 10px 13px;
    border: 1px solid #D8E7DF;
    border-radius: 13px;
    background: #F5F9F6;
}

.pp-cart-caption {
    color: #315D4C;
    font-size: 13px;
    font-weight: 600;
}

.pp-cart-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pp-cart-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid #C8DDD1;
    border-radius: 10px;
    background: #fff;
    color: #02513A;
    font-family: inherit;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}

.pp-cart-controls button:hover:not(:disabled) {
    border-color: #02513A;
    background: #E5F1E9;
}

.pp-cart-controls button:disabled {
    opacity: .5;
    cursor: wait;
}

.pp-cart-quantity {
    min-width: 22px;
    color: #02513A;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.pp-cart-feedback {
    margin: 7px 0 0;
    color: #9A4B20;
    font-size: 12px;
    line-height: 1.8;
}

.pp-cart-feedback:empty {
    display: none;
}

@media (max-width: 549px) {
    .pp-cart-stepper {
        min-height: 56px;
        padding: 9px 11px;
    }

    .pp-cart-controls {
        gap: 9px;
    }

    .pp-cart-controls button {
        width: 34px;
        height: 34px;
    }
}

/* Mobile purchase bar quantity controls */
.pp-bar-cart {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 145px;
}

.pp-bar-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 38px;
    padding: 3px 8px;
    border: 1px solid #02513A;
    border-radius: 9px;
    background: #fff;
    color: #02513A;
}

.pp-bar-stepper[hidden] {
    display: none !important;
}

.pp-bar-stepper button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: #f0f6f3;
    color: #02513A;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.pp-bar-stepper output {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
}

.pp-bar-cart .pp-bar-btn {
    width: 100%;
    min-height: 42px;
    margin: 0;
}

@media (min-width: 769px) {
    .pp-bar-stepper {
        display: none !important;
    }
}