/**
 * Dirrichs Portal - Global Design System
 * Basierend auf ai-services.css
 * Version: 1.0.0
 * Erstellt: 2026-05-02
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */

:root {
  /* === Color Scheme === */
  color-scheme: dark;
  
  /* Background Colors */
  --bg-primary: #081018;
  --bg-secondary: #101b27;
  --bg-card: #0d1721;
  --bg-elevated: #152233;
  --bg-hover: #1a2d42;
  --bg-input: #06101a;
  
  /* Border Colors */
  --border-subtle: #22364c;
  --border-default: #2d4a6b;
  --border-strong: #3d6a8b;
  --border-focus: var(--accent);
  
  /* Text Colors */
  --text-primary: #e9f2ff;
  --text-secondary: #9fb3c8;
  --text-muted: #6b8299;
  --text-disabled: #4a5f73;
  
  /* Accent Colors */
  --accent: #45c4ff;
  --accent-hover: #67d0ff;
  --accent-muted: #2a7ab8;
  --accent-subtle: rgba(69, 196, 255, 0.1);
  --accent-glow: rgba(69, 196, 255, 0.15);
  
  /* Status Colors */
  --status-success: #3bd98c;
  --status-success-subtle: rgba(59, 217, 140, 0.15);
  --status-warning: #f3b95f;
  --status-warning-subtle: rgba(243, 185, 95, 0.15);
  --status-error: #ff6b6b;
  --status-error-subtle: rgba(255, 107, 107, 0.15);
  --status-info: #45c4ff;
  --status-info-subtle: rgba(69, 196, 255, 0.15);
  --status-unknown: #6b8299;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px var(--accent-glow);
  
  /* Gradients */
  --gradient-bg: radial-gradient(circle at 15% 0%, #14314a, var(--bg-primary) 36rem);
  --gradient-card: linear-gradient(160deg, rgba(16, 27, 39, .95), rgba(8, 16, 24, .96));
  --gradient-header: linear-gradient(180deg, var(--bg-secondary) 0%, transparent 100%);
  
  /* === Typography === */
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, monospace;
  
  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  
  /* === Spacing === */
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem;
  --space-1: 0.25rem;
  --space-1-5: 0.375rem;
  --space-2: 0.5rem;
  --space-2-5: 0.625rem;
  --space-3: 0.75rem;
  --space-3-5: 0.875rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-9: 2.25rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  
  /* === Border Radius === */
  --radius-none: 0;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-3xl: 1.5rem;
  --radius-full: 9999px;
  
  /* === Transitions === */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* === Z-Index === */
  --z-dropdown: 50;
  --z-sticky: 100;
  --z-modal: 200;
  --z-tooltip: 300;
  --z-toast: 400;
  
  /* === Container === */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;
}

/* ============================================
   CSS RESET & BASE
   ============================================ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--gradient-bg);
  min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  line-height: var(--leading-relaxed);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

code, pre {
  font-family: var(--font-mono);
}

code {
  background: var(--bg-elevated);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

pre {
  background: #050b11;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  overflow-x: auto;
}

/* ============================================
   LAYOUT
   ============================================ */

.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-decoration: none;
}

.topnav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.main-content {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  width: 100%;
}

/* ============================================
   NAVIGATION
   ============================================ */

.tab-bar {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  flex-wrap: wrap;
}

.tab-pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.tab-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.tab-pill--active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.tab-pill--active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-3xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-lg);
}

.card-banner {
  padding: var(--space-8);
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-3xl);
  margin-bottom: var(--space-6);
}

.portal-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.portal-card:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.portal-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.portal-card__icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.portal-card__arrow {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.portal-card:hover .portal-card__arrow {
  transform: translate(2px, -2px);
  color: var(--accent);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn,
button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.btn:active,
button:active {
  transform: scale(0.98);
}

.btn-primary,
button.primary,
a.button {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn-primary:hover,
button.primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}

.btn-secondary,
button.secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-ghost,
button.ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-danger,
button.danger {
  background: var(--status-error);
  color: white;
}

.btn-danger:hover {
  background: #ff5252;
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

/* ============================================
   FORMS
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

label span {
  color: var(--text-muted);
  font-weight: var(--font-normal);
}

.form-group {
  margin-bottom: var(--space-4);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
}

/* ============================================
   STATUS & BADGES
   ============================================ */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-pill--online {
  background: var(--status-success-subtle);
  color: var(--status-success);
}
.status-pill--online::before { background: var(--status-success); }

.status-pill--offline {
  background: var(--status-error-subtle);
  color: var(--status-error);
}
.status-pill--offline::before { background: var(--status-error); }

.status-pill--warning {
  background: var(--status-warning-subtle);
  color: var(--status-warning);
}
.status-pill--warning::before { background: var(--status-warning); }

.status-pill--unknown {
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.status-pill--unknown::before { background: var(--text-muted); }

.pill {
  display: inline-flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg-primary);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid;
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.alert-success {
  background: var(--status-success-subtle);
  border-color: var(--status-success);
  color: var(--status-success);
}

.alert-error {
  background: var(--status-error-subtle);
  border-color: var(--status-error);
  color: var(--status-error);
}

.alert-warning {
  background: var(--status-warning-subtle);
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.alert-info {
  background: var(--status-info-subtle);
  border-color: var(--status-info);
  color: var(--status-info);
}

/* ============================================
   GRIDS
   ============================================ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.grid-sm {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid-lg {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.link-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* ============================================
   TABLES
   ============================================ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-subtle);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: var(--font-semibold);
  border-bottom: 1px solid var(--border-subtle);
}

td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-elevated);
}

/* ============================================
   UTILITIES
   ============================================ */

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--status-success); }
.text-warning { color: var(--status-warning); }
.text-error { color: var(--status-error); }

/* Text Sizes */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

/* Font Weights */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* Text Helpers */
.text-center { text-align: center; }
.text-right { text-align: right; }
.lead { color: var(--text-muted); font-size: var(--text-lg); line-height: var(--leading-relaxed); }
.eyebrow { font-size: var(--text-xs); font-weight: var(--font-medium); color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-wider); }

/* Display */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* Visibility */
.hidden { display: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .main-content {
    padding: var(--space-4);
  }
  
  .topbar {
    padding: var(--space-3) var(--space-4);
  }
  
  .card {
    padding: var(--space-4);
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  .tab-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-2);
  }
  
  .tab-pill {
    flex-shrink: 0;
  }
}

/* ============================================
   DARK MODE ONLY (forced)
   ============================================ */

@media (prefers-color-scheme: light) {
  :root {
    /* Keep dark mode regardless of system preference */
    color-scheme: dark;
  }
}

/* Test link */
@keyframes test-pulse {
    0%, 100% { box-shadow: 0 0 5px #ff00ff; }
    50% { box-shadow: 0 0 15px #ff00ff, 0 0 25px #ff00ff; }
}
