/*
  style.css definiert die Farbpalette und das Layout für das Dashboard.
  Die Variablen im :root‑Block entsprechen weitgehend dem gelieferten
  Corporate‑Design der Wilhelm Systems SE. Kommentare erklären
  Zweck und Zusammenspiel der einzelnen Blöcke.
*/

:root {
  /* Primäre Farbpalette – übernommen aus der Vorlage */
  --navy-950: #07162f;
  --navy-900: #0b1f41;
  --navy-800: #15345f;
  --blue-700: #0967bf;
  --blue-600: #1678d3;
  --blue-500: #2f8be6;
  --blue-300: #8fc1ec;
  --blue-100: #e9f4ff;
  --green-700: #10805c;
  --green-600: #14956a;
  --green-100: #e8f8f1;
  --text: #121e35;
  --muted: #657083;
  --muted-2: #8a94a6;
  --border: #e2e8f0;
  --border-strong: #d7dee8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --sidebar: #fbfcfe;
  --shadow: 0 1px 2px rgb(15 23 42 / 4%), 0 5px 18px rgb(15 23 42 / 4%);
  /* Layout‑Größen – feste Breite für 1080 p */
  --content-max-width: 1080px;
  --sidebar-width: 240px;
  --header-height: 80px;
  --radius: 7px;
  --transition: 180ms ease;
}

/* Allgemeine Reset‑Einstellungen */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--surface);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Container für die gesamte Anwendung. Zwei Spalten: Sidebar und Hauptinhalt. */
.dashboard-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) auto;
  min-height: 100vh;
}

/* Sidebar – bleibt auf der linken Seite fixiert. */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
  overflow-y: auto;
}

/* Logo‑Bereich in der Sidebar */
.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.logo svg {
  width: 32px;
  height: 32px;
  fill: var(--blue-600);
}

.brand-name {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--navy-950);
}

/* Navigation in der Sidebar */
.nav-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  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);
  color: var(--navy-950);
  text-decoration: none;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: #f0f6fd;
  color: var(--blue-700);
}

.nav-item.active {
  background: #e8f2fc;
  color: var(--blue-700);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Hauptbereich: enthält Header und Inhalt. Padding sorgt für Abstand zur Sidebar. */
.main-area {
  grid-column: 2 / -1;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  /* Da die Sidebar fixiert ist, nutzen wir innen einen linken
     Padding anstelle eines negativen Margins. Damit bleibt der
     Inhalt sichtbar und passt sich der Seitenbreite an. */
  padding-left: calc(var(--sidebar-width) + 2rem);
  max-width: var(--content-max-width);
  width: 100%;
  margin-right: auto;
}

/* Header‑Leiste oben im Hauptbereich */
.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* KPI‑Sektion: Zeile mit kompakten Karten. */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.5rem 2rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-title {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--navy-950);
}

.kpi-change {
  font-size: 0.875rem;
  color: var(--green-600);
}

/* Abschnitt für Charts und Tabellen */
.content-section {
  margin: 0 2rem 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-950);
}

.chart-select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.chart-canvas {
  width: 100% !important;
  height: 300px !important;
}

/* Tabelle für die Holdings */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
}

td {
  font-size: 0.875rem;
  color: var(--navy-950);
}

/* Status‑Farben für positive und negative Veränderungen in der Tabelle */
.positive {
  color: var(--green-600);
}

.negative {
  color: #d9534f;
}

/* Footer am Seitenende */
.footer {
  margin: 2rem 2rem 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 768px) {
  /* Kleine Bildschirme – Sidebar ausblenden und als Drawer implementieren */
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 20;
    transition: transform var(--transition);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-area {
    margin-left: 0;
    max-width: 100%;
  }
}