/**
 * SB Admin 2 – Layout/Styling angepasst für Bootstrap 5.
 * Inspiriert von https://startbootstrap.com/theme/sb-admin-2 (MIT).
 */
@import url("https://fonts.googleapis.com/css?family=Nunito:200,300,400,600,700,800,900&display=swap");

:root {
  --sb-primary: #4e73df;
  --sb-primary-dark: #224abe;
  --sb-gray: #858796;
  --sb-gray-400: #d1d3e2;
  --sb-gray-700: #5a5c69;
  --sb-light: #f8f9fc;
  --sb-border: #e3e6f0;
  --sb-success: #1cc88a;
  --sb-success-dark: #13855c;
  --sb-danger: #e74a3b;
  --sb-danger-dark: #be2617;
  --sb-warning: #f6c23e;
  --sb-info: #36b9cc;
  --sb-chart-grid: rgba(234, 236, 244, 0.85);
}

.text-sb-primary {
  color: var(--sb-primary) !important;
}

.text-sb-success {
  color: var(--sb-success) !important;
}

.text-sb-danger {
  color: var(--sb-danger) !important;
}

.text-sb-info {
  color: var(--sb-info) !important;
}

.text-sb-warn {
  color: #dda20a !important;
}

.text-sb-warning {
  color: #dda20a !important;
}

/** Karten wie im SB Admin 2- Raster (Schatten, Kopfzeile, linker Farbakzent) */
.sb-theme-card {
  border: 1px solid var(--sb-border);
  border-radius: 0.35rem;
  background: #fff;
  box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.12) !important;
}

.sb-theme-card.sb-accent-primary {
  border-left: 0.25rem solid var(--sb-primary);
}

.sb-theme-card.sb-accent-success {
  border-left: 0.25rem solid var(--sb-success);
}

.sb-theme-card.sb-accent-danger {
  border-left: 0.25rem solid var(--sb-danger);
}

.sb-theme-card.sb-accent-info {
  border-left: 0.25rem solid var(--sb-info);
}

.sb-theme-card.sb-accent-warn {
  border-left: 0.25rem solid var(--sb-warning);
}

.sb-theme-card.sb-accent-warning {
  border-left: 0.25rem solid var(--sb-warning);
}

.bd-card-header-clickable {
  cursor: default;
  user-select: none;
}
.bd-card-header-clickable:hover .bd-detail-hint {
  opacity: 0.85 !important;
}
.bd-popover-products {
  max-width: 360px;
  font-size: 0.82rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  border: 1px solid #dee2e6;
}
.bd-popover-products .popover-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 6px 12px;
}
.bd-popover-products .popover-body {
  padding: 8px 12px;
  color: #212529;
}
.bd-popover-products .bdp-table {
  width: 100%;
  border-collapse: collapse;
}
.bd-popover-products .bdp-table th {
  color: #6c757d;
  font-weight: 500;
  padding: 2px 4px;
  border-bottom: 1px solid #dee2e6;
  white-space: nowrap;
}
.bd-popover-products .bdp-table td {
  padding: 3px 4px;
  vertical-align: top;
}
.bd-popover-products .bdp-table tr:not(:last-child) td {
  border-bottom: 1px solid #f0f0f0;
}
.bd-popover-products .bdp-num {
  text-align: right;
  white-space: nowrap;
  padding-left: 12px;
}
.bd-popover-products .bdp-total-row td {
  border-top: 2px solid #dee2e6 !important;
  padding-top: 5px;
}

.sb-theme-card .card-header {
  background-color: var(--sb-light);
  border-bottom: 1px solid var(--sb-border);
  padding: 0.75rem 1.25rem;
  font-weight: 800;
  font-size: 0.875rem;
  letter-spacing: 0.03em;
}

.sb-theme-card .card-body:last-child {
  border-bottom-left-radius: 0.35rem;
  border-bottom-right-radius: 0.35rem;
}

.sb-team-nested {
  border: none;
  border-radius: 0;
  background: transparent;
}

.sb-team-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
}

