/* ============================================================
   تطبیق‌های وردپرس
   تصاویر واقعی جای گرادیان‌های طراحی اولیه می‌نشینند،
   پس تنظیمات background و پوشش تیره اینجا اضافه می‌شود.
   ============================================================ */

/* --- کارت محصول: تصویر شاخص --- */
.product-img[style*="background-image"],
.portfolio-img[style*="background-image"],
.pd-main[style*="background-image"],
.pd-thumb[style*="background-image"] {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* آیکون روی تصویر واقعی خوانا نیست — کم‌رنگ می‌شود */
.product-img[style*="background-image"]::after,
.portfolio-img[style*="background-image"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.product-img[style*="background-image"] i,
.pd-main[style*="background-image"] i {
  opacity: 0.18;
}

/* ============================================================
   اصلاحات موبایل
   ============================================================ */

/* هیچ عنصری نباید اسکرول افقی بسازد */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

/* تصاویر و جدول‌ها از عرض صفحه بیرون نزنند */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* جدول مشخصات در موبایل اسکرول داخلی داشته باشد، نه کل صفحه */
@media (max-width: 768px) {
  .spec-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/*
   منوی موبایل: طراحی اصلی فقط زیر ۷۶۸px آن را فعال می‌کند،
   ولی منوی افقی با ۵ آیتم و دکمه CTA زیر ~۱۰۰۰px جا نمی‌شود
   و سرریز افقی می‌سازد.
*/
@media (max-width: 1000px) {
  .nav-links {
    display: none;
  }
  .nav-cta {
    display: none;
  }
  .menu-toggle {
    display: flex;
  }
}

/* منوی کشویی موبایل که app.js می‌سازد — آیتم‌های وردپرس داخلش */
.mobile-nav li.menu-item {
  list-style: none;
}
.mobile-nav ul {
  margin: 0;
  padding: 0;
}

/*
   نوار بالای هدر در موبایل: باید در یک خط بماند، وگرنه ارتفاع هدر
   عوض می‌شود و محتوای صفحات زیر هدر ثابت می‌افتد.
*/
@media (max-width: 600px) {
  .topbar-inner {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 10px;
  }
  .topbar-right {
    gap: 10px;
    overflow: hidden;
  }
  /* ایمیل در عرض کم جا نمی‌شود */
  .topbar-right a[href^="mailto"] {
    display: none;
  }
  .topbar-left {
    flex-shrink: 0;
  }
}

/*
   نوار بردکرامب صفحه محصول: padding بالای آن ۱۲۲px ثابت نوشته شده تا
   زیر هدر ثابت نیفتد. در موبایل محتوای نوار بالا در دو خط می‌شکند و
   هدر بلندتر می‌شود، پس این عدد کافی نیست و بردکرامب زیر هدر می‌رود.

   با هم‌ترازکردن topbar در موبایل، ارتفاع هدر ثابت می‌ماند.
*/
@media (max-width: 600px) {
  .breadcrumb-bar {
    padding-top: 80px;
  }
  .breadcrumb {
    font-size: 0.78rem;
    gap: 6px;
  }
}

/* --- ستون کناری تک‌محصول: فاصله بین کارت‌ها --- */
.pinfo-grid > aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- گالری تک‌محصول --- */
.pd-main[style*="background-image"] {
  background-color: var(--dark-2);
}

.pd-thumb[style*="background-image"] {
  background-color: var(--dark-2);
  border-color: transparent;
}
.pd-thumb.active {
  border-color: var(--primary);
}
.pd-thumb[style*="background-image"] i {
  display: none;
}

/* --- عنوان محصول داخل کارت: لینک باید رنگ ارثی بگیرد --- */
.product-card h3 a,
.portfolio-card h3 a {
  color: inherit;
  text-decoration: none;
}
.product-card h3 a:hover,
.portfolio-card h3 a:hover {
  color: var(--primary);
}

/* ============================================================
   صفحه دسته محصول — خوانایی عنوان‌ها و نوار آمار
   ============================================================ */

/* پس‌زمینه مستقل، حتی اگر لایه تزئینی دیرتر رندر شود. */
.tax-product_cat .stats-section {
  background: linear-gradient(135deg, #1a1e22 0%, #212529 50%, #1a1e22 100%);
}

.tax-product_cat .stat-lbl {
  display: block;
  min-height: 1.5em;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  opacity: 1;
  visibility: visible;
}

/* عنوان همه سکشن‌های روشن باید مستقل از رنگ‌های ارثی خوانا بماند. */
.tax-product_cat .section-header h2,
.tax-product_cat .section-header .certs-title {
  display: block;
  color: var(--text);
  opacity: 1;
  visibility: visible;
}

/* ============================================================
   تیک چک‌باکس فیلترها
   طراحی اصلی از گلیف Font Awesome استفاده می‌کرد که پروژه
   ندارد؛ نتیجه یک مربع سبز خالی بود. اینجا تیک با border
   ساخته می‌شود — بدون فونت و بدون تصویر.
   ============================================================ */

.f-box::after {
  content: "";
  font-family: inherit;

  /* دو ضلع از یک مربع، چرخیده = تیک */
  width: 5px;
  height: 9px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  border-radius: 1px;

  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg) scale(0);
  transform-origin: center;
}

.f-row input:checked + .f-box::after {
  transform: translate(-50%, -50%) rotate(45deg) scale(1);
}

/* همان مشکل در دایره‌های رنگ — تیک روی رنگ انتخاب‌شده */
.color-dot.active::after {
  content: "";
  font-family: inherit;
  mix-blend-mode: normal;

  width: 5px;
  height: 9px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  border-radius: 1px;

  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);

  /* روی رنگ‌های روشن، تیک سفید دیده نمی‌شود */
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.55));
}

