/* ----------------------------------------------------
   فونت‌های فارسی
---------------------------------------------------- */
@font-face {
  font-family: 'Vazir';
  src: url('../fonts/Vazir.woff2') format('woff2'),
       url('../fonts/Vazir.ttf') format('truetype');
}
@font-face {
  font-family: 'IRANSans';
  src: url('../fonts/IRANSans.woff2') format('woff2'),
       url('../fonts/IRANSans.ttf') format('truetype');
}
@font-face {
  font-family: 'YekanWeb';
  src: url('../fonts/YekanWeb-Bold.woff') format('woff');
  font-weight: bold;
}

/* ----------------------------------------------------
   متغیرهای برند و پایه
---------------------------------------------------- */
:root {
  --brand-green-dark: #3f5629;
  --brand-green: #6cae75;
  --brand-green-light: #d8f0c1;
  --brand-red: #e63946;
  --hover-pink: #fae9ee; /* صورتی لطیف‌تر و خنثی‌تر */

  --text-light: #f0f4f8;
  --max-width: 1280px;
}

/* ----------------------------------------------------
   بدنه و تایپوگرافی عمومی
---------------------------------------------------- */
body {
  font-family: 'Vazir', 'IRANSans', 'YekanWeb', sans-serif;
  background-color: #f9fafb;
  color: var(--text-dark);
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
p, a, input, button, textarea, select, footer {
  font-family: inherit;
}

/* ----------------------------------------------------
   هدر (ساختار کلی)
---------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ----------------------------------------------------
   نوار خاکستری بالا (Topbar) - فقط دسکتاپ
---------------------------------------------------- */
header .topbar {
  background-color: #f3f3f3;
  font-size: 0.8rem;
  padding: 0.4rem 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

header .topbar-inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* لینک‌های ثانویه بالا */
header .topbar .secondary-links {
  display: flex;
  gap: 1.2rem;
}

header .topbar .secondary-links a {
  color: var(--text-dark);
  text-decoration: none;
  transition: color 0.25s ease;
}

header .topbar .secondary-links a:hover {
  color: var(--brand-red);
}

/* بخش راست/چپ تاپ‌بار */
header .topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* مخفی‌سازی نوار خاکستری در موبایل */
@media (max-width: 767px) {
  header .topbar {
    display: none;
  }
}

/* ----------------------------------------------------
   نوار سفید اصلی (Mainbar) - فقط دسکتاپ
   نکته: ارتفاع ثابت و کشیدن آیتم‌ها برای پوشش کامل هاور
---------------------------------------------------- */
header .mainbar {
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  position: relative;
  height: 84px;                 /* ارتفاع ثابت برای کنترل دقیق */
  display: flex;
  align-items: center;
}

header .mainbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  height: 100%;                  /* اضافه شد: inherit از .mainbar */
  display: flex;
  justify-content: space-between;
  align-items: stretch;          /* آیتم‌ها کل ارتفاع را بگیرند */
  padding-inline: 2rem;          /* فقط پدینگ افقی، بدون پدینگ عمودی */
  box-sizing: border-box;        /* اطمینان از عدم تجاوز پدینگ از ارتفاع */
}

/* لوگو */
header .logo-wrapper {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 2;
}

body.rtl header .logo-wrapper { right: 0.3rem; }
body.ltr header .logo-wrapper { left: 0.3rem; }

header .logo-wrapper img { height: 48px; }

header .logo-wrapper .tagline {
  font-size: 0.7rem;
  color: #6b7280;
  line-height: 1;
}

/* مخفی‌سازی نوار سفید در موبایل */
@media (max-width: 767px) {
  header .mainbar {
    display: none;
  }
}
/* ----------------------------------------------------
   منو + سرچ
---------------------------------------------------- */
header .nav-main {
  display: flex;
  align-items: stretch;   /* کل ارتفاع هدر */
  gap: 3rem;
  flex-grow: 1;
  justify-content: flex-start;
  min-width: 0;
  height: 100%;           /* اضافه شد: inherit از .mainbar-inner */
  box-sizing: border-box; /* اطمینان از عدم تجاوز پدینگ */
}

header .main-menu {
  display: flex;
  gap: 2.2rem;
  font-weight: 500;
  font-size: 0.95rem;
  align-items: stretch;   /* آیتم‌ها کل ارتفاع را بگیرند */
  height: 100%;           /* برابر با ارتفاع هدر */
  min-width: 0;
  box-sizing: border-box; /* اضافه شد برای کنترل دقیق */
}

body.ltr header .main-menu { margin-left: 3.6rem; }
body.rtl header .main-menu { margin-right: 3.6rem; }

/* آیتم منو با ارتفاع کامل */
header .main-menu-item {
  position: relative;
  height: 100%;          /* کل ارتفاع هدر */
  display: flex;         /* برای کشیدن لینک داخلش */
  align-items: stretch;  /* لینک داخل آیتم هم کشیده شود */
  box-sizing: border-box;/* جلوگیری از تاثیر پدینگ/بوردر روی ارتفاع */
}

/* لینک‌های منو اصلی */
header .main-menu a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;              /* لینک‌ها کل ارتفاع آیتم را بگیرند */
  padding: 0 0.8rem;
  color: var(--text-dark);
  text-decoration: none;
  gap: 0.35rem;
  border-radius: 0;          /* کاملاً مستطیلی */
  background-color: transparent;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* هاور روی لینک‌های منو */
header .main-menu a:hover {
  background-color: var(--hover-pink); /* کل ارتفاع آیتم صورتی شود */
  color: var(--text-dark);
}

/* ----------------------------------------------------
   فلش زیرمنو
---------------------------------------------------- */
header .main-menu a.has-submenu::after {
  content: '';
  width: 14px;
  height: 14px;
  background-image: url('/assets/icons/down.svg');
  background-size: contain;
  background-repeat: no-repeat;
  margin-inline-start: 4px;
  transition: transform 0.2s ease, filter 0.2s ease;
  filter: brightness(0); /* رنگ سیاه */
}

/* هنگام هاور: فلش بچرخد به بالا */
header .main-menu-item:hover > a.has-submenu::after {
  transform: rotate(180deg);
  filter: brightness(0);
}

/* ----------------------------------------------------
   آیکون جستجو دسکتاپ
---------------------------------------------------- */
#desktopSearchBtn {
  width: 32px;
  height: 100%;                      /* کل ارتفاع هدر */
  background-image: url('/assets/icons/search.svg');
  background-size: 70%;              /* آیکون متناسب با دکمه */
  background-repeat: no-repeat;
  background-position: center;       /* وسط عمودی و افقی */
  border: none;
  background-color: transparent;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

body.ltr header .nav-main { margin-right: 0.3rem; }
body.rtl header .nav-main { margin-left: 0.3rem; }

#desktopSearchBtn:hover { opacity: 0.7; }
/* فرم جستجو دسکتاپ */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: white;
  border-top: 1px solid #eee;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  z-index: 999;
}

