/*
 * Persian Book Shop - Minimal, classy frontend styles
 * Scope: single product (book details, editions selector, binding selector)
 */

:root {
  --pb-accent: #830000;
  --pb-ink: #111827;
  --pb-muted-ink: #6b7280;
  --pb-surface: #ffffff;
  --pb-subtle: #f8fafc;
  --pb-border: rgba(17, 24, 39, 0.12);
  --pb-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --pb-radius-lg: 18px;
  --pb-radius-md: 14px;
  --pb-radius-sm: 12px;
  --pb-focus: 0 0 0 3px rgba(131, 0, 0, 0.18);
}

/* -------------------------------------------------------------------------
 * Product archives (shop / tax archives): year filter + sorting bar
 * ---------------------------------------------------------------------- */

.pb-bookshop-archive-filters-wrap {
  direction: rtl;
  text-align: right;
  margin: 14px 0 18px;
}

.pb-bookshop-archive-filters {
  margin: 0;
}

.pb-bookshop-archive-filters .pb-af-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 14px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 24, 39, 0.10);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(10px);
}

.pb-bookshop-archive-filters .pb-af-item {
  display: grid;
  gap: 6px;
}

.pb-bookshop-archive-filters .pb-af-label {
  font-size: 12px;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.72);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pb-bookshop-archive-filters .pb-af-hint {
  font-size: 11px;
  font-weight: 800;
  color: rgba(131, 0, 0, 0.85);
  background: rgba(131, 0, 0, 0.10);
  border: 1px solid rgba(131, 0, 0, 0.18);
  padding: 2px 8px;
  border-radius: 999px;
}

.pb-bookshop-archive-filters .pb-af-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pb-bookshop-archive-filters input,
.pb-bookshop-archive-filters select {
  height: 42px;
  padding: 0 12px;
  border-radius: 16px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: rgba(255, 255, 255, 0.96);
  outline: none;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.04);
}

.pb-bookshop-archive-filters input:focus,
.pb-bookshop-archive-filters select:focus {
  border-color: rgba(131, 0, 0, 0.28);
  box-shadow: var(--pb-focus);
}

.pb-bookshop-archive-filters .pb-af-year-from,
.pb-bookshop-archive-filters .pb-af-year-to {
  width: 110px;
}

.pb-bookshop-archive-filters .pb-af-sep {
  font-size: 12px;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.55);
  padding: 0 2px;
}

.pb-bookshop-archive-filters .pb-af-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
}

.pb-bookshop-archive-filters .pb-af-apply {
  height: 42px;
  padding: 0 14px;
  border-radius: 16px;
  border: 0;
  cursor: pointer;
  background: rgba(17, 24, 39, 0.90);
  color: #fff;
  font-weight: 800;
}

.pb-bookshop-archive-filters .pb-af-reset {
  height: 42px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: rgba(0, 0, 0, 0.02);
  color: rgba(17, 24, 39, 0.90);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-weight: 800;
}

.pb-bookshop-archive-filters .pb-af-reset:hover {
  background: rgba(0, 0, 0, 0.04);
}

@media (max-width: 680px) {
  .pb-bookshop-archive-filters .pb-af-actions {
    margin-inline-start: 0;
    width: 100%;
  }
  .pb-bookshop-archive-filters .pb-af-apply,
  .pb-bookshop-archive-filters .pb-af-reset {
    flex: 1;
    justify-content: center;
  }
}

/* Base cards */
.pb-bookshop-details-box,
.pb-bookshop-editions-frontend,
.pb-bookshop-binding-box,
.pb-bookshop-order-ebook-downloads,
.pb-bookshop-special-sale-timer {
  direction: rtl;
  text-align: right;
  background: var(--pb-surface);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  padding: 22px;
  margin: 22px 0;
  box-shadow: var(--pb-shadow);
}

/* Section titles */
.pb-bookshop-details-title,
.pb-bookshop-editions-title {
  margin: 0 0 14px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--pb-ink);
  letter-spacing: -0.2px;
}

/* Details list */
.pb-bookshop-details-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pb-bookshop-details-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
  color: var(--pb-ink);
}

.pb-bookshop-details-list li:last-child {
  border-bottom: none;
}

.pb-bookshop-details-list li span {
  font-weight: 700;
  color: var(--pb-muted-ink);
  white-space: nowrap;
}

.pb-bookshop-details-list a {
  color: var(--pb-accent);
  text-decoration: none;
  font-weight: 700;
}

.pb-bookshop-details-list a:hover {
  text-decoration: underline;
}

