/* ============================================================
   Intranet – Design System
   Farbpalette: Sand + Sage
   ============================================================ */

:root {
  /* Sand */
  --sand-50:  #FAF7F2;
  --sand-100: #F5EDE0;
  --sand-200: #EAD9C4;
  --sand-300: #D4C4A8;
  --sand-400: #BCA888;

  /* Sage */
  --sage-100: #D0DEC8;
  --sage-200: #AECBA0;
  --sage-300: #87A87A;   /* Primär */
  --sage-400: #6B9070;
  --sage-500: #4E7055;   /* Dunkel / Navbar */
  --sage-600: #3A5540;

  /* Rosé (Logo-Akzent) */
  --rose-100: #F2C0CC;
  --rose-300: #CF8096;
  --rose-500: #B86478;

  /* Neutral / Text */
  --warm-900: #2E2420;
  --warm-700: #4A3C34;
  --warm-500: #7A6A60;
  --warm-300: #B0A090;
  --warm-100: #EAE0D8;

  /* Abstraktionen */
  --color-bg:        var(--sand-50);
  --color-surface:   #FFFFFF;
  --color-sidebar-bg: var(--sand-100);
  --color-navbar-bg:  var(--sage-500);
  --color-primary:    var(--sage-300);
  --color-primary-dk: var(--sage-500);
  --color-text:       var(--warm-900);
  --color-text-muted: var(--warm-500);
  --color-border:     var(--sand-200);

  --sidebar-width: 240px;
  --navbar-height: 56px;
  --border-radius: 0.5rem;
}

/* ============================================================
   Reset / Base
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem;
}

/* ============================================================
   Top Navbar
   ============================================================ */

.navbar-top {
  background: var(--color-navbar-bg);
  height: var(--navbar-height);
  padding: 0 1rem;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1040;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 2px solid var(--sage-600);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar-top .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  flex: 1;
}

.navbar-top .brand img {
  height: 36px;
  width: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  padding: 2px;
}

.navbar-top .brand span {
  color: #fff;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-user .btn-icon {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  border-radius: var(--border-radius);
  padding: 0.35rem 0.6rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.nav-user .btn-icon:hover {
  background: rgba(255,255,255,0.22);
}

.sidebar-toggle {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  border-radius: var(--border-radius);
  padding: 0.35rem 0.6rem;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.22);
}

/* ============================================================
   Layout: Sidebar + Content
   ============================================================ */

.layout-body {
  display: flex;
  min-height: calc(100vh - var(--navbar-height));
  margin-top: var(--navbar-height);
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* offcanvas-lg: sidebar ist Schublade auf Mobile, statisch auf Desktop */
@media (min-width: 992px) {
  .sidebar.offcanvas-lg {
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    transform: none !important;
    visibility: visible !important;
  }
}

.sidebar .offcanvas-header {
  background: var(--color-sidebar-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
}

.sidebar .offcanvas-body {
  padding: 0;
  overflow-y: auto;
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 0.75rem 0;
}

.sidebar-section {
  margin-bottom: 0.25rem;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warm-300);
  padding: 0.75rem 1.1rem 0.25rem;
  display: block;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.1rem;
  color: var(--warm-700);
  text-decoration: none;
  border-radius: 0;
  font-size: 0.9rem;
  transition: background 0.12s, color 0.12s;
  position: relative;
}

.sidebar-link:hover {
  background: var(--sand-200);
  color: var(--warm-900);
}

.sidebar-link.active {
  background: var(--sage-100);
  color: var(--sage-600);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-link i {
  font-size: 1rem;
  width: 1.2rem;
  text-align: center;
  opacity: 0.8;
}

.sidebar-link.active i {
  opacity: 1;
}

.sidebar-link.disabled {
  color: var(--warm-300);
  pointer-events: none;
  cursor: default;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0.5rem 0.8rem;
}

/* Sidebar Sub-Links (Einzug) */
.sidebar-link.sub {
  padding-left: 2.5rem;
  font-size: 0.875rem;
}

/* ============================================================
   Haupt-Content
   ============================================================ */

.main-content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 1.25rem;
  overflow-x: hidden;
}

@media (min-width: 992px) {
  .main-content {
    padding: 2rem 2rem;
  }
}

/* ============================================================
   Page Header
   ============================================================ */

.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--warm-900);
}

.page-header .text-muted {
  color: var(--warm-500) !important;
  font-size: 0.875rem;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--warm-900);
}

/* Stat-Card */
.stat-card {
  border-left: 4px solid var(--color-primary);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--warm-900);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn-primary {
  background: var(--sage-300);
  border-color: var(--sage-400);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--sage-400);
  border-color: var(--sage-500);
  color: #fff;
}

.btn-outline-primary {
  color: var(--sage-500);
  border-color: var(--sage-300);
}

.btn-outline-primary:hover {
  background: var(--sage-300);
  border-color: var(--sage-400);
  color: #fff;
}

/* ============================================================
   Badges & Tags
   ============================================================ */

.badge-sage {
  background: var(--sage-100);
  color: var(--sage-600);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25em 0.6em;
  border-radius: 999px;
}

.badge-sand {
  background: var(--sand-200);
  color: var(--warm-700);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25em 0.6em;
  border-radius: 999px;
}

/* ============================================================
   Rollen-Badge
   ============================================================ */

.role-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2em 0.55em;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.role-eltern {
  background: var(--sage-100);
  color: var(--sage-600);
}

.role-kind {
  background: var(--rose-100);
  color: var(--rose-500);
}

.role-admin {
  background: var(--sand-200);
  color: var(--warm-700);
}

/* ============================================================
   Flash Messages
   ============================================================ */

.flash-container {
  margin-bottom: 1rem;
}

/* ============================================================
   Footer
   ============================================================ */

.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--warm-300);
  padding: 1rem;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  background: var(--sand-50);
}

/* ============================================================
   Mobile Anpassungen
   ============================================================ */

@media (max-width: 575px) {
  .main-content {
    padding: 1rem 0.875rem;
  }

  .page-header h1 {
    font-size: 1.2rem;
  }
}

/* ============================================================
   Offcanvas Sidebar auf Mobile
   ============================================================ */

.offcanvas.sidebar {
  width: var(--sidebar-width) !important;
  background: var(--color-sidebar-bg);
}

/* ============================================================
   Scrollbar (Desktop)
   ============================================================ */

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--sand-300);
  border-radius: 2px;
}