.search-dropdown.open {
  max-height: 300px; /* یا بیشتر اگر محتوا زیاد باشد */
  opacity: 1;
  pointer-events: auto;
}
/* ----------------------------------------------------
   فونت‌های فارسی
---------------------------------------------------- */
@font-face {
  font-family: 'Vazir';
  src: url('../fonts/Vazir.woff2') format('woff2'),
       url('../fonts/Vazir.ttf') format('truetype');
}
@font-face {
  font-family: 'IRANSans';
  src: url('../fonts/IRANSans.woff2') format('woff2'),
       url('../fonts/IRANSans.ttf') format('truetype');
}
@font-face {
  font-family: 'YekanWeb';
  src: url('../fonts/YekanWeb-Bold.woff') format('woff');
  font-weight: bold;
}

/* ----------------------------------------------------
   متغیرهای برند و پایه
---------------------------------------------------- */
:root {
  --brand-green-dark: #3f5629;
  --brand-green: #6cae75;
  --brand-green-light: #d8f0c1;
  --brand-red: #e63946;
  --hover-pink: #fae9ee;

  --text-dark: #1f2937;   /* اضافه شد */
  --text-light: #f0f4f8;
  --max-width: 1280px;
}

/* ----------------------------------------------------
   بدنه و تایپوگرافی عمومی
---------------------------------------------------- */
body {
  font-family: 'Vazir', 'IRANSans', 'YekanWeb', sans-serif;
  background-color: #f9fafb;
  color: var(--text-dark);
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
p, a, input, button, textarea, select, footer {
  font-family: inherit;
}

/* ----------------------------------------------------
   هدر (ساختار کلی)
---------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ----------------------------------------------------
   نوار خاکستری بالا (Topbar) - فقط دسکتاپ
---------------------------------------------------- */
header .topbar {
  background-color: #f3f3f3;
  font-size: 0.8rem;
  padding: 0.4rem 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

header .topbar-inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header .topbar .secondary-links {
  display: flex;
  gap: 1.2rem;
}

header .topbar .secondary-links a {
  color: var(--text-dark);
  text-decoration: none;
  transition: color 0.25s ease;
}

header .topbar .secondary-links a:hover {
  color: var(--brand-red);
}

header .topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 767px) {
  header .topbar {
    display: none;
  }
}

/* ----------------------------------------------------
   نوار سفید اصلی (Mainbar) - فقط دسکتاپ
---------------------------------------------------- */
header .mainbar {
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  position: relative;
  height: 84px;
  display: flex;
  align-items: center;
}

header .mainbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding-inline: 2rem;
  box-sizing: border-box;
}

