/* ============================================================
   NAVIGATION — floating glass bar
   ------------------------------------------------------------
   The bar is always light, so the gold/navy logo is shown exactly
   as designed on every page (including over the dark home hero).
   The glass layer lives on ::before so that the element which
   contains the mobile drawer (position:fixed) has NO backdrop-filter —
   a backdrop-filter on an ancestor would re-anchor fixed children.
   JS hooks kept: .nav-open .nav-scrolled .nav-dark .nav-link.active
   .nav-dropdown.show #nav-backdrop .nav-mobile-auth-bar
   ============================================================ */

.nav {
  position: fixed;
  top: max(var(--nav-top), env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  width: 100%;
  height: auto;
  z-index: var(--z-nav);
  pointer-events: none;           /* only the bar itself is clickable */
  background: transparent;
}

.nav > .container {
  max-width: 1240px;
  padding-inline: 0.75rem;
}

.nav-inner {
  position: relative;
  isolation: isolate;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--nav-height);
  padding: 0 0.7rem 0 1.25rem;
  border-radius: var(--radius-full);
}

.nav-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
          backdrop-filter: blur(16px) saturate(1.5);
  box-shadow:
    0 0 0 1px rgba(11, 31, 63, 0.07),
    0 10px 30px -12px rgba(6, 15, 34, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.nav-scrolled .nav-inner::before,
.nav-dark .nav-inner::before {
  background: rgba(255, 255, 255, 0.95);
}

.nav-scrolled .nav-inner::before {
  box-shadow:
    0 0 0 1px rgba(11, 31, 63, 0.08),
    0 14px 36px -12px rgba(6, 15, 34, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* ── Logo ───────────────────────────────────────────────────── */
.nav-logo {
  display: flex;
  align-items: center;
  flex: none;
  text-decoration: none;
}

.nav-logo img,
.nav-logo-img {
  height: 46px !important;        /* beats the inline style on the <img> */
  max-height: none !important;
  width: auto !important;
  display: block;
  object-fit: contain;
  transition: transform 0.3s var(--ease);
}

.nav-logo:hover img { transform: scale(1.03); }

/* legacy text-logo helpers (markup is commented out in the HTML) */
.nav-logo-name { font-size: 1.2rem; font-weight: 700; color: var(--navy); line-height: 1.2; }
.nav-logo-sub  { font-size: 0.8rem; color: var(--gray-600); }

/* ── Links ──────────────────────────────────────────────────── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0 auto;
  white-space: nowrap;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 0.55rem 0.72rem;
  border-radius: var(--radius-full);
  color: var(--navy);
  font-weight: 500;
  font-size: 0.94rem;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover { background: rgba(11, 31, 63, 0.05); }
.nav-link.active { font-weight: 600; }

/* the double rule */
.nav-link::after {
  content: '';
  position: absolute;
  left: 0.72rem;
  right: 0.72rem;
  bottom: 0.2rem;
  height: 5px;
  border-top: 1.5px solid var(--gold-dark);
  border-bottom: 1.5px solid var(--gold-dark);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s var(--ease);
}

.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }

/* ── Auth area ──────────────────────────────────────────────── */
.nav-auth {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
}

.nav-auth .btn-sm { min-height: 40px; padding-inline: 1.1rem; }

.nav-auth .nav-btn-login { background: transparent; box-shadow: none; border-color: var(--gray-300); }
.nav-auth .nav-btn-login:hover { background: var(--white); border-color: var(--navy); }

.nav-user { position: relative; }

.nav-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--navy-light), var(--navy));
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--gold);
  transition: transform 0.2s ease;
}

.nav-avatar:hover { transform: translateY(-1px); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 16px);
  right: 0;
  width: 250px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  pointer-events: auto;
  z-index: 5;
}

.nav-dropdown.show { display: flex; animation: toastIn 0.25s var(--ease); }

