/* ============================================================
   LAYOUT – QUIZ DE CARABIN (version corrigée)
   ============================================================ */

:root {
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --mobile-nav-height: 60px;
}

/* Layout principal */
.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface-0);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1030;
  transition: transform 0.3s ease;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  height: 36px;
  width: auto;
  border-radius: 8px;
}

.sidebar-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--primary);
  color: white;
}

.nav-item.active i {
  color: white;
}

.sidebar-footer {
  padding: 1rem 0.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-footer .btn {
  justify-content: flex-start;
  width: 100%;
}

/* Zone principale */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  transition: background 0.2s;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: var(--shadow-xs);
  gap: 1rem;
}

.topbar-hamburger {
  display: none;
  font-size: 1.25rem;
}

.topbar-page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

.topbar-notif-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15em 0.4em;
  border-radius: 50%;
  min-width: 18px;
  text-align: center;
  line-height: 1;
}

/* Dropdown profil personnalisé */
.profile-dropdown {
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--surface-0);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 0.5rem 0;
  display: none;
  z-index: 1050;
}

.profile-menu.show {
  display: block;
}

.profile-menu a {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.profile-menu a:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.profile-menu a.text-danger {
  color: var(--danger) !important;
}

.profile-menu hr {
  margin: 0.3rem 0;
  border: none;
  border-top: 1px solid var(--border-color);
}

/* Contenu principal */
.content-area {
  flex: 1;
  padding: 1.5rem;
}

/* Barre de navigation mobile */
.mobile-navbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--surface-0);
  border-top: 1px solid var(--border-color);
  justify-content: space-around;
  align-items: center;
  z-index: 1025;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-decoration: none;
  padding: 0.25rem;
  transition: color 0.15s;
}

.mobile-nav-item i {
  font-size: 1.3rem;
  margin-bottom: 0.1rem;
}

.mobile-nav-item.active {
  color: var(--primary);
}

/* ========== Responsive ========== */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    width: 260px;
    left: 0;
    transform: translateX(-100%);
    position: fixed;
    z-index: 1040;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .main-area {
    margin-left: 0;
  }

  .topbar-hamburger {
    display: inline-flex;
  }

  .mobile-navbar {
    display: flex;
  }

  .content-area {
    padding-bottom: calc(var(--mobile-nav-height) + 1rem);
  }
}