header .logo-wrapper {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 2;
}

body.rtl header .logo-wrapper { right: 0.3rem; }
body.ltr header .logo-wrapper { left: 0.3rem; }

header .logo-wrapper img { height: 48px; }

header .logo-wrapper .tagline {
  font-size: 0.7rem;
  color: #6b7280;
  line-height: 1;
}

@media (max-width: 767px) {
  header .mainbar {
    display: none;
  }
}
/* ----------------------------------------------------
   منو + سرچ
---------------------------------------------------- */
header .nav-main {
  display: flex;
  align-items: stretch;
  gap: 3rem;
  flex-grow: 1;
  justify-content: flex-start;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  position: relative; /* اضافه شد برای کنترل dropdown */
}

header .main-menu {
  display: flex;
  gap: 2.2rem;
  font-weight: 500;
  font-size: 0.95rem;
  align-items: stretch;
  height: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body.ltr header .main-menu { margin-left: 3.6rem; }
body.rtl header .main-menu { margin-right: 3.6rem; }

header .main-menu-item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
}

header .main-menu a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 0.8rem;
  color: var(--text-dark);
  text-decoration: none;
  gap: 0.35rem;
  border-radius: 0;
  background-color: transparent;
  transition: background-color 0.2s ease, color 0.2s ease;
}

header .main-menu a:hover {
  background-color: var(--hover-pink);
  color: var(--text-dark);
}

/* فلش زیرمنو */
header .main-menu a.has-submenu::after {
  content: '';
  width: 14px;
  height: 14px;
  background-image: url('/assets/icons/down.svg');
  background-size: contain;
  background-repeat: no-repeat;
  margin-inline-start: 4px;
  transition: transform 0.2s ease, filter 0.2s ease;
  filter: brightness(0);
}

header .main-menu-item:hover > a.has-submenu::after {
  transform: rotate(180deg);
  filter: brightness(0);
}

/* ----------------------------------------------------
   آیکون جستجو دسکتاپ
---------------------------------------------------- */
#desktopSearchBtn {
  width: 32px;
  height: 100%;
  background-image: url('/assets/icons/search.svg');
  background-size: 70%;
  background-repeat: no-repeat;
  background-position: center;
  border: none;
  background-color: transparent;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

body.ltr header .nav-main { margin-right: 0.3rem; }
body.rtl header .nav-main { margin-left: 0.3rem; }

#desktopSearchBtn:hover { opacity: 0.7; }

/* فرم جستجو دسکتاپ */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: white;
  border-top: 1px solid #eee;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 0;
  opacity: 0;
  visibility: hidden; /* اضافه شد */
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.4s ease, opacity 0.3s ease, visibility 0.3s ease;
  z-index: 999;
}

.search-dropdown.open {
  max-height: 300px;
  opacity: 1;
  visibility: visible; /* اضافه شد */
  pointer-events: auto;
}

