/* ================================================================
   NAV.CSS — Header + Navigation + Mobile Drawer
   ================================================================ */
:root {
  --nav-bg: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  --mobile-w: min(84vw, 320px);
}

header {
  background: var(--nav-bg);
  color: #fff;
  padding: 0.75rem 0;
  box-shadow: 0 2px 18px rgba(0,0,0,0.18);
  position: sticky;
  top: 0;
  z-index: 900;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-with-image {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}
.logo-image { height: 56px; width: auto; }
.logo-text h1 {
  font-size: 1.15rem;
  margin: 0;
  color: #fff;
}
.logo-text p {
  font-size: 0.78rem;
  opacity: 0.88;
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  cursor: pointer;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  gap: 5px;
  padding: 8px;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: #fff;
  border-radius: 3px;
  transition: transform 0.3s, opacity 0.25s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.main-nav > ul {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
}
.main-nav > ul > li { position: relative; }
.main-nav > ul > li > a,
.dropdown-head {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.5rem 0.8rem;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.dropdown-head {
  cursor: default;
  position: relative;
}
.dropdown-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dropdown-arrow {
  display: none;
  border: none;
  background: rgba(255,255,255,0.14);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-inline-start: auto;
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 0;
  font-family: inherit;
}
.dropdown-arrow i { pointer-events: none; transition: transform 0.25s; }
.desk-chevron { font-size: 0.68rem; margin-inline-start: 4px; opacity: 0.85; }
.dropdown.dropdown-active > .dropdown-head .dropdown-arrow i,
.dropdown.dropdown-active > a .fa-chevron-down { transform: rotate(180deg); }

@media (max-width: 960px) {
  .desk-chevron { display: none !important; }
}

.main-nav > ul > li > a:hover,
.dropdown-head:hover {
  background: rgba(255,255,255,0.14);
  color: var(--accent);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 99999;
  width: 235px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: #fff;
  border-top: 3px solid var(--primary);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 12px 40px rgba(11,31,58,0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s, visibility 0s 0.2s;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-nav > ul > li.dropdown:hover > .dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}
/* Desktop: show menu on hover via dropdown-head parent */
@media (min-width: 961px) {
  .main-nav > ul > li.dropdown:hover > .dropdown-menu,
  .main-nav > ul > li.dropdown:focus-within > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
  }
  .dropdown-arrow { display: none !important; }
  .dropdown-head { cursor: default; padding-inline-end: 0.9rem; }
  .dropdown-head .dropdown-label .fa-chevron-down { display: none; }
}
.dropdown-menu > li { border-bottom: 1px solid #eef3f8; }
.dropdown-menu > li:last-child { border-bottom: none; }
.dropdown-menu > li > a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #222;
  font-size: 0.86rem;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, padding-left 0.15s;
}
.dropdown-menu > li > a > i {
  color: var(--primary-light);
  font-size: 0.78rem;
  width: 14px;
  text-align: center;
}
.dropdown-menu > li > a:hover {
  background: var(--bg-light);
  color: var(--primary);
  border-left-color: var(--primary);
  padding-left: 18px;
}

.lang-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-display);
  transition: background 0.2s;
}
.lang-btn:hover { background: rgba(255,255,255,0.28); }

.admin-link {
  color: rgba(255,255,255,0.7) !important;
  font-size: 0.78rem !important;
  padding: 0.4rem 0.6rem !important;
}

[dir="rtl"] .dropdown-menu { left: auto; right: 0; }
[dir="rtl"] .dropdown-menu > li > a {
  border-left: none;
  border-right: 3px solid transparent;
  flex-direction: row-reverse;
}
[dir="rtl"] .dropdown-menu > li > a:hover {
  border-right-color: var(--primary);
  padding-left: 14px;
  padding-right: 18px;
}

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
}
.nav-overlay.show { display: block; }

@media (max-width: 960px) {
  .hamburger { display: flex; }
  .logo-image { height: 44px !important; }
  .logo-text h1 { font-size: 0.88rem !important; }
  .logo-text p { display: none !important; }

  .main-nav {
    position: fixed !important;
    top: 0 !important;
    left: -100% !important;
    width: var(--mobile-w) !important;
    height: 100vh !important;
    background: var(--nav-bg) !important;
    z-index: 1050 !important;
    overflow-y: auto !important;
    padding: 70px 0 40px !important;
    box-shadow: 4px 0 32px rgba(0,0,0,0.4) !important;
    transition: left 0.3s ease !important;
  }
  [dir="rtl"] .main-nav {
    left: auto !important;
    right: -100% !important;
    transition: right 0.3s ease !important;
  }
  .main-nav.nav-open { left: 0 !important; }
  [dir="rtl"] .main-nav.nav-open { right: 0 !important; left: auto !important; }

  .main-nav > ul { flex-direction: column !important; width: 100% !important; gap: 0 !important; }
  .main-nav > ul > li {
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .main-nav > ul > li > a,
  .dropdown-head {
    padding: 13px 16px 13px 20px !important;
    font-size: 0.95rem !important;
    border-radius: 0 !important;
    width: 100%;
    box-sizing: border-box;
  }
  .dropdown-arrow {
    display: inline-flex !important;
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.35);
    font-size: 0.85rem;
  }
  .dropdown-menu {
    position: static !important;
    display: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    box-shadow: none !important;
    background: rgba(0,0,0,0.28) !important;
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .dropdown.dropdown-active > .dropdown-menu {
    display: block !important;
  }
  .dropdown-menu > li > a {
    padding: 12px 20px 12px 44px !important;
    color: rgba(255,255,255,0.95) !important;
    border: none !important;
    pointer-events: auto !important;
    min-height: 44px;
    display: flex !important;
    align-items: center;
    gap: 8px;
    text-decoration: none;
  }
  .main-nav a { -webkit-tap-highlight-color: rgba(255,255,255,0.2); touch-action: manipulation; }
  .lang-switcher { position: relative; z-index: 1060; }
  .lang-btn { touch-action: manipulation; }
  [dir="rtl"] .dropdown-menu > li > a {
    padding: 12px 44px 12px 20px !important;
  }
  .dropdown.dropdown-active > .dropdown-head .dropdown-arrow {
    background: var(--accent);
    color: var(--primary-dark);
    border-color: var(--accent);
  }
}