.nav-dropdown-header { padding: 1rem 1.1rem; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.nav-dropdown-name   { font-weight: 600; color: var(--navy); }
.nav-dropdown-email  { font-size: 0.85rem; color: var(--gray-500); overflow-wrap: anywhere; }

.nav-dropdown-item {
  padding: 0.8rem 1.1rem;
  text-decoration: none;
  color: var(--gray-700);
  font-size: 0.95rem;
  transition: background-color 0.2s, color 0.2s;
}

.nav-dropdown-item:hover { background: var(--accent-bg); color: var(--navy); }

/* ── Hamburger ──────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  background: var(--navy);
  pointer-events: auto;
  transition: background-color 0.2s ease;
}

.nav-hamburger:hover { background: var(--navy-light); }

.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold-light);
  transition: transform 0.3s var(--ease), opacity 0.2s ease;
}

.nav.nav-open .nav-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.nav-open .nav-hamburger span:nth-child(2) { opacity: 0; }
.nav.nav-open .nav-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* mobile-only bar (created by nav.js) is hidden on desktop */
.nav-mobile-auth-bar { display: none !important; }

/* ── Mobile / tablet drawer ─────────────────────────────────── */
/* 7 links (incl. "Συνεργάτες") on smaller laptops: tighten the links a little
   so the full desktop bar still fits from 1121px up. */
@media (min-width: 1121px) and (max-width: 1259px) {
  .nav-inner { gap: 0.75rem; }
  .nav-link { padding-inline: 0.52rem; font-size: 0.92rem; }
  .nav-link::after { left: 0.52rem; right: 0.52rem; }
  .nav-auth .btn-sm { padding-inline: 0.95rem; }
}

@media (max-width: 1120px) {
  .nav-auth { display: none; }
  .nav-hamburger { display: flex; }

  .nav-inner { padding-right: 0.5rem; }

  .nav-links {
    position: fixed;
    top: calc(max(var(--nav-top), env(safe-area-inset-top, 0px)) + var(--nav-height) + 0.6rem);
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0;
    margin: 0;
    padding: 0.75rem 0.75rem calc(112px + env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--white);
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -1px 0 rgba(11, 31, 63, 0.06), var(--shadow-xl);
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    transition: opacity 0.28s ease, transform 0.35s var(--ease), visibility 0s linear 0.35s;
    white-space: normal;
  }

  .nav.nav-open .nav-links {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }

  .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.05rem 1.1rem;
    border-radius: 16px;
    font-size: 1.12rem;
  }

  .nav-link::after {
    position: static;
    width: 22px;
    height: 5px;
    left: auto;
    right: auto;
    bottom: auto;
  }

  .nav-link:hover { background: var(--gray-50); }
  .nav-link.active { background: var(--accent-bg); }

  /* fixed action bar pinned under the drawer */
  .nav-mobile-auth-bar {
    display: flex !important;
    gap: 0.75rem;
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0;
    width: auto;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -10px 24px -14px rgba(11, 31, 63, 0.25);
    z-index: 3;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    transition: opacity 0.28s ease, transform 0.35s var(--ease), visibility 0s linear 0.35s;
  }

  .nav.nav-open .nav-mobile-auth-bar {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }

  .nav-mobile-auth-bar .btn { min-height: 50px; }
}

@media (max-width: 480px) {
  .nav-logo img, .nav-logo-img { height: 38px !important; }
  .nav-inner { padding-left: 1rem; }
}

/* ============================================================
   SESSION-AWARE HEADER  (additive — no rule above is changed)
   nav.js picks the state from session_check.php:
     logged out : [Σύνδεση] [Εγγραφή]                 (as before)
     logged in  : [Είσοδος] [avatar] → dropdown with one item "Αποσύνδεση"
   ≥601px : both sit in the top bar (beside the hamburger up to 1120px)
   ≤600px : the top bar stays as it was; both sit in the drawer's bottom bar
   ============================================================ */

/* logged in: same container as the login/register buttons */
.nav-auth--user { gap: 0.75rem; }
.nav-user { flex: none; }

/* the avatar is a real <button> now (keyboard + screen-reader friendly) */
button.nav-avatar {
  padding: 0;
  border: 0;
  font-family: inherit;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.nav-avatar svg { display: block; }
.nav-avatar:focus-visible,
.nav-dropdown-item:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 3px; }

/* one-item dropdown (the original 250px card was built for header + 2 items) */
.nav-dropdown--single { width: auto; min-width: 12.5rem; max-width: calc(100vw - 1.5rem); }

button.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 48px;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button.nav-dropdown-item:disabled { opacity: 0.6; cursor: progress; }

/* ── Tablet (bar collapses to the hamburger, there is still room) ── */
@media (min-width: 601px) and (max-width: 1120px) {
  /* the top bar already carries [Είσοδος] [avatar] – no second copy in the drawer */
  .nav.nav-has-user .nav-mobile-auth-bar { display: none !important; }
}

@media (max-width: 1120px) {
  /* visitors: .nav-auth stays hidden (their buttons live in the drawer bar).
     logged in: it stays in the bar, between the language switch and the hamburger */
  .nav-auth.nav-auth--user { display: flex; gap: 0.5rem; }

  .nav-auth--user .nav-btn-enter { min-height: 44px; }
  .nav-user .nav-avatar { width: 44px; height: 44px; }           /* ≥44px tap target */

  /* pinned to the viewport like the drawer: always inside the screen, never clipped */
  .nav-auth--user .nav-dropdown--single {
    position: fixed;
    top: calc(max(var(--nav-top), env(safe-area-inset-top, 0px)) + var(--nav-height) + 0.6rem);
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    left: auto;
    width: min(15rem, calc(100vw - 1.5rem));
    min-width: 0;
    max-width: none;
  }
  button.nav-dropdown-item { min-height: 52px; font-size: 1rem; padding-inline: 1.25rem; }
}

/* ── Phones ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .nav-auth.nav-auth--user { display: none; }          /* top bar = exactly the original bar */

  /* [ Είσοδος ........ ] [avatar]  in the drawer's bottom bar */
  .nav-mobile-auth-bar .nav-user { position: relative; flex: none; align-self: center; }
  .nav-mobile-auth-bar .nav-avatar { width: 50px; height: 50px; font-size: 1.05rem; }

  /* opens upwards, right edge level with the bar, never wider than the screen */
  .nav-mobile-auth-bar .nav-dropdown--single {
    position: absolute;
    top: auto;
    bottom: calc(100% + 18px);
    right: 0;
    left: auto;
    width: min(15rem, calc(100vw - 3.5rem));
    min-width: 0;
    max-width: none;
  }
}
