/* ==========================================================================
   THW-TASCHENKARTE: CORE DESIGN SYSTEM & THEMES
   Farbschema: THW-Blau (#003399), Signalgelb (#FFCC00), Dark-Mode & E-Ink
   100% Emojifrei - Monochrome Vektorsymbole & THW-Konformität
   ========================================================================== */

:root {
  /* THW Identity */
  --thw-blue: #003399;
  --thw-blue-hover: #002673;
  --thw-blue-dark: #001f5c;
  --thw-blue-light: #0055d4;
  --thw-blue-subtle: #e6eefc;
  --thw-yellow: #ffcc00;
  --thw-yellow-hover: #e6b800;
  --thw-yellow-subtle: #fff9e6;

  /* Status- und Signalfarben */
  --color-danger: #c9302c;
  --color-danger-subtle: #fdf2f2;
  --color-warning: #d97706;
  --color-warning-subtle: #fef9e7;
  --color-success: #15803d;
  --color-success-subtle: #f0fdf4;
  --color-info: #0369a1;
  --color-info-subtle: #f0f9ff;

  /* Neutraltöne (Light Mode) */
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-sidebar: #0f1e36;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  --border-color: #cbd5e1;
  --border-strong: #94a3b8;

  /* Typografie & Spacing */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Schatten */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15);

  /* Layout */
  --header-height: 60px;
  --sidebar-width: 380px;
  --content-max-width: 1120px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ==========================================================================
   DARK MODE (Fokus auf Nachteinsatz & augenschonendes Arbeiten)
   ========================================================================== */
body.theme-dark {
  --bg-app: #090f1d;
  --bg-surface: #101c33;
  --bg-surface-elevated: #162645;
  --bg-sidebar: #070c18;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #1e335a;
  --border-strong: #2c497d;
  --thw-blue-subtle: rgba(0, 51, 153, 0.35);
  --color-danger-subtle: rgba(201, 48, 44, 0.2);
  --color-warning-subtle: rgba(217, 119, 6, 0.2);
  --color-success-subtle: rgba(21, 128, 61, 0.2);
  --color-info-subtle: rgba(3, 105, 161, 0.2);
}

/* ==========================================================================
   E-INK HIGH-CONTRAST MODE (Optimiert für E-Reader wie Tolino, Kindle, Boox)
   ========================================================================== */
body.theme-eink {
  --bg-app: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-sidebar: #ffffff;
  --text-primary: #000000;
  --text-secondary: #000000;
  --text-muted: #000000;
  --text-inverse: #ffffff;
  --thw-blue: #000000;
  --thw-blue-hover: #000000;
  --thw-blue-dark: #000000;
  --thw-yellow: #000000;
  --border-color: #000000;
  --border-strong: #000000;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-xl: none;
  --thw-blue-subtle: #ffffff;
  --color-danger: #000000;
  --color-warning: #000000;
  --color-success: #000000;
  --color-info: #000000;
}

body.theme-eink * {
  box-shadow: none !important;
  text-shadow: none !important;
  transition: none !important;
  border-color: #000000 !important;
}

/* ==========================================================================
   GLOBAL BASE STYLES & SCROLLBARS
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Sichtbare, responsive Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--thw-blue);
}

/* Firefox Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--bg-app);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top App Header */
.app-header {
  height: var(--header-height);
  background: var(--thw-blue-dark);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  box-shadow: var(--shadow-md);
  z-index: 100;
  flex-shrink: 0;
  border-bottom: 3px solid var(--thw-yellow);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: transparent;
  padding: 0;
  display: block;
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  flex-direction: column;
}

.brand-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--thw-yellow);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Workspace Body */
.workspace-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  height: calc(100vh - var(--header-height));
  min-height: 0;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  height: 100%;
  min-height: 0;
  z-index: 40;
  transition: transform var(--transition-normal);
}

/* Search and Multi-Taxonomy Area */
.sidebar-controls {
  padding: 0.75rem 0.85rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sidebar-cards-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}

/* Main Content Area - 100% Zuverlässig und flüssig scrollbar */
.content-area {
  flex: 1;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 1.5rem 1.75rem 6rem 1.75rem;
  background: var(--bg-app);
  display: block;
  position: relative;
  scroll-behavior: smooth;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.card-view-wrapper {
  width: 100%;
  max-width: var(--content-max-width);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 0 auto 3rem auto;
}

/* Responsive */
@media (max-width: 960px) {
  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 330px;
    box-shadow: var(--shadow-xl);
    transform: translateX(-100%);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .content-area {
    padding: 0.75rem 0.75rem 5rem 0.75rem;
  }
}
