/* =========================================================
   Navbar & Header Styles (navbar.css)
   شامل: هدر، لوگو، منو، سوییچر زبان، سوییچ تم و منوی همبرگری
   ========================================================= */

:root {
  --navbar-height: 60px;
  --navbar-content-gap: 24px;
}

body {
  padding-top: calc(var(--navbar-height) + var(--navbar-content-gap));
}

/* =================== هدر و منوی ناوبری =================== */
.site-header {
  background-color: var(--navbar-bg);
  width: 100%;
  min-height: var(--navbar-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.nav-container {
  max-width: 1200px;
  min-height: var(--navbar-height);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.nav-brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
}

.brand-logo svg {
  width: 30px;
  height: 30px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}

.nav-menu {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 16px;
}

.nav-list a {
  text-decoration: none;
  color: var(--navbar-link-color);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 9px;
  border-radius: 10px;
  transition:
    background-color 0.2s,
    transform 0.2s;
}

.nav-list a:hover {
  background-color: var(--menu-hover-bg);
  transform: translateY(-1px);
}

/* =================== Custom Dropdown زبان =================== */
.custom-dropdown {
  position: relative;
  display: inline-block;
}

.lang-select-wrapper {
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  gap: 8px;
  transition: all 0.2s ease;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 600;
  outline: none;
}

.lang-select-wrapper:hover,
.custom-dropdown.open .lang-select-wrapper {
  background-color: var(--menu-hover-bg);
  border-color: rgba(255, 255, 255, 0.35);
}

.lang-select-wrapper svg.lang-icon {
  width: 19px;
  height: 19px;
  color: #ffffff;
  flex-shrink: 0;
}

.lang-select-wrapper svg.chevron-icon {
  width: 14px;
  height: 14px;
  color: #ffffff;
  pointer-events: none;
  transition: transform 0.25s ease;
}

.custom-dropdown.open .chevron-icon {
  transform: rotate(180deg);
}

.selected-lang-label {
  user-select: none;
  direction: ltr;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 6px;
  list-style: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 1050;
  animation: fadeInDown 0.2s ease;
}

html[dir='ltr'] .dropdown-menu {
  right: auto;
  left: 0;
}

.custom-dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-color);
  border-radius: 8px;
  cursor: pointer;
  direction: ltr;
  text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease;
  user-select: none;
}

.dropdown-item:hover {
  background-color: var(--menu-hover-bg);
  color: var(--accent-purple);
}

.dropdown-item.active {
  background-color: var(--accent-purple);
  color: #ffffff;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =================== سوییچ تم =================== */
.theme-toggle-box {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.theme-toggle-box:hover {
  background-color: var(--menu-hover-bg);
}

.theme-text {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 500;
  user-select: none;
}

.switch-track {
  width: 44px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.35);
  border-radius: 50px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s;
  flex-shrink: 0;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  width: 18px;
  height: 18px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.25s ease,
    right 0.25s ease,
    left 0.25s ease;
}

/* جهت پیش‌فرض (فارسی / RTL) */
html[dir='rtl'] .switch-thumb {
  right: 3px;
  left: auto;
  transform: none;
}

html[dir='rtl'][theme='dark'] .switch-thumb {
  transform: translateX(-20px);
}

/* جهت انگلیسی (LTR) */
html[dir='ltr'] .switch-thumb {
  left: 3px;
  right: auto;
  transform: none;
}

html[dir='ltr'][theme='dark'] .switch-thumb {
  transform: translateX(20px);
}

[theme='dark'] .switch-track {
  background-color: #8b5cf6;
}

/* =================== دکمه همبرگری موبایل/تبلت =================== */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.bar1,
.bar2,
.bar3 {
  width: 26px;
  height: 3px;
  background-color: #ffffff;
  margin: 5px 0;
  border-radius: 4px;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.hamburger-btn.open .bar1 {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-btn.open .bar2 {
  opacity: 0;
}

.hamburger-btn.open .bar3 {
  transform: translateY(-8px) rotate(-45deg);
}

/* =================== مدیاکوئری‌های ریسپانسیو Navbar =================== */

@media screen and (min-width: 1025px) {
  .nav-container {
    padding: 14px 24px;
  }
}

@media screen and (max-width: 1024px) {
  .nav-container {
    padding: 14px 20px;
    flex-wrap: wrap;
  }

  .hamburger-btn {
    display: block;
  }

  .nav-menu {
    display: none;
    width: 100%;
    padding-top: 14px;
  }

  .nav-menu.open {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    padding: 12px 0 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }

  .nav-list li {
    width: 100%;
  }

  .nav-list a {
    display: block;
    width: 100%;
    padding: 12px 9px;
    font-size: 1rem;
  }

  .custom-dropdown {
    width: 100%;
  }

  .lang-select-wrapper {
    width: 100%;
    justify-content: space-between;
    padding: 10px 14px;
  }

  .dropdown-menu {
    position: static;
    width: 100%;
    margin-top: 6px;
    box-shadow: none;
    background-color: rgba(255, 255, 255, 0.08);
  }

  .theme-toggle-box {
    width: 100%;
    justify-content: space-between;
    padding: 12px 14px;
  }
}

@media screen and (max-width: 600px) {
  :root {
    --navbar-content-gap: 16px;
  }

  .nav-container {
    padding: 12px 16px;
  }
}