.btn-primary {
  background-color: var(--sb-primary);
  border-color: var(--sb-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--sb-primary-dark);
  border-color: var(--sb-primary-dark);
}

.btn-primary:focus {
  box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.28);
}

html,
body {
  font-family: Nunito, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.text-gray-400 {
  color: var(--sb-gray-400) !important;
}

.text-gray-600 {
  color: var(--sb-gray) !important;
}

#wrapper {
  display: flex;
  width: 100%;
  overflow-x: hidden;
}

#wrapper #content-wrapper {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  background-color: var(--sb-light);
  min-height: 100vh;
}

aside.sidebar {
  width: 14rem;
  min-height: 100vh;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sb-primary) 10%, var(--sb-primary-dark) 100%);
}

aside.sidebar .sidebar-brand {
  height: 4.375rem;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem 0.5rem;
}

aside.sidebar .sidebar-brand .sidebar-brand-text {
  color: #fff;
}

aside.sidebar .sidebar-brand:hover {
  color: #fff;
  text-decoration: none;
}

aside.sidebar .sidebar-brand-icon i {
  font-size: 1.75rem;
}

.sidebar-brand-sub {
  font-size: 0.65rem;
  font-weight: 400;
  opacity: 0.85;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.2;
  text-align: center;
  padding: 0 0.75rem 0.75rem;
}

.sidebar-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin: 0 1rem 0.5rem;
}

aside.sidebar .nav-item .nav-link {
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

aside.sidebar .nav-item .nav-link i {
  width: 1.25rem;
  text-align: center;
  opacity: 0.85;
}

aside.sidebar .nav-item .nav-link:hover {
  color: #fff;
}

aside.sidebar .nav-item.active > .nav-link,
aside.sidebar .nav-item .nav-link.active {
  color: #fff;
}

aside.sidebar .nav-item .nav-link[data-bs-toggle="collapse"] {
  position: relative;
}

aside.sidebar .nav-item .nav-link[data-bs-toggle="collapse"]::after {
  content: "\f107";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  right: 1rem;
  transition: transform 0.2s ease;
}

aside.sidebar .nav-item .nav-link[data-bs-toggle="collapse"]:not(.collapsed)::after {
  transform: rotate(-180deg);
}

.collapse-inner {
  padding: 0.5rem 0;
  margin: 0 0.75rem 0.5rem;
}

.collapse-item {
  display: block;
  padding: 0.5rem 1rem;
  margin: 0 0.25rem;
  color: #3a3b45;
  text-decoration: none;
  border-radius: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.collapse-item:hover {
  background-color: #eaecf4;
  color: #3a3b45;
  text-decoration: none;
}

.collapse-item.active {
  color: var(--sb-primary);
  font-weight: 700;
}

.topbar {
  box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

.sticky-footer {
  flex-shrink: 0;
}

/** Vollbild-Abdeckung wenn mobil der Sidebar-Drawer offen ist (schließen per Tap) */
#sidebarDrawerOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1035;
  background: rgba(0, 0, 0, 0.38);
  -webkit-tap-highlight-color: transparent;
}

#sidebarDrawerOverlay.active {
  display: block;
}

@media (min-width: 768px) {
  #sidebarDrawerOverlay,
  #sidebarDrawerOverlay.active {
    display: none !important;
  }
}

/**
 * sidebar-toggled: Desktop = Sidebar eingeklappt (Breite 0).
 * Mobile (&lt;768px): dieselbe Klasse öffnet den Drawer (Sidebar von links ein).
 */
@media (min-width: 768px) {
  #wrapper {
    flex-direction: row;
  }

  body.sidebar-toggled aside.sidebar {
    width: 0 !important;
    min-width: 0;
    overflow: hidden;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

@media (max-width: 767.98px) {
  #wrapper {
    flex-direction: row;
  }

  aside.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: min(14rem, 90vw) !important;
    max-width: 90vw;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: none;
  }

  body.sidebar-toggled aside.sidebar {
    transform: translateX(0);
    box-shadow: 0.35rem 0 1.25rem rgba(0, 0, 0, 0.18);
  }
}