/* Editions grid */
.pb-bookshop-editions-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.pb-bookshop-edition-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-md);
  background: var(--pb-subtle);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.pb-bookshop-edition-card:hover {
  transform: translateY(-1px);
  border-color: rgba(131, 0, 0, 0.22);
  background: #ffffff;
}

.pb-bookshop-edition-card input[type="radio"] {
  margin: 2px 0 0;
  width: 18px;
  height: 18px;
  accent-color: var(--pb-accent);
  flex: 0 0 auto;
}

.pb-bookshop-edition-inner {
  min-width: 0;
  flex: 1;
}

.pb-bookshop-edition-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--pb-ink);
  line-height: 1.4;
}

.pb-bookshop-edition-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: rgba(255, 255, 255, 0.65);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pb-muted-ink);
}

.pb-bookshop-edition-price {
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--pb-accent);
}

/* Woo-style sale formatting inside edition cards */
.pb-bookshop-edition-price del {
  opacity: 0.65;
  margin-inline-end: 6px;
}

.pb-bookshop-edition-price ins {
  text-decoration: none;
}

/* Zero-price editions: show plain text inside the card (CTA appears below the selector). */
.pb-bookshop-edition-no-price {
  color: var(--pb-muted-ink);
  font-weight: 900;
}

/* Zero-price editions: show a compact call button */
.pb-bookshop-edition-call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 900;
}

.pb-bookshop-edition-call-box {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  background: #fff;
  box-shadow: var(--pb-shadow);
}

.pb-bookshop-edition-call-box .button {
  width: 100%;
  text-align: center;
}

/* Selected edition visual state (handled by JS) */
.pb-bookshop-edition-card.selected {
  background: #ffffff;
  border-color: rgba(131, 0, 0, 0.45);
  box-shadow: 0 0 0 2px rgba(131, 0, 0, 0.08);
}

.pb-bookshop-edition-card:focus-within {
  outline: none;
  box-shadow: var(--pb-focus);
}

/* Binding selector */
.pb-bookshop-binding-box label {
  display: block;
  margin: 0 0 10px;
  font-weight: 800;
  color: var(--pb-ink);
}

.pb-bookshop-binding-box select {
  width: 100%;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: var(--pb-radius-sm);
  background-color: #ffffff;
  color: var(--pb-ink);
  font-size: 0.95rem;
  font-weight: 700;
  direction: rtl;
  text-align: right;
  text-align-last: right;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 16px;
  padding-left: 44px;
}

.pb-bookshop-binding-box select:focus {
  outline: none;
  border-color: rgba(131, 0, 0, 0.55);
  box-shadow: var(--pb-focus);
}

.pb-bookshop-binding-box select option {
  direction: rtl;
}

