/* ===================================================
   HEADER.CSS
   =================================================== */

/* Scroll progress */
.scroll-progress {
  position: fixed;
  top: 72px;
  left: 0;
  height: 2px;
  background: var(--primary);
  z-index: 1001;
  width: 0;
  transition: width 0.1s linear;
}

/* Header bar */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(245,242,237,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.header.scrolled {
  background: rgba(245,242,237,0.95);
  box-shadow: var(--shadow-sm);
}

/* Nav container */
.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo — IMAGE */
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

/* Nav Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link {
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}
.nav-link:hover {
  background: var(--section);
  color: var(--primary);
}
.nav-link.has-dropdown {
  display: flex;
  align-items: center;
  gap: 5px;
}
.nav-link .chevron {
  width: 14px; height: 14px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.nav-link:hover .chevron { transform: rotate(180deg); }

/* Dropdown */
.dropdown-wrapper { position: relative; }

/* Invisible bridge between nav-link and dropdown to keep hover */
.dropdown-wrapper::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 16px; /* bridge the gap */
  background: transparent;
}

.dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
}
.dropdown-wrapper:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}
.dropdown-item {
  display: block;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.dropdown-item:hover {
  background: var(--section);
  color: var(--primary);
}
.dropdown-item span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Se connecter (nav CTA) */
.btn-connect {
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: 1.5px solid var(--primary);
  border-radius: 50px;
  transition: var(--transition);
  margin-left: 16px;
  white-space: nowrap;
}
.btn-connect:hover {
  background: var(--primary);
  color: #fff;
}

/* "Mon espace" — lien distinctif pour clients/admin */
.nav-link--espace {
  color: var(--primary);
  font-weight: 600;
}
.nav-link--espace:hover {
  background: rgba(94,74,208,.07);
  color: var(--primary);
}

/* Avatar discret quand connecté */
.nav-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #8a6fd4 100%);
  color: #fff; font-size: .78rem; font-weight: 800; letter-spacing: 0;
  display: flex; align-items: center; justify-content: center;
  margin-left: 16px; flex-shrink: 0; cursor: default;
  position: relative;
}
.nav-user-avatar::after {
  content: ''; position: absolute; bottom: 1px; right: 1px;
  width: 9px; height: 9px; background: #22c55e;
  border-radius: 50%; border: 1.5px solid var(--bg);
}

/* ============================================
   SESSION CHIP — floating bottom-right
   ============================================ */
.session-chip {
  position: fixed; bottom: 28px; right: 28px; z-index: 998;
  display: flex; align-items: center; gap: 11px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 16px;
  padding: 10px 12px 10px 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.1), 0 2px 8px rgba(0,0,0,.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(14px) scale(.97);
  animation: chipIn .55s cubic-bezier(.16,1,.3,1) .2s forwards;
}
@keyframes chipIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sc-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #8a6fd4 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 800; color: #fff; letter-spacing: 0;
  flex-shrink: 0; position: relative;
}
.sc-avatar::after {
  content: ''; position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px; background: #22c55e;
  border-radius: 50%; border: 2px solid #fff;
  animation: scPulse 2.8s ease-in-out infinite;
}
@keyframes scPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.45); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.sc-text { flex: 1; min-width: 0; }
.sc-greeting {
  font-size: .86rem; font-weight: 700;
  color: #1a1826; line-height: 1.25; white-space: nowrap;
}
.sc-status {
  font-size: .68rem; color: #9896a4; margin-top: 1px; font-weight: 500;
}

.sc-logout {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #c4c2cc; transition: background .18s ease, color .18s ease;
  margin-left: 2px;
}
.sc-logout:hover { background: rgba(239,68,68,.07); color: #ef4444; }
.sc-logout svg { width: 15px; height: 15px; }

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  padding: 8px;
}
.menu-toggle span {
  width: 24px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* Mobile overlay */
.mobile-nav {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 999;
  padding: 80px 32px 32px;
  display: none;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.mobile-nav.open { display: flex; }
.mobile-nav-link {
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.mobile-nav-link:hover { background: var(--section); color: var(--primary); }
.mobile-nav .btn-connect {
  margin: 16px 0 0;
  text-align: center;
  padding: 14px 24px;
  display: block;
}
.mobile-close {
  position: absolute;
  top: 20px; right: 24px;
  background: none;
  font-size: 1.8rem;
  color: var(--text);
  padding: 8px;
  line-height: 1;
}