/* ============================================================
   فیلتر کاتالوگ صفحه اصلی
   با کلاس CSS کار می‌کند نه انیمیشن jQuery — روی موبایل هم روان است.
   ============================================================ */

.products-grid .product-card {
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.products-grid .product-card.is-hidden {
  display: none;
}

/* ============================================================
   صفحه ۴۰۴ — جعبه جستجو
   ============================================================ */

.e404-search {
  max-width: 620px;
  margin: 48px auto 0;
  padding: 32px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.e404-search h3 {
  margin: 0 0 18px;
  font-size: 1.05rem;
  color: var(--text);
}

.e404-search form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.e404-search input[type="search"] {
  flex: 1 1 240px;
  min-width: 0;
  padding: 13px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}

.e404-search input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.e404-search .btn {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .e404-search .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   نقشه با بارگذاری دستی
   iframe گوگل تا قبل از کلیک لود نمی‌شود — هم سریع‌تر است،
   هم صفحه به سرویس خارجی وابسته نمی‌ماند.
   ============================================================ */

.alper-map {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
}

.alper-map-load {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  min-height: 320px;
  padding: 32px 24px;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-mid);
  transition: background var(--transition);
}

.alper-map-load:hover {
  background: var(--white);
}

.alper-map-load i {
  font-size: 2.4rem;
  color: var(--primary);
}

.alper-map-load span {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.alper-map-load small {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================================
   فرم ثبت دیدگاه
   ============================================================ */

.review-form-wrap {
  max-width: 720px;
  margin: 40px auto 0;
  padding: 32px 28px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.review-form-title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  color: var(--text);
}

.alper-review-form p {
  margin: 0 0 18px;
}

.alper-review-form label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.alper-review-form .required {
  color: var(--red);
}

.alper-review-form input[type="text"],
.alper-review-form input[type="email"],
.alper-review-form textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    border-color var(--transition),
    background var(--transition);
}

.alper-review-form input:focus,
.alper-review-form textarea:focus {
  outline: none;
  background: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.alper-review-form textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.9;
}

.alper-review-form .form-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -8px;
}

.alper-review-form .form-submit {
  margin-bottom: 0;
}
.alper-review-form .form-submit input[type="submit"] {
  cursor: pointer;
}

/* دو ستونه: نام و ایمیل کنار هم */
@media (min-width: 640px) {
  .alper-review-form .comment-form-author,
  .alper-review-form .comment-form-email {
    display: inline-block;
    width: calc(50% - 8px);
    vertical-align: top;
  }
  .alper-review-form .comment-form-author {
    margin-inline-end: 12px;
  }
}

/* --- ستاره‌های امتیازدهی --- */
.comment-form-rating .alper-stars {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 4px;
}
.comment-form-rating .alper-stars input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.comment-form-rating .alper-stars label {
  margin: 0;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--gray);
  transition:
    color 0.15s ease,
    transform 0.15s ease;
}
.comment-form-rating .alper-stars label:hover,
.comment-form-rating .alper-stars label:hover ~ label,
.comment-form-rating .alper-stars input:checked ~ label {
  color: #f5b622; /* همان رنگ ستاره‌های طراحی اصلی */
}
.comment-form-rating .alper-stars label:hover {
  transform: scale(1.12);
}
.comment-form-rating .alper-stars input:focus-visible + label {
  outline: 2px solid var(--primary);
  border-radius: 4px;
}

/* --- پیام ورود لازم --- */
.review-login-note {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 720px;
  margin: 36px auto 0;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--primary);
  border-radius: var(--radius);
}
.review-login-note i {
  font-size: 1.4rem;
  color: var(--primary);
  flex-shrink: 0;
}
.review-login-note p {
  margin: 0;
  color: var(--text-mid);
}
.review-login-note a {
  color: var(--primary);
  font-weight: 700;
}

/* --- منوی وردپرس در هدر: حذف استایل پیش‌فرض لیست --- */
.nav-links li.menu-item {
  list-style: none;
}

/* --- برگه‌های عمومی وردپرس --- */
.entry-content {
  line-height: 2;
  color: var(--text-mid);
}
.entry-content h2,
.entry-content h3 {
  color: var(--text);
  margin: 28px 0 12px;
}
.entry-content p {
  margin-bottom: 16px;
}
.entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.entry-content ul,
.entry-content ol {
  margin: 0 24px 16px 0;
}
.entry-content li {
  margin-bottom: 8px;
}

/* محتوای ویرایشگر دیداری در سکشن داستان صفحه درباره ما */
.story-body h2,
.story-body h3,
.story-body h4 {
  color: var(--text);
  line-height: 1.5;
  margin: 24px 0 10px;
}
.story-body h2 { font-size: 1.45rem; }
.story-body h3 { font-size: 1.2rem; }
.story-body h4 { font-size: 1.05rem; }
.story-body ul,
.story-body ol {
  margin: 0 22px 18px 0;
  color: var(--text-mid);
}
.story-body li { margin-bottom: 7px; }
.story-body blockquote {
  margin: 20px 0;
  padding: 12px 18px;
  border-inline-start: 3px solid var(--primary);
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.story-body a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* تصویر آپلودی اعضای تیم */
.team-avatar.has-image {
  overflow: hidden;
  background: var(--surface);
}
.team-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* تصاویر قابل انتخاب کارت‌های صفحه اصلی */
.cat-icon-wrap.has-image {
  overflow: hidden;
  background: var(--surface);
}
.cat-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.why-icon.has-image {
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(0,0,0,0.14);
}
.why-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about-card-media {
  width: 150px;
  height: 150px;
  margin: 0 auto 22px;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
}
.about-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