.pb-bookshop-binding-selected {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: #ffffff;
  color: var(--pb-ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.pb-bookshop-binding-hint {
  margin: 10px 0 0;
  color: var(--pb-muted-ink);
  font-size: 0.9rem;
}

/* Special sale timer (if used) */
.pb-bookshop-special-sale-timer {
  border-right: 3px solid var(--pb-accent);
  background: #ffffff;
  font-weight: 800;
}

/* Small screens */
@media (max-width: 480px) {
  .pb-bookshop-details-box,
  .pb-bookshop-editions-frontend,
  .pb-bookshop-binding-box,
  .pb-bookshop-order-ebook-downloads,
  .pb-bookshop-special-sale-timer {
    padding: 16px;
    border-radius: 16px;
  }

  .pb-bookshop-editions-list {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------
 * Publishers directory page + publisher archive
 * ---------------------------------------------------------- */

.pb-publishers {
  direction: rtl;
  text-align: right;
  margin: 24px 0;
}

.pb-publishers-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.pb-publishers-search {
  flex: 1;
  max-width: 520px;
  padding: 12px 14px;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: var(--pb-radius-md);
  background: #fff;
  font-size: 0.95rem;
  font-weight: 700;
}

.pb-publishers-search:focus {
  outline: none;
  border-color: rgba(131, 0, 0, 0.55);
  box-shadow: var(--pb-focus);
}

.pb-publishers-status {
  color: var(--pb-muted-ink);
  font-weight: 800;
  font-size: 0.92rem;
}

.pb-publishers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.pb-publisher-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: var(--pb-surface);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  overflow: hidden;
  box-shadow: var(--pb-shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.pb-publisher-card:hover {
  transform: translateY(-1px);
  border-color: rgba(131, 0, 0, 0.22);
}

.pb-publisher-card:focus {
  outline: none;
  box-shadow: var(--pb-focus);
}

.pb-publisher-card-media {
  position: relative;
  padding-top: 62%;
  background: var(--pb-subtle);
}

.pb-publisher-card-media img,
.pb-publisher-card-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pb-publisher-card-placeholder {
  background: linear-gradient(135deg, rgba(131, 0, 0, 0.10), rgba(17, 24, 39, 0.06));
}

.pb-publisher-card-body {
  padding: 14px 14px 16px;
}

.pb-publisher-name {
  color: var(--pb-ink);
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.35;
  margin: 0 0 8px;
}

.pb-publisher-count {
  color: var(--pb-muted-ink);
  font-weight: 800;
  font-size: 0.92rem;
}

.pb-publishers-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pb-publishers-load-more {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.18);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.pb-publishers-load-more:hover {
  border-color: rgba(131, 0, 0, 0.30);
}

.pb-publishers-loading {
  color: var(--pb-muted-ink);
  font-weight: 800;
}

/* Publisher archive header */
.pb-publisher-archive {
  direction: rtl;
  text-align: right;
  margin: 16px 0 28px;
}

.pb-publisher-archive-header {
  padding: 16px 0;
}

.pb-publisher-archive-inner {
  display: flex;
  gap: 16px;
  align-items: center;
}

.pb-publisher-archive-media {
  flex: 0 0 auto;
  width: 120px;
  height: 120px;
  border-radius: var(--pb-radius-lg);
  border: 1px solid var(--pb-border);
  overflow: hidden;
  background: var(--pb-subtle);
  box-shadow: var(--pb-shadow);
}

.pb-publisher-archive-media img,
.pb-publisher-archive-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pb-publisher-archive-placeholder {
  background: linear-gradient(135deg, rgba(131, 0, 0, 0.10), rgba(17, 24, 39, 0.06));
}

.pb-publisher-archive-title {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 950;
  color: var(--pb-ink);
}

.pb-publisher-archive-description {
  color: var(--pb-muted-ink);
  font-weight: 700;
}

@media (max-width: 520px) {
  .pb-publishers-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .pb-publisher-archive-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ------------------------------
   Call button (تماس بگیرید)
------------------------------ */

.pb-bookshop-call-box {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  background: #fff;
  box-shadow: var(--pb-shadow);
}

.pb-bookshop-call-hint {
  margin: 10px 0 0;
  color: var(--pb-muted-ink);
  font-weight: 700;
  font-size: 0.95rem;
}

.pb-bookshop-call-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.pb-bookshop-call-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
}

.pb-bookshop-call-modal__dialog {
  position: relative;
  width: min(92vw, 420px);
  margin: 10vh auto;
  background: #fff;
  border-radius: var(--pb-radius-lg);
  border: 1px solid var(--pb-border);
  box-shadow: var(--pb-shadow);
  padding: 16px;
}

.pb-bookshop-call-modal__close {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--pb-border);
  background: #fff;
  cursor: pointer;
  line-height: 28px;
  font-size: 18px;
}

.pb-bookshop-call-modal__title {
  font-weight: 950;
  margin: 0 0 12px;
  color: var(--pb-ink);
}

.pb-bookshop-call-modal__numbers {
  display: grid;
  gap: 10px;
}

.pb-bookshop-call-modal__number {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--pb-border);
  background: var(--pb-subtle);
  text-decoration: none;
  font-weight: 900;
  color: var(--pb-ink);
}

.pb-bookshop-call-modal__number:hover {
  filter: brightness(0.98);
}


/* v1.0.90.140: book archive/search cards — full cover image, title clamp, year/publisher metadata */
.woocommerce ul.products li.product a img,
.woocommerce-page ul.products li.product a img,
.pb-bookshop-loop-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  object-fit: contain !important;
  object-position: center center;
  background: #f8fafc;
  border-radius: 12px;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce-page ul.products li.product .woocommerce-loop-product__title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.55em * 3);
  line-height: 1.55;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  direction: ltr;
  unicode-bidi: plaintext;
}

.pb-bookshop-loop-meta {
  margin: 4px 0 6px;
  font-size: 12px;
  line-height: 1.6;
  color: #64748b;
  min-height: 38px;
}

.pb-bookshop-loop-meta-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pb-bookshop-loop-meta-line span {
  color: #334155;
  font-weight: 800;
}


/* v1.0.90.146: fit full book covers in Woo/category/archive product cards. */
.woocommerce ul.products li.product a img,
.woocommerce-page ul.products li.product a img,
.pb-bookshop-loop-card img {
  object-fit: contain !important;
  object-position: center center !important;
  background: #fff !important;
}

/* v1.0.90.154: compact file-size label beside digital download links. */
.pb-bookshop-ebook-size {
  display: inline-block;
  margin-inline-start: 6px;
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}
