/**
 * Arbeitsblatt-Studio - Theme System
 * Light/Dark Mode mit CSS Custom Properties
 * Version: 2.0 - Enhanced with animations, secondary colors, and improved shadows
 */

/* ===== LIGHT MODE (Default) ===== */
:root {
  color-scheme: light;

  /* Hintergrund-Farben (wärmer: Stone statt Slate) */
  --bg-page: #fafaf9;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle: #f5f5f4;
  --bg-hover: #f5f5f4;

  /* Text-Farben */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Border-Farben */
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-subtle: #f1f5f9;

  /* Sidebar */
  --sidebar-bg: #ffffff;
  --sidebar-border: #e2e8f0;
  --sidebar-hover: #f1f5f9;
  --sidebar-active: #eff6ff;

  /* Schatten (6 Levels) */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.03);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  /* Farbige Shadows */
  --shadow-primary: 0 4px 14px 0 rgb(37 99 235 / 0.25);
  --shadow-success: 0 4px 14px 0 rgb(5 150 105 / 0.25);
  --shadow-danger: 0 4px 14px 0 rgb(220 38 38 / 0.25);

  /* Overlay */
  --overlay-bg: rgba(15, 23, 42, 0.5);

  /* Secondary Color (Sky Blue - Clean, Professional) */
  --secondary: #0ea5e9;
  --secondary-light: #38bdf8;
  --secondary-dark: #0284c7;
  --secondary-bg: #f0f9ff;

  /* Accent Color (matches Primary Light - no separate Violet) */
  --accent: #60a5fa;
  --accent-light: #93c5fd;
  --accent-dark: #3b82f6;
  --accent-bg: #eff6ff;

  /* Animation Timing Functions */
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Animation Durations */
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;

  /* Info-Farben (Blue tones for informational messages) */
  --info: #1e40af;
  --info-bg: #dbeafe;
  --info-border: #93c5fd;

  /* Lighter status variants (used for subtle backgrounds) */
  --success-light: #dcfce7;
  --danger-light: #fee2e2;

  /* Additional aliases used by shared/teacher CSS */
  --bg-muted: #f5f5f4;
  --border-light: #f1f5f9;
  --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  color-scheme: dark;

  /* Hintergrund-Farben */
  --bg-page: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #334155;
  --bg-subtle: #1e293b;
  --bg-hover: #334155;

  /* Text-Farben */
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  /* Border-Farben */
  --border-default: #334155;
  --border-strong: #475569;
  --border-subtle: #1e293b;

  /* Sidebar */
  --sidebar-bg: #1e293b;
  --sidebar-border: #334155;
  --sidebar-hover: #334155;
  --sidebar-active: rgba(59, 130, 246, 0.15);

  /* Schatten (stärker im Dark Mode, 6 Levels) */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.5);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);

  /* Farbige Shadows (angepasst für Dark Mode) */
  --shadow-primary: 0 4px 14px 0 rgb(59 130 246 / 0.3);
  --shadow-success: 0 4px 14px 0 rgb(34 197 94 / 0.3);
  --shadow-danger: 0 4px 14px 0 rgb(239 68 68 / 0.3);

  /* Overlay */
  --overlay-bg: rgba(0, 0, 0, 0.7);

  /* Primary-Farben angepasst für Dark Mode */
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --primary-bg: rgba(59, 130, 246, 0.15);

  /* Secondary Color (Sky Blue - Clean, Professional) */
  --secondary: #38bdf8;
  --secondary-light: #7dd3fc;
  --secondary-dark: #0ea5e9;
  --secondary-bg: rgba(14, 165, 233, 0.15);

  /* Accent Color (matches Primary Light - no separate Violet) */
  --accent: #93c5fd;
  --accent-light: #bfdbfe;
  --accent-dark: #60a5fa;
  --accent-bg: rgba(59, 130, 246, 0.15);

  /* Status-Farben angepasst für Dark Mode */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --success-border: rgba(34, 197, 94, 0.3);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.3);

  --warning: #eab308;
  --warning-bg: rgba(234, 179, 8, 0.15);
  --warning-border: rgba(234, 179, 8, 0.3);

  /* Info-Farben (Blue tones for informational messages) */
  --info: #93c5fd;
  --info-bg: rgba(59, 130, 246, 0.15);
  --info-border: rgba(59, 130, 246, 0.3);

  /* Lighter status variants (used for subtle backgrounds) */
  --success-light: rgba(34, 197, 94, 0.2);
  --danger-light: rgba(239, 68, 68, 0.2);

  /* Additional aliases */
  --bg-muted: #1e293b;
  --border-light: #1e293b;
}

/* System-Präferenz respektieren (wenn kein manuelles Theme gesetzt) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-elevated: #334155;
    --bg-subtle: #1e293b;
    --bg-hover: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;

    --border-default: #334155;
    --border-strong: #475569;
    --border-subtle: #1e293b;

    --sidebar-bg: #1e293b;
    --sidebar-border: #334155;
    --sidebar-hover: #334155;
    --sidebar-active: rgba(59, 130, 246, 0.15);

    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);

    --overlay-bg: rgba(0, 0, 0, 0.7);

    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --primary-bg: rgba(59, 130, 246, 0.15);

    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --success-border: rgba(34, 197, 94, 0.3);

    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --danger-border: rgba(239, 68, 68, 0.3);

    --warning: #eab308;
    --warning-bg: rgba(234, 179, 8, 0.15);
    --warning-border: rgba(234, 179, 8, 0.3);

    /* Info-Farben */
    --info: #93c5fd;
    --info-bg: rgba(59, 130, 246, 0.15);
    --info-border: rgba(59, 130, 246, 0.3);

    /* Lighter status variants */
    --success-light: rgba(34, 197, 94, 0.2);
    --danger-light: rgba(239, 68, 68, 0.2);

    /* Additional aliases */
    --bg-muted: #1e293b;
    --border-light: #1e293b;
  }
}

/* ===== SMOOTH TRANSITIONS ===== */
html {
  transition: background-color 0.2s ease, color 0.2s ease;
}

body,
.sidebar,
.card,
.modal,
input,
textarea,
select,
button {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* ===== REDUCED MOTION (Accessibility) ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
