/* ============================================================
   HEADER / NAV — Athleon
   ============================================================ */

/* ── Variables header (étend les tokens globaux) ── */
:root {
  --h-bg:     var(--bg);
  --h-card:   var(--card2);
  --h-text:   var(--text);
  --h-muted:  var(--muted);
  --h-line:   var(--line);
  --h-accent: var(--accent);
  --h-height: 60px;
}
html.light-mode {
  --h-bg:   #ffffff;
  --h-card: #ffffff;
}

/* ── Wrapper sticky ── */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--h-bg);
  border-bottom: 1px solid var(--h-line);
}

.navbar {
  background: color-mix(in srgb, var(--h-bg) 85%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: var(--h-height);
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── Brand ── */
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-logo { height: 38px; width: auto; display: block; }

/* ── Nav links (desktop) ── */
.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  gap: .25rem;
}

.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .45rem .75rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--h-text);
  text-decoration: none;
  white-space: nowrap;
  opacity: .85;
  transition: background .15s, opacity .15s;
}
.nav-link:hover { background: rgba(255,255,255,.06); opacity: 1; }
html.light-mode .nav-link:hover { background: rgba(0,0,0,.05); }

.nav-link.active {
  opacity: 1;
  background: rgba(16,185,129,.1);
  color: var(--h-accent);
}

.chevron {
  width: 14px; height: 14px;
  opacity: .6;
  transition: transform .2s;
  flex-shrink: 0;
}
.has-dropdown:hover .chevron { transform: rotate(180deg); }

/* ── Dropdowns ── */
.dropdown {
  position: absolute;
  top: calc(100% + .5rem);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 230px;
  padding: .4rem;
  background: var(--h-card);
  border: 1px solid var(--h-line);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 300;
}
html.light-mode .dropdown { box-shadow: 0 8px 32px rgba(0,0,0,.12); }

.has-dropdown:hover .dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.dropdown a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .75rem;
  border-radius: 9px;
  font-size: .875rem;
  color: var(--h-text);
  text-decoration: none;
  transition: background .12s;
}
.dropdown a:hover { background: rgba(255,255,255,.06); }
html.light-mode .dropdown a:hover { background: rgba(0,0,0,.05); }

.dd-icon { font-size: 1rem; flex-shrink: 0; }
.dd-sep { height: 1px; background: var(--h-line); margin: .3rem .5rem; }
.dd-label { padding: .35rem .75rem .1rem; font-size: .75rem; color: var(--h-muted); text-transform: uppercase; letter-spacing: .06em; }

/* ── Right actions ── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
  margin-left: auto;
}
.nav-links + .nav-actions { margin-left: 0; }

/* Icon button (notif, theme) */
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--h-line);
  background: rgba(255,255,255,.03);
  color: var(--h-text);
  cursor: pointer;
  font-size: 1rem;
  transition: background .15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: rgba(255,255,255,.07); }
html.light-mode .icon-btn { background: rgba(0,0,0,.03); }
html.light-mode .icon-btn:hover { background: rgba(0,0,0,.07); }

/* Auth buttons */
.btn-ghost, .btn-primary {
  display: inline-flex;
  align-items: center;
  padding: .5rem .9rem;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--h-line);
  transition: background .15s, filter .15s;
}
.btn-ghost { background: rgba(255,255,255,.04); color: var(--h-text); }
.btn-ghost:hover { background: rgba(255,255,255,.09); }
.btn-primary { background: var(--h-accent); color: #052014; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.08); }
html.light-mode .btn-ghost { background: rgba(0,0,0,.04); color: var(--h-text); }

/* ── Account dropdown ── */
.account { position: relative; }
.account-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .6rem .35rem .45rem;
  border-radius: 10px;
  border: 1px solid var(--h-line);
  background: rgba(255,255,255,.03);
  color: var(--h-text);
  cursor: pointer;
  transition: background .15s;
}
.account-btn:hover { background: rgba(255,255,255,.07); }
html.light-mode .account-btn { background: rgba(0,0,0,.03); }
html.light-mode .account-btn:hover { background: rgba(0,0,0,.07); }

