.layout {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg, #1e293b);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.2s ease;
}

.sidebarCollapsed {
  width: 60px;
}

/* ===== Brand / Logo ===== */
.brand {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 68px;
}

.sidebarCollapsed .brand {
  padding: 1.25rem 0;
  justify-content: center;
  min-height: 56px;
}

.brand h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #60a5fa;
  white-space: nowrap;
}

.collapseBtn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collapseBtn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

/* ===== Navigation ===== */
.nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.navSection {
  padding: 1rem 1.5rem 0.5rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
}

.navSectionToggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 1.5rem 0.5rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
}

.navSectionToggle:hover {
  color: rgba(255, 255, 255, 0.7);
}

.chevron {
  transition: transform 0.2s ease;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.chevronOpen {
  transform: rotate(0deg);
}

.navDivider {
  margin: 0.5rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.navLink {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1.5rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
}

.sidebarCollapsed .navLink {
  padding: 0.625rem 0;
  justify-content: center;
  border-left: none;
}

.navLink:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.active {
  color: white;
  background: rgba(96, 165, 250, 0.15);
  border-left-color: #60a5fa;
}

.sidebarCollapsed .active {
  border-left-color: transparent;
}

/* ===== Admin-Bereich ueber dem Profil ===== */
.adminSection {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebarCollapsed .adminSection {
  padding: 0.5rem 0.25rem;
}

.adminLink {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.sidebarCollapsed .adminLink {
  padding: 0.625rem 0;
  justify-content: center;
}

.adminLink:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.adminLinkActive {
  color: white;
  background: rgba(96, 165, 250, 0.15);
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.2s ease;
  display: flex;
  flex-direction: column;
}

.mainContent {
  flex: 1;
  padding: 2rem;
}

/* ===== Topbar (oben rechts: Profil + Logout + Modiwahl) ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.625rem;
  padding: 0.5rem 1.5rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  min-height: 52px;
}

/* Theme-Schalter Gruppe */
.topbarThemeGroup {
  display: flex;
  gap: 2px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.topbarThemeBtn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 3px;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}

.topbarThemeBtn:hover {
  color: var(--color-text);
  background: var(--color-bg-card);
}

.topbarThemeBtnActive {
  background: var(--color-primary);
  color: white !important;
}

/* Benutzer-Profil */
.topbarUser {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem 0.25rem 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.topbarUser:hover {
  background: var(--color-bg-card);
  border-color: var(--color-border);
}

.topbarUserName {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}

/* Abmelden-Button */
.topbarIconBtn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.topbarIconBtn:hover {
  background: var(--color-bg-card);
  color: var(--color-text);
}
