/* Identité commune du header Treffstudent */
.app-header {
  background: #0b2850 !important;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.app-header .app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff !important;
  text-decoration: none;
  flex-shrink: 0;
}

.app-header .app-brand-mark {
  position: relative;
  width: 28px;
  height: 21px;
  display: inline-block;
  flex: 0 0 28px;
}

.app-header .app-brand-mark span {
  position: absolute;
  display: block;
  background: #fff !important;
  border-radius: 999px;
}

.app-header .app-brand-mark span:nth-child(1) {
  width: 9px;
  height: 9px;
  top: 0;
  left: 4px;
}

.app-header .app-brand-mark span:nth-child(2) {
  width: 9px;
  height: 9px;
  top: 0;
  right: 4px;
}

.app-header .app-brand-mark span:nth-child(3) {
  width: 21px;
  height: 10px;
  left: 3.5px;
  bottom: 0;
}

.app-header .app-brand-copy {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.app-header .app-brand-name {
  color: #fff;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.35px;
  white-space: nowrap;
}

.app-header .app-brand-context {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  min-height: 24px;
  padding: 3px 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header .app-brand-context.is-university-link {
  cursor: pointer;
}

.app-header .app-brand-context.is-university-link:hover,
.app-header .app-brand-context.is-university-link:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  outline: none;
}

/* Navigation commune Treffstudent */
.site-header.app-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: none;
}

.site-header.app-header .header-inner {
  min-height: 70px;
}

.app-header .top-nav,
.admin-header.app-header .admin-nav,
.site-header.app-header .app-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-header .top-nav .nav-btn,
.admin-header.app-header .admin-nav .nav-btn,
.site-header.app-header .app-nav > a,
.site-header.app-header .landing-nav-logout {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff !important;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.3s,
    transform 0.2s,
    border-color 0.3s;
}

.app-header .top-nav .nav-btn:hover,
.admin-header.app-header .admin-nav .nav-btn:hover,
.site-header.app-header .app-nav > a:hover,
.site-header.app-header .landing-nav-logout:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff !important;
  transform: translateY(-2px);
}

.app-header .top-nav .nav-btn.active,
.admin-header.app-header .admin-nav .nav-btn.active {
  border-color: #fff;
  background: #fff;
  color: #0b2850 !important;
}

.app-header .top-nav .nav-btn.logout,
.admin-header.app-header .admin-nav .nav-btn.logout,
.site-header.app-header .landing-nav-logout {
  background: #9ca3af;
}

.app-header .top-nav .nav-btn.logout:hover,
.admin-header.app-header .admin-nav .nav-btn.logout:hover,
.site-header.app-header .landing-nav-logout:hover {
  border-color: #ef4444;
  background: #ef4444;
}

.app-header .nav-icon {
  font-size: 1.05rem;
}

.app-header .nav-text {
  white-space: nowrap;
}

/* Navigation publique de la Landing */
.site-header.app-header .desktop-nav:not(.app-nav) a {
  color: rgba(255, 255, 255, 0.84);
}

.site-header.app-header .desktop-nav:not(.app-nav) a:hover {
  color: #fff;
}