.avatar-img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: #0b1f17; color: #c7ffec;
  font-size: .78rem; font-weight: 800;
}
html.light-mode .avatar { background: #d1fae5; color: #065f46; }
.account-name { font-size: .875rem; font-weight: 500; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  min-width: 230px;
  padding: .4rem;
  background: var(--h-card);
  border: 1px solid var(--h-line);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .15s, transform .15s;
  z-index: 300;
}
html.light-mode .account-dropdown { box-shadow: 0 8px 32px rgba(0,0,0,.12); }

.account.open .account-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.account-dropdown a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .75rem;
  border-radius: 9px;
  font-size: .875rem;
  color: var(--h-text);
  text-decoration: none;
  transition: background .12s;
}
.account-dropdown a:hover { background: rgba(255,255,255,.06); }
html.light-mode .account-dropdown a:hover { background: rgba(0,0,0,.05); }
.account-dropdown .danger-link { color: #f87171; }
.account-dropdown .danger-link:hover { background: rgba(239,68,68,.1); }

/* ── Burger button ── */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px; height: 36px;
  border: 1px solid var(--h-line);
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  cursor: pointer;
  padding: 0;
}
.burger span {
  display: block;
  width: 18px; height: 2px;
  background: var(--h-text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Notifications ── */
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute; top: -5px; right: -5px;
  background: #e53935; color: #fff;
  font-size: .6rem; font-weight: 700;
  border-radius: 999px; min-width: 16px; height: 16px;
  padding: 0 3px; line-height: 16px; text-align: center;
  pointer-events: none;
}
.notif-panel {
  display: none;
  position: absolute; right: 0; top: calc(100% + .5rem);
  width: 320px;
  background: var(--h-card);
  border: 1px solid var(--h-line);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.45);
  z-index: 400;
  overflow: hidden;
  flex-direction: column;
  max-height: 420px;
}
.notif-panel.open { display: flex; }
html.light-mode .notif-panel { box-shadow: 0 8px 28px rgba(0,0,0,.1); }

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--h-line);
  font-size: .88rem;
  flex-shrink: 0;
}
.notif-hdr-actions { display: flex; align-items: center; gap: .4rem; }
.notif-read-btn {
  background: none; border: none;
  color: var(--h-muted); cursor: pointer; font-size: .8rem;
}
.notif-read-btn:hover { color: var(--h-text); }
.notif-clear-btn {
  background: none; border: none;
  color: var(--h-muted); cursor: pointer; font-size: .85rem; padding: 0 .1rem;
  transition: color .12s;
}
.notif-clear-btn:hover { color: #f87171; }
#notifList { overflow-y: auto; flex: 1; }
.notif-item {
  display: flex; align-items: flex-start;
  border-bottom: 1px solid var(--h-line);
  transition: background .12s; position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(255,255,255,.04); }
.notif-item.unread { background: rgba(16,185,129,.07); }
html.light-mode .notif-item.unread { background: rgba(5,150,105,.06); }
.notif-item-link {
  flex: 1; padding: .6rem .9rem;
  text-decoration: none; color: var(--h-text);
  min-width: 0;
}
.notif-dismiss {
  background: none; border: none; cursor: pointer;
  color: var(--h-muted); font-size: 1.1rem; line-height: 1;
  padding: .5rem .55rem 0; flex-shrink: 0;
  opacity: 0; transition: opacity .12s, color .12s;
}
.notif-item:hover .notif-dismiss { opacity: 1; }
.notif-dismiss:hover { color: #f87171; }
.notif-text { font-size: .85rem; line-height: 1.4; }
.notif-time { font-size: .75rem; color: var(--h-muted); margin-top: .1rem; }
.notif-empty { padding: 1rem; color: var(--h-muted); font-size: .875rem; text-align: center; }

/* ── Drawer (mobile menu) ── */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
  z-index: 490;
}
.drawer-backdrop.show { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(360px, 90vw);
  height: 100dvh;
  background: var(--h-card);
  border-left: 1px solid var(--h-line);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  z-index: 500;
  overflow: hidden;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--h-line);
  flex-shrink: 0;
}
.drawer-close {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--h-line);
  background: transparent;
  color: var(--h-text);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s;
}
.drawer-close svg { width: 18px; height: 18px; }
.drawer-close:hover { background: rgba(255,255,255,.07); }
html.light-mode .drawer-close:hover { background: rgba(0,0,0,.06); }

.drawer-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; }

.drawer-section {
  padding: .7rem .5rem .2rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--h-muted);
}
.drawer-section:first-child { padding-top: .2rem; }

.drawer-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .7rem;
  border-radius: 10px;
  font-size: .9rem;
  color: var(--h-text);
  text-decoration: none;
  transition: background .12s;
}
.drawer-link:hover { background: rgba(255,255,255,.06); }
html.light-mode .drawer-link:hover { background: rgba(0,0,0,.05); }
.drawer-link span:first-child { font-size: 1.1rem; flex-shrink: 0; width: 22px; text-align: center; }

.drawer-foot {
  padding: .75rem;
  border-top: 1px solid var(--h-line);
  flex-shrink: 0;
}
.drawer-theme-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .75rem;
  border-radius: 10px;
  border: 1px solid var(--h-line);
  background: rgba(255,255,255,.03);
  color: var(--h-text);
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s;
}
.drawer-theme-btn:hover { background: rgba(255,255,255,.07); }
html.light-mode .drawer-theme-btn { background: rgba(0,0,0,.03); }
html.light-mode .drawer-theme-btn:hover { background: rgba(0,0,0,.06); }

/* ── Bottom tab bar (mobile) ── */
.bottom-tabs {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 48;
  background: var(--h-card);
  border-top: 1px solid var(--h-line);
  padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
  gap: .1rem;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .1rem;
  padding: .3rem .1rem;
  text-decoration: none;
  color: var(--h-muted);
  border-radius: 10px;
  transition: color .15s, background .15s;
  min-width: 0;
}
.tab-item:hover { color: var(--h-text); background: rgba(255,255,255,.04); }
.tab-item.tab-active { color: var(--h-accent); }
html.light-mode .tab-item:hover { background: rgba(0,0,0,.04); }
.tab-ico { font-size: 1.35rem; line-height: 1; }
.tab-lbl { font-size: .6rem; font-weight: 700; white-space: nowrap; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.tab-initials {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: .78rem; font-weight: 800;
  background: #0b1f17; color: #c7ffec;
  border: 1px solid rgba(16,185,129,.3);
}
.tab-item.tab-active .tab-initials { border-color: var(--h-accent); }
html.light-mode .bottom-tabs { background: var(--h-card); }
html.light-mode .tab-initials { background: #d1fae5; color: #065f46; }

/* ── Responsive breakpoint ── */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .burger { display: flex; }
}

@media (max-width: 960px) {
  .bottom-tabs { display: flex; }
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .tab-lbl { display: none; }
  .tab-ico { font-size: 1.5rem; }
}
