/* css/layout.css — dashboard v2
   ─────────────────────────────────────────────────────────────── */

/* ── BOOT LOADER ─────────────────────────────────────────────────────────── */
.boot-loader {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-5);
}

.boot-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.boot-spinner {
  width: 28px; height: 28px;
  border: 2px solid rgba(123,47,247,0.2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

.boot-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  animation: pulse-opacity 2s ease-in-out infinite;
}

/* ── LOGO (sidebar + auth + boot) ────────────────────────────────────────── */
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: var(--purple);
  color: #fff;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 900;
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.sidebar-logo {
  height: 22px;
  width: auto;
  display: block;
  /* Le SVG est blanc — aucun filtre nécessaire */
}

/* ── AUTH PAGES ──────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-5);
  background:
    radial-gradient(ellipse 70% 50% at 50% -5%, rgba(123,47,247,0.12) 0%, transparent 65%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  animation: scale-in var(--dur-slow) var(--ease);
}

.auth-card--center { text-align: center; }

.auth-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.auth-tagline {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: var(--space-8);
  font-weight: 500;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

.auth-link {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--dur-fast);
  background: none;
  border: none;
}

.auth-link:hover { color: var(--purple); }
.auth-link-sep   { color: var(--text-muted); }

/* Pending */
.pending-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: .6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pending-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: var(--space-3);
}

.pending-body {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: var(--space-8);
  line-height: 1.6;
}

/* ── APP LAYOUT ──────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg, #0e0e10);
  overflow: hidden; /* pas de scroll ni de débordement sur la sidebar */
}

.sidebar-brand {
  padding: 22px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.nav-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px 0;
  overflow-y: auto;
  overflow-x: hidden;
  /* scrollbar invisible sur la sidebar */
  scrollbar-width: none;
}
.nav-list::-webkit-scrollbar { display: none; }

/* ── NAV ITEMS ───────────────────────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
  /* Pas de border-left sur l'élément — stripe via ::before */
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.75);
}

.nav-item.active {
  background: rgba(123,47,247,0.14);
  color: #fff;
  font-weight: 600;
}

/* Stripe gauche sur l'item actif (pseudo-element — zéro layout shift) */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%; bottom: 25%;
  width: 3px;
  background: var(--purple);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }

/* Toggle icône outline ↔ filled */
.nav-item .icon-active   { display: none; }
.nav-item .icon-inactive { display: block; }
.nav-item.active .icon-active   { display: block; }
.nav-item.active .icon-inactive { display: none; }

.nav-label { flex: 1; }

.nav-badge {
  background: var(--purple);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
  line-height: 1.6;
}

/* Séparateur avant Admin */
#nav-admin-li {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── SIDEBAR FOOTER ──────────────────────────────────────────────────────── */
.sidebar-footer {
  flex-shrink: 0;
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-user-btn {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex: 1;
  overflow: hidden;
  padding: 8px !important;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(123,47,247,0.2);
  border: 1.5px solid rgba(123,47,247,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--purple);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.3;
}

.logout-btn {
  color: rgba(255,255,255,0.3);
  transition: color 0.15s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  border-radius: 8px;
  flex-shrink: 0;
}

.logout-btn:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ── MAIN CONTENT ────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 44px 52px;
  min-height: 100vh;
  /* Pas de max-width — le contenu s'étend proprement */
  background: var(--bg);
}

/* ── PAGES ───────────────────────────────────────────────────────────────── */
.page {
  max-width: var(--content-max);
  animation: fade-up var(--dur-slow) var(--ease);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-subtitle {
  color: rgba(255,255,255,0.38);
  font-size: 0.84rem;
  font-weight: 500;
  margin-top: 3px;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: var(--space-4);
}

/* ── RESPONSIVE : mobile bottom nav ──────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    height: 60px;
    flex-direction: row;
    top: auto; bottom: 0;
    padding: 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    border-radius: 0;
    background: rgba(10,10,12,0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: visible;
  }

  .sidebar-brand,
  .sidebar-footer { display: none; }

  .nav-list {
    flex: 1;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    gap: 0;
    padding: 0;
    overflow: visible;
  }

  .nav-item {
    flex-direction: column;
    gap: 2px;
    font-size: 0.58rem;
    padding: 8px 4px 4px;
    border-radius: 0;
    color: rgba(255,255,255,0.4);
    flex: 1;
    justify-content: center;
    align-items: center;
    font-weight: 500;
  }

  .nav-item::before { display: none; } /* pas de stripe sur mobile */

  .nav-item:hover  { background: none; color: rgba(255,255,255,0.7); }
  .nav-item.active {
    background: none;
    color: var(--purple);
    font-weight: 600;
  }
  .nav-item.active .nav-icon { opacity: 1; }

  .nav-icon {
    width: auto;
    font-size: 1.3rem;
    opacity: 1;
  }

  .nav-badge {
    position: absolute;
    top: 6px; right: calc(50% - 18px);
    font-size: 0.58rem;
    padding: 0 4px;
    min-width: 14px;
  }

  #nav-admin-li {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .main {
    margin-left: 0;
    margin-bottom: 60px;
    padding: 20px 16px;
  }

  .page { max-width: 100%; }

  .page-title { font-size: 1.3rem; }
  .auth-card  { padding: 32px 24px; }
}

@media (max-width: 500px) {
  .main { padding: 16px 12px; }
}