/* ----------------------------------------------------
   مگامنو دسکتاپ
---------------------------------------------------- */
header .main-menu-item:hover .submenu-desktop {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.submenu-desktop {
  position: absolute;
  top: 100%;
  background-color: #ffffff;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-radius: 0;
  display: none;
  z-index: 999;
  width: auto;
  min-width: 100%;
  max-width: 880px;
  box-sizing: border-box;
}

html[dir="ltr"] .submenu-desktop { left: 0; right: auto; }
html[dir="rtl"] .submenu-desktop { right: 0; left: auto; }

.submenu-desktop .submenu-links {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.submenu-desktop .submenu-links a {
  display: block;
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  color: var(--text-dark);
  text-decoration: none;
  border-radius: 0;
  transition: color 0.2s ease;
  white-space: normal;
  word-break: break-word;
}

.submenu-desktop .submenu-links a:hover {
  background-color: transparent;
  color: var(--brand-red);
}

.submenu-desktop .submenu-image {
  flex: 0 0 180px;
  max-width: 180px;
}

.submenu-desktop .submenu-image img {
  width: 100%;
  height: auto;
  border-radius: 0;
  object-fit: cover;
  display: block;
}
/* ----------------------------------------------------
   نسخه موبایل (Mobile Menu)
---------------------------------------------------- */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  padding: 2rem;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  z-index: 200;
  overflow-y: auto;
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-menu .main-links a {
  display: block;
  padding: 1rem 0;
  font-size: 1.05rem;
  color: var(--text-dark);
  text-decoration: none;
  border-bottom: 1px solid #eee;
  position: relative;
}

.mobile-menu .main-links a.has-submenu {
  position: relative;
}

.mobile-menu .main-links a.has-submenu::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  width: 12px;
  height: 12px;
  background-image: url('/assets/icons/up.svg');
  background-size: contain;
  background-repeat: no-repeat;
  filter: brightness(0) saturate(100%);
}

html[dir="ltr"] .mobile-menu .main-links a.has-submenu::after {
  right: 0;
  left: auto;
}

html[dir="rtl"] .mobile-menu .main-links a.has-submenu::after {
  left: 0;
  right: auto;
}

.mobile-menu .secondary-links a {
  display: block;
  padding: 0.9rem 0;
  font-size: 0.95rem;
  color: var(--text-dark);
  border-bottom: 1px solid #e5e5e5;
  text-decoration: none;
}

#closeMenu {
  background: none;
  border: none;
  cursor: pointer;
}

#searchBtn {
  width: 26px;
  height: 26px;
  background-image: url('/assets/icons/search.svg');
  background-size: contain;
  background-repeat: no-repeat;
  border: none;
  background-color: transparent;
  cursor: pointer;
}

/* ----------------------------------------------------
   فوتر سه‌ستونه
---------------------------------------------------- */
footer {
  background-color: #ffffff;
  color: var(--text-dark);
  padding: 3rem 1.5rem;
  font-size: 0.9rem;
}

footer .footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  footer .footer-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

footer h3 {
  font-weight: bold;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

footer a {
  color: var(--text-dark);
  text-decoration: none;
  transition: color 0.25s ease;
}

footer a:hover {
  color: var(--brand-red);
}

footer .footer-bottom {
  border-top: 1px solid #ddd;
  margin-top: 2rem;
  padding-top: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dark);
}

footer .footer-button {
  background-color: var(--brand-red);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: inline-block;
  margin: 0.3rem 0.5rem 0 0;
  font-weight: 500;
  transition: background-color 0.25s ease;
}

footer .footer-button:hover {
  background-color: #000;
  color: #ffffff;
}

/* ----------------------------------------------------
   Hero Section
---------------------------------------------------- */
#hero {
  height: 65vh;
}

@media (min-width: 1024px) {
  #hero {
    height: 50vh;
  }
}

@media (max-width: 767px) {
  #hero {
    height: 44vh;
  }
}

#hero .overlay h1 { margin-bottom: 1rem; }
#hero .overlay a  { margin-bottom: 1rem; }

/* ----------------------------------------------------
   زیرمنو موبایل
---------------------------------------------------- */
.submenu-mobile {
  background-color: var(--hover-pink);
  border-radius: 6px;
  padding: 0 12px;
  border-left: none;
  border-right: none;
}

.submenu-mobile a {
  display: block;
  padding: 8px 0;
  font-size: 0.85rem;
  color: var(--text-dark);
  border-bottom: 1px solid rgba(0,0,0,0.1); /* کمی تیره‌تر برای خوانایی */
  transition: color 0.2s ease;
}

.submenu-mobile a:last-child {
  border-bottom: 0;
}

.submenu-mobile a:hover {
  color: var(--brand-red);
}

.menu-item.open .submenu-arrow {
  transform: rotate(180deg);
}

.mobile-menu.rtl .submenu-mobile {
  border-left: none;
  border-right: none;
}
