/**
 * Base Styles - Reset, Variablen, Design Tokens
 * Time Tracker v2
 */

/* ========================================
   CSS Custom Properties (Design Tokens)
   ======================================== */

:root {
  /* ========================================
     🎨 BRAND DESIGN - Basierend auf #f7a500
     Farblehre: Komplementär, Analog, Triadisch
     ======================================== */

  /* 🔶 BRAND - Primärfarbe #f7a500 */
  --color-primary: #f7a500;
  --color-primary-hover: #e09500;
  --color-primary-light: #fff7e6;
  --color-primary-dark: #c98500;
  --color-primary-rgb: 247, 165, 0;

  /* 🔵 Komplementär - Blau (gegenüber im Farbkreis) */
  --color-complement: #0062f7;
  --color-complement-light: #e6f0ff;
  --color-complement-rgb: 0, 98, 247;

  /* 🟠 Analog - Warm-Töne */
  --color-analog-warm: #f76500;
  --color-analog-gold: #f7c500;

  /* 🌈 Gradients - Brand-basiert */
  --gradient-primary: linear-gradient(135deg, #f7a500 0%, #f76500 100%);
  --gradient-primary-hover: linear-gradient(135deg, #e09500 0%, #e05a00 100%);
  --gradient-primary-soft: linear-gradient(
    135deg,
    rgba(247, 165, 0, 0.1) 0%,
    rgba(247, 101, 0, 0.1) 100%
  );
  --gradient-success: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --gradient-warning: linear-gradient(135deg, #f7a500 0%, #f7c500 100%);
  --gradient-info: linear-gradient(135deg, #0062f7 0%, #0891b2 100%);
  --gradient-dark: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  --gradient-shine: linear-gradient(
    45deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );

  /* 🎨 Page Background - Soft Productivity: Warm Cream */
  --page-bg: #faf8f5;
  --page-bg-accent: none;

  /* ✨ Accent Colors */
  --color-accent-cyan: #0891b2;
  --color-accent-pink: #ec4899;
  --color-accent-amber: #f7a500;
  --color-accent-violet: #8b5cf6;
  --color-accent-emerald: #10b981;

  /* Farben - Semantisch */
  --color-success: #22c55e;
  --color-success-light: #dcfce7;
  --color-success-rgb: 34, 197, 94;
  --color-danger: #ef4444;
  --color-danger-light: #fee2e2;
  --color-danger-rgb: 239, 68, 68;
  --color-warning: #f7a500;
  --color-warning-light: #fff7e6;
  --color-warning-rgb: 247, 165, 0;
  --color-info: #0062f7;
  --color-info-light: #e6f0ff;
  --color-info-rgb: 0, 98, 247;

  /* Oberflächen - Light Mode: Soft Productivity */
  --surface-bg: #fffcf9;
  --surface-elevated: #ffffff;
  --surface-border: #e5e0d8;
  --surface-hover: #faf6f1;
  --surface-active: #f5ede3;

  /* 🧈 Soft Surfaces (kein Glassmorphism) */
  --card-bg: #ffffff;
  --card-border: #e5e0d8;
  --card-shadow: 0 1px 3px rgba(120, 100, 80, 0.06),
    0 4px 12px rgba(120, 100, 80, 0.04);
  --card-shadow-hover: 0 2px 8px rgba(120, 100, 80, 0.08),
    0 8px 24px rgba(120, 100, 80, 0.06);
  --card-shadow-active: 0 1px 2px rgba(120, 100, 80, 0.08);

  /* Text - Light Mode (A11y-optimiert) */
  --text-primary: #1a1612;
  --text-secondary: #5c534a;
  --text-muted: #7a6f64;
  --text-inverse: #ffffff;

  /* ========================================
     🔗 Token-Aliase (Legacy-Kompatibilität)
     Für Module die noch alte Namen verwenden
     ======================================== */
  --color-bg: var(--surface-bg);
  --color-surface: var(--surface-elevated);
  --color-border: var(--surface-border);
  --color-text: var(--text-primary);
  --color-text-muted: var(--text-muted);
  --color-primary-alpha: rgba(247, 165, 0, 0.15);

  /* Legacy surface aliases */
  --border-color: var(--surface-border);
  --surface-primary: var(--surface-elevated);
  --surface-secondary: var(--surface-hover);
  --surface-tertiary: var(--surface-active);
  --surface-raised: var(--surface-elevated);
  --color-error: var(--color-danger);

  /* Abstände (8px Grid) */
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem; /* 8px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem; /* 16px */
  --space-5: 1.25rem; /* 20px */
  --space-6: 1.5rem; /* 24px */
  --space-8: 2rem; /* 32px */
  --space-10: 2.5rem; /* 40px */
  --space-12: 3rem; /* 48px */

  /* Radien */
  --radius-sm: 0.375rem; /* 6px */
  --radius-md: 0.5rem; /* 8px */
  --radius-lg: 0.75rem; /* 12px */
  --radius-xl: 1rem; /* 16px */
  --radius-2xl: 1.5rem; /* 24px */
  --radius-3xl: 2rem; /* 32px */
  --radius-full: 9999px;

  /* 🧈 Soft Shadows - Warm tinted, not harsh black */
  --shadow-sm: 0 1px 2px rgba(120, 100, 80, 0.06);
  --shadow-md: 0 2px 4px rgba(120, 100, 80, 0.04),
    0 4px 12px rgba(120, 100, 80, 0.06);
  --shadow-lg: 0 4px 8px rgba(120, 100, 80, 0.04),
    0 12px 32px rgba(120, 100, 80, 0.08);
  --shadow-xl: 0 8px 16px rgba(120, 100, 80, 0.06),
    0 24px 48px rgba(120, 100, 80, 0.1);
  --shadow-2xl: 0 12px 24px rgba(120, 100, 80, 0.08),
    0 32px 64px rgba(120, 100, 80, 0.12);

  /* 💫 Glow Shadows - Brand-basiert */
  --shadow-glow-primary: 0 0 20px rgba(247, 165, 0, 0.35),
    0 0 40px rgba(247, 165, 0, 0.15);
  --shadow-glow-success: 0 0 20px rgba(34, 197, 94, 0.3),
    0 0 40px rgba(34, 197, 94, 0.1);
  --shadow-glow-danger: 0 0 20px rgba(239, 68, 68, 0.3),
    0 0 40px rgba(239, 68, 68, 0.1);
  --shadow-glow-warning: 0 0 20px rgba(247, 165, 0, 0.35),
    0 0 40px rgba(247, 165, 0, 0.15);

  /* 🎭 Colored Shadows (für Cards) */
  --shadow-colored-primary: 0 10px 40px -10px rgba(247, 165, 0, 0.35);
  --shadow-colored-success: 0 10px 40px -10px rgba(34, 197, 94, 0.3);
  --shadow-colored-danger: 0 10px 40px -10px rgba(239, 68, 68, 0.3);

  /* 🎬 Enhanced Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms ease;
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --transition-smooth: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 600ms cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Typography - Soft Productivity: DM Sans for headings */
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
  --font-display: "DM Sans", "Inter", system-ui, sans-serif;

  /* Font Sizes */
  --text-xs: 0.75rem; /* 12px */
  --text-sm: 0.875rem; /* 14px */
  --text-base: 1rem; /* 16px */
  --text-lg: 1.125rem; /* 18px */
  --text-xl: 1.25rem; /* 20px */
  --text-2xl: 1.5rem; /* 24px */
  --text-3xl: 1.875rem; /* 30px */
  --text-4xl: 2.25rem; /* 36px */
  --text-5xl: 3rem; /* 48px */
  --text-6xl: 3.75rem; /* 60px */

  /* Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* 🎯 Timer Ring - Brand Colors */
  --timer-ring-size: 280px;
  --timer-ring-stroke: 12px;
  --timer-ring-bg: rgba(247, 165, 0, 0.08);
  --timer-ring-gradient-start: #f7a500;
  --timer-ring-gradient-end: #f76500;

  /* ========================================
     📐 Typography Polish Tokens
     ======================================== */
  --content-max-width: 65ch;
  --heading-margin-bottom: 0.5em;
  --paragraph-margin-bottom: 1em;
  --leading-body: 1.6;
  --leading-heading: 1.2;

  /* ========================================
     🎯 Focus Ring Tokens (A11y)
     ======================================== */
  --focus-ring-width: 3px;
  --focus-ring-offset: 2px;
  --focus-ring-color: rgba(247, 165, 0, 0.4);
  --focus-ring-shadow: 0 0 0 var(--focus-ring-width) var(--focus-ring-color);
}

/* ========================================
   CSS Reset (Modern)
   ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
}

html:focus-within {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  background: var(--page-bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ========================================
   Typography - Soft Productivity
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-heading);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--heading-margin-bottom);
  max-width: var(--content-max-width);
}

h1 {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.03em;
}
h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}
h3 {
  font-size: var(--text-xl);
  font-weight: 600;
}
h4 {
  font-size: var(--text-lg);
  font-weight: 600;
}
h5 {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0;
}
h6 {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0;
}

p {
  color: var(--text-primary);
  line-height: var(--leading-body);
  max-width: var(--content-max-width);
  margin-bottom: var(--paragraph-margin-bottom);
}

p:last-child {
  margin-bottom: 0;
}

/* Sekundärer Text - explizit bei Bedarf */
p.text-secondary,
.text-secondary {
  color: var(--text-secondary);
}

p.text-muted,
.text-muted {
  color: var(--text-muted);
}

small {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

strong {
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-elevated);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}

/* ========================================
   Focus Styles (Accessibility) - Token-basiert
   ======================================== */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: var(--focus-ring-offset);
  box-shadow: var(--focus-ring-shadow);
}

/* Focus ohne Outline (für Custom-Styling in Komponenten) */
.focus-ring:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-shadow), 0 0 0 1px var(--color-primary);
}

/* Skip Link für Screenreader */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--text-inverse);
  z-index: 9999;
}

.skip-link:focus {
  top: 0;
}

/* ========================================
   Selection
   ======================================== */

::selection {
  background: var(--color-primary-light);
  color: var(--text-primary);
}

/* ========================================
   Scrollbar (optional, für moderne Browser)
   ======================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface-elevated);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
