/* ===== PlanzEE – modern, rögzített navbar (oldal tetején marad) ===== */

:root {
  --nav-height: 56px;
  --saas-nav-gap: 0.45rem;
  /* Fehér háttér */
  --nav-bg: #ffffff;
  --nav-text: #0f172a;
  --nav-text-hover: #0f172a;
  --nav-brand: #0f172a;
  --nav-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --nav-border: #e2e8f0;
}

/* Layout: tartalom ne kerüljön a navbar alá + egységes rés a navbar alatt */
body.has-navbar {
  padding-top: calc(var(--nav-height) + var(--saas-nav-gap, 0.45rem));
}

.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10100;
  height: var(--nav-height);
  background: var(--nav-bg);
  box-shadow: var(--nav-shadow);
  border-bottom: 1px solid var(--nav-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  font-size: 0.9375rem;
}

.app-nav__inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  gap: 0.5rem 1rem;
}

.app-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--nav-brand);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  margin-right: 0.5rem;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.app-nav__brand:hover {
  color: var(--nav-text-hover);
  background: #f1f5f9;
  text-decoration: none;
}

.app-nav__logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.app-nav__links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

.app-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--nav-text);
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  font-variant-ligatures: none;
  font-style: normal;
}

.app-nav__link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.app-nav__link:hover .app-nav__link-icon,
.app-nav__link--active .app-nav__link-icon {
  opacity: 1;
}

.app-nav__link:hover {
  color: var(--nav-text-hover);
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.06);
  text-decoration: none;
}

.app-nav__link--active {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.14), rgba(37, 99, 235, 0.12));
  color: #0f172a;
  font-weight: 600;
  border: 1px solid rgba(37, 99, 235, 0.35);
}

.app-nav__badge {
  display: inline-block;
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #fff;
  border-radius: 9999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.25rem;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.35);
}

.app-nav__spacer {
  flex: 1;
  min-width: 0.5rem;
}

/* Rendszerértesítések (navbar) */
.app-nav__sa-wrap {
  position: relative;
  flex-shrink: 0;
}

.app-nav__sa-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 0.1rem 0 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--nav-text);
  opacity: 0.82;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.app-nav__sa-trigger:hover {
  opacity: 1;
  color: var(--nav-text-hover);
  background: #f1f5f9;
}

.app-nav__sa-trigger:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.45);
  outline-offset: 2px;
}

.app-nav__sa-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-nav__sa-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.app-nav__sa-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.9375rem;
  height: 0.9375rem;
  padding: 0 0.2rem;
  box-sizing: border-box;
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
  color: #fff;
  background: #dc2626;
  border-radius: 9999px;
  border: 1.5px solid var(--nav-bg, #fff);
  box-shadow: 0 0 0 0.5px rgba(15, 23, 42, 0.08);
}

/* „9+” kissé szélesebb, továbbra is kompakt */
.app-nav__sa-badge--wide {
  min-width: 1.125rem;
  padding: 0 0.22rem;
  font-size: 0.5rem;
  letter-spacing: 0;
}

.app-nav__sa-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(22rem, calc(100vw - 2rem));
  max-height: 70vh;
  overflow: auto;
  padding: 0.65rem 0.75rem;
  background: #fff;
  border: 1px solid var(--nav-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  z-index: 10200;
}

.app-nav__sa-panel[hidden] {
  display: none !important;
}

.app-nav__sa-panel-head {
  font-weight: 600;
  font-size: 0.9rem;
  color: #0f172a;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #e2e8f0;
}

.app-nav__sa-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-nav__sa-item {
  padding: 0.45rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.app-nav__sa-item-type {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.15rem;
}

.app-nav__sa-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #4f46e5;
  text-decoration: none;
}

.app-nav__sa-item-title:hover {
  text-decoration: underline;
}

.app-nav__sa-foot {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

/* Felhasználónév + kijelentkezés: szorosabb elválasztás, mint a többi nav elem */
.app-nav__user-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.app-nav__user {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--nav-text);
  font-size: 0.875rem;
  padding: 0 0.15rem 0 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.app-nav__user-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.15));
  border: 1px solid rgba(37, 99, 235, 0.35);
  color: #1e40af;
  flex-shrink: 0;
}

.app-nav__logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin: 0;
  color: #dc2626;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app-nav__logout-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.app-nav__logout-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-nav__logout-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.app-nav__logout:hover {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.1);
}

.app-nav__logout:focus-visible {
  outline: 2px solid rgba(220, 38, 38, 0.45);
  outline-offset: 2px;
}

/* Brand szöveg: asztalon "Főoldal", mobilon "PlanzEE" */
.app-nav__brand-text--mobile {
  display: none;
}

/* Lenyíló menüben megjelenő elemek (csak mobilon) */
.app-nav__link--mobile-only,
.app-nav__user-in-menu {
  display: none;
}

/* ---- Mobil: hamburger menü ---- */
.app-nav__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0 -0.5rem 0 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.15s;
}

.app-nav__toggle:hover {
  background: #f1f5f9;
}

.app-nav__toggle-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

@media (max-width: 900px) {
  .app-nav {
    padding: 0 0.75rem;
  }

  .app-nav__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
  }

  .app-nav__toggle {
    display: flex;
    order: unset;
    grid-column: 1;
    justify-self: start;
  }

  .app-nav__brand {
    grid-column: 2;
    justify-self: center;
  }

  .app-nav__spacer {
    display: none;
  }

  .app-nav__inner > .app-nav__user-actions {
    grid-column: 3;
    justify-self: end;
  }

  .app-nav__links {
    grid-column: 1;
    grid-row: 1;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--nav-border);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
    gap: 0.25rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.25s ease, opacity 0.2s ease;
  }

  .app-nav__links.is-open {
    max-height: 80vh;
    opacity: 1;
    pointer-events: auto;
  }

  .app-nav__link {
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
  }

  .app-nav__brand-text--desktop {
    display: none;
  }

  .app-nav__brand-text--mobile {
    display: inline;
  }

  .app-nav__user {
    display: none;
  }

  .app-nav__logout {
    width: 2.35rem;
    height: 2.35rem;
  }

  .app-nav__logout-icon svg {
    width: 18px;
    height: 18px;
  }

  .app-nav__link--mobile-only {
    display: inline-flex;
  }

  .app-nav__user-in-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    color: var(--nav-text);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid var(--nav-border);
  }

  .app-nav__user-in-menu .app-nav__user-icon {
    width: 20px;
    height: 20px;
  }
}

@media (min-width: 901px) {
  .app-nav__link--mobile-only,
  .app-nav__user-in-menu {
    display: none;
  }

  .app-nav__links {
    margin-right: 0.5rem;
  }
}
