/* App Design System and App Shell */

:root {
  /* Brand tokens (light) */
  --app-primary: #00CFFF; /* Cyan */
  --app-secondary: #1C1C1C; /* Anthrazit */
  --app-bg: #F6F8FB; /* Hintergrund */
  --app-surface: #ffffff; /* Karten/Flächen */
  --app-text: #111827; /* Fast Schwarz */
  --app-muted: #6B7280; /* Grau für Hilfstexte */
  --app-border: #E5E7EB;

  /* Radii & Shadows */
  --app-radius: 8px;
  --app-radius-sm: 6px;
  --app-radius-lg: 12px;
  --app-shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --app-shadow-md: 0 8px 24px rgba(0,0,0,.10);

  /* Bootstrap mappings */
  --bs-body-font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji';
  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--app-text);
  --bs-border-radius: var(--app-radius);
  --bs-border-radius-sm: var(--app-radius-sm);
  --bs-border-radius-lg: var(--app-radius-lg);
  --bs-primary: var(--app-primary);
  --bs-link-color: var(--app-primary);
}

:root[data-bs-theme='dark'] {
  --app-primary: #00CFFF;
  --app-secondary: #0D0F14;
  --app-bg: #0B1220;
  --app-surface: #0F172A;
  --app-text: #E5E7EB;
  --app-muted: #9AA4B2;
  --app-border: #1F2937;

  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--app-text);
}

html, body { height: 100%; }
body.app-body {
  background: linear-gradient(180deg, var(--app-bg), #eef2f7 60%);
}

/* App Shell Layout */
.app-shell { min-height: 100vh; }
.app-sidebar {
  width: 248px;
  background: linear-gradient(180deg, var(--app-secondary), #2a2a2a);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: .75rem 0;
  /* Ensure dropdown menus within the sidebar can appear above main content */
  z-index: 1040;
  overflow: visible;
}
.app-main { min-width: 0; }
.sidebar-brand { font-weight: 600; color: #fff; padding: 0 .75rem 1rem .75rem; font-size: 1.05rem; }
.sidebar-brand i { color: var(--app-primary); }

.sidebar-nav .nav-link {
  color: rgba(255,255,255,.85);
  padding: .5rem .75rem;
  border-radius: 6px;
  margin: 0 .5rem;
  display: flex; align-items: center;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(0,207,255,.18); color: #fff; }
.app-sidebar .nav-section { 
  letter-spacing: .06em; 
  color: rgba(255,255,255,.68) !important; /* ensure contrast on dark sidebar */
}

.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); }

/* Topbar */
.app-topbar {
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  height: 56px;
  padding: 0 .75rem;
}

/* Containers and cards */
.container { max-width: 1120px; }
.card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow-sm); }
.card .card-header { background: var(--app-surface); border-bottom: 1px solid var(--app-border); }

/* Page header & breadcrumbs */
.page-header { padding: .25rem 0 .5rem; border-bottom: 1px solid var(--app-border); }
.breadcrumb { --bs-breadcrumb-divider-color: var(--app-muted); }
.breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: var(--app-muted); }

/* Forms */
.form-control, .form-select { border-radius: var(--app-radius-sm); }
.form-text { color: var(--app-muted); }
.input-group .btn { border-radius: var(--app-radius-sm); }

/* Buttons */
.btn-primary { box-shadow: 0 2px 0 rgba(0,207,255,.25); }

/* Tables (compact) */
.table { --bs-table-bg: var(--app-surface); border-color: var(--app-border); }
.table thead th { background: #f3f6fa; font-weight: 600; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table-sm > :not(caption) > * > * { padding: .4rem .5rem; }

:root[data-bs-theme='dark'] .table thead th { background: #0b1a33; }
:root[data-bs-theme='dark'] .table-hover tbody tr:hover { background: #0b1a33; }

/* Alerts */
.alert { border-radius: var(--app-radius-sm); box-shadow: var(--app-shadow-sm); }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--app-muted); }
.empty-state .icon { font-size: 2rem; color: var(--app-primary); }

/* Responsive Sidebar */
@media (max-width: 991.98px) {
  .app-shell { position: relative; }
  .app-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 1040;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { width: 100%; }
  .app-topbar { position: sticky; top: 0; z-index: 1030; }
}

/* Focus visibility */
:root .btn:focus, :root .form-control:focus, :root .form-select:focus, :root .nav-link:focus {
  box-shadow: 0 0 0 .25rem rgba(0,207,255,.25);
}


/* Main content width control: make right frame contents 90% of the frame on desktop */
@media (min-width: 992px) {
  .app-main > .container {
    width: 90%;
    max-width: 90%;
    margin-left: 0;   /* left align */
    margin-right: auto;
  }
}