.site-header.app-header .header-actions .btn-secondary {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.site-header.app-header .header-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.site-header.app-header .header-actions .btn-primary {
  border-color: #fff;
  background: #fff;
  color: #0b2850;
}

.site-header.app-header .menu-toggle {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
}

.site-header.app-header .menu-toggle .menu-toggle-line {
  background: #fff;
}

.admin-header.app-header {
  border-bottom: 0;
}

@media (max-width: 1120px) {
  .site-header.app-header .app-nav {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-header .app-brand-copy {
    gap: 7px;
  }
}

@media (max-width: 560px) {
  .app-header .app-brand-name {
    font-size: 1.3rem;
  }

  .app-header .app-brand-context {
    font-size: 0.62rem;
    padding: 3px 7px;
  }

  .site-header.app-header .header-inner {
    min-height: 66px;
  }
}

@media (max-width: 760px) {
  .app-header:not(.site-header):not(.admin-header) + .chat-page {
    height: calc(100vh - 70px);
    height: calc(100dvh - 70px);
  }
}

@media (max-width: 390px) {
  .app-header .app-brand-context {
    display: none;
  }
}

.app-header:not(.site-header) .top-nav .nav-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.app-header:not(.site-header) .top-nav .nav-badge.hidden {
  display: none;
}

/* =========================
   Navigation mobile commune aux pages applicatives
========================= */
.app-menu-toggle {
  position: relative;
  display: none;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.app-menu-toggle-lines {
  display: grid;
  gap: 4px;
}

.app-menu-toggle-lines > span {
  display: block;
  width: 21px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.mobile-menu-notification-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.28);
  box-sizing: border-box;
}

.mobile-menu-notification-badge.hidden {
  display: none;
}

.mobile-home-nav-btn {
  display: none !important;
}

@media (max-width: 1120px) {
  .app-header:not(.site-header) {
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem !important;
    padding: 0.72rem 1rem !important;
  }

  .app-header:not(.site-header) .app-menu-toggle {
    display: inline-flex;
  }

  .app-header:not(.site-header) .top-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    width: auto !important;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 0.45rem;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid #dbe3ee;
    background: #fff;
    box-shadow: 0 14px 28px rgba(15, 35, 69, 0.16);
    box-sizing: border-box;
  }

  .app-header:not(.site-header) .top-nav.mobile-open {
    display: flex;
  }

  .app-header:not(.site-header) .top-nav .nav-btn {
    width: 100% !important;
    height: auto !important;
    min-height: 44px;
    justify-content: flex-start !important;
    gap: 0.65rem;
    padding: 0.65rem 0.8rem !important;
    border: 1px solid #dbe3ee;
    border-radius: 10px !important;
    background: #f8fafc;
    color: #0b2850 !important;
    text-align: left;
    text-decoration: none;
    box-sizing: border-box;
  }

  .app-header:not(.site-header) .top-nav .nav-btn:hover {
    border-color: #aebdd0;
    background: #eef4fb;
    transform: none;
  }

  .app-header:not(.site-header) .top-nav .nav-btn.active {
    border-color: #0b2850;
    background: #0b2850;
    color: #fff !important;
  }

  .app-header:not(.site-header) .top-nav .nav-btn.logout {
    border-color: #fecaca;
    background: #fff1f2;
    color: #b91c1c !important;
  }

  .app-header:not(.site-header) .top-nav .nav-btn.logout:hover {
    border-color: #ef4444;
    background: #fee2e2;
  }

  .app-header:not(.site-header) .top-nav .mobile-home-nav-btn {
    display: flex !important;
  }

  .app-header:not(.site-header) .top-nav .nav-text {
    display: inline !important;
    white-space: nowrap;
  }

  .app-header:not(.site-header) .top-nav .nav-icon {
    width: 1.4rem;
    flex: 0 0 1.4rem;
    font-size: 1.05rem;
    text-align: center;
  }

  .app-header:not(.site-header) .top-nav .nav-badge {
    position: static;
    margin-left: auto;
    flex: 0 0 auto;
    border-color: #fff;
  }
}

@media (max-width: 390px) {
  .app-header:not(.site-header) {
    padding-inline: 0.75rem !important;
  }

  .app-header:not(.site-header) .app-menu-toggle {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }
}

/* =========================
   Landing mobile app navigation
   Keep the logged-in Landing menu visually aligned with app pages.
========================= */
@media (max-width: 1120px) {
  .site-header.app-header #userMobileNav {
    width: auto;
    margin: 0;
    padding: 0.75rem 1rem 1rem;
    gap: 0.45rem;
  }

  .site-header.app-header #userMobileNav > a,
  .site-header.app-header #userMobileNav > .mobile-logout-btn {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.8rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #f8fafc;
    color: #0b2850;
    font: inherit;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    box-sizing: border-box;
  }

  .site-header.app-header #userMobileNav > a:hover,
  .site-header.app-header #userMobileNav > .mobile-logout-btn:hover {
    border-color: #aebdd0;
    background: #eef4fb;
    color: #0b2850;
  }

  .site-header.app-header #userMobileNav > a[href="#userHome"] {
    border-color: #0b2850;
    background: #0b2850;
    color: #fff;
  }

  .site-header.app-header #userMobileNav > .mobile-logout-btn {
    border-color: #fecaca;
    background: #fff1f2;
    color: #b91c1c;
    cursor: pointer;
  }

  .site-header.app-header #userMobileNav > .mobile-logout-btn:hover {
    border-color: #ef4444;
    background: #fee2e2;
    color: #b91c1c;
  }

  .site-header.app-header #userMobileNav .mobile-nav-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
  }

  .site-header.app-header #userMobileNav .nav-icon {
    width: 1.4rem;
    flex: 0 0 1.4rem;
    text-align: center;
  }

  .site-header.app-header #userMobileNav .mobile-nav-link-with-badge {
    justify-content: space-between;
  }

  .site-header.app-header #userMobileNav .app-nav-badge {
    margin-left: auto;
    flex: 0 0 auto;
  }
}
