/* ============================================================
   MKI – Maximilian Krenn Intelligence
   Global Stylesheet – Apple.com Design System
   ============================================================ */

:root {
  /* Accent – apple.com Blau (NICHT iOS #007AFF) */
  --accent:           #007aff;
  --accent-hover:     #0077ed;
  --accent-pressed:   #004f9f;
  --accent-light:     rgba(0, 122, 255, 0.08);
  --accent-ring:      rgba(0, 122, 255, 0.15);

  /* Backgrounds */
  --bg-primary:    #ffffff;
  --bg-secondary:  #f5f5f7;
  --bg-tertiary:   #fbfbfd;
  --bg-elevated:   #ffffff;
  --bg-grouped:    #f2f2f7;

  /* Surfaces */
  --surface:       #ffffff;
  --surface-sec:   #f5f5f7;
  --surface-ter:   #e8e8ed;
  --glass:         rgba(255, 255, 255, 0.82);

  /* Text */
  --text-primary:  #1d1d1f;
  --text-sec:      #6e6e73;
  --text-ter:      #86868b;
  --text-quat:     #c7c7cc;
  --text-disabled: #d1d1d6;

  /* Legacy aliases (dark-theme pages use these, overridden in .theme-light) */
  --text-white:    #1d1d1f;
  --text-lblue:    #1d1d1f;
  --text-sub:      #6e6e73;
  --text-navy:     #1d1d1f;
  --text-dblue:    #1d1d1f;

  /* Separators */
  --separator:         rgba(0, 0, 0, 0.08);
  --separator-opaque:  #c6c6c8;
  --border:            rgba(0, 0, 0, 0.08);
  --border-subtle:     rgba(0, 0, 0, 0.06);
  --border-strong:     rgba(0, 0, 0, 0.16);

  /* Semantic – apple.com Farben */
  --success:       #34c759;
  --warning:       #f56300;
  --danger:        #d70015;
  --info:          #007aff;
  --purple:        #af52de;
  --teal:          #5ac8fa;

  /* Semantic light/border variants */
  --success-light:  rgba(52, 199, 89, 0.10);
  --success-border: rgba(52, 199, 89, 0.25);
  --warning-light:  rgba(245, 99, 0, 0.10);
  --warning-border: rgba(245, 99, 0, 0.25);
  --danger-light:   rgba(215, 0, 21, 0.08);
  --danger-border:  rgba(215, 0, 21, 0.20);
  --violet:         #5e5ce6;
  --violet-light:   rgba(94, 92, 230, 0.08);

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm:  0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.10), 0 4px 8px rgba(0, 0, 0, 0.06);
  --shadow-xl:  0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.08);

  /* Radii */
  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* Spacing (8pt grid) */
  --sp-1:   4px;
  --sp-2:   8px;
  --sp-3:   12px;
  --sp-4:   16px;
  --sp-5:   20px;
  --sp-6:   24px;
  --sp-8:   32px;
  --sp-10:  40px;
  --sp-12:  48px;
  --sp-16:  64px;

  /* Typography – apple.com Font Stack */
  --font-main:    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font:         -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;

  /* Transitions */
  --t:      150ms ease;
  --t-slow: 250ms ease;

  /* Legacy dark-theme variables — kept so dark-theme pages don't break visually */
  --electric-blue: #007aff;
  --royal-blue:    #007aff;
  --indigo:        #5e5ce6;
  --deep-indigo:   #3634a3;
  --soft-lavender: #af52de;
  --gold-light:    #f56300;
  --gold-mid:      #c97300;
  --gold-dark:     #8a5200;
  --bg-navy:       #f5f5f7;
  --bg-black:      #f5f5f7;
  --surface-light: rgba(0, 0, 0, 0.04);
  --shadow-card:   var(--shadow-md);
  --shadow-blue:   none;
  --shadow-gold:   none;
  --shadow-indig:  none;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul { list-style: none; }
input, textarea, select {
  font: inherit;
  background: none;
  border: none;
  outline: none;
  color: inherit;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }

/* ── Typography helpers ─────────────────────────────────── */
.gradient-text {
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
}
.gold-text {
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
}
.muted { color: var(--text-sec); }
.label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-ter);
}

/* ── Buttons – apple.com Pill-Form ─────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 980px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}
.btn:active { transform: scale(0.97); }
.btn::after { display: none; }

/* Primary Button – Apple System Blue */
.btn-primary {
  background: #007aff;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0,122,255,.3);
}
.btn-primary:hover { background: #0870e0; box-shadow: 0 2px 8px rgba(0,122,255,.35); }
.btn-primary:active { background: #005fcc; transform: scale(.98); }

/* Gold / CTA */
.btn-gold {
  background: #007aff;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0,122,255,.3);
}
.btn-gold:hover { background: #0870e0; }

/* Secondary – transparentes Tint */
.btn-secondary {
  background: rgba(0, 122, 255, 0.09);
  color: #007aff;
  border: none;
}
.btn-secondary:hover { background: rgba(0, 122, 255, 0.14); }

/* Outline – Apple-Stil: dünner dezenter Border */
.btn-outline {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.16);
  color: #1d1d1f;
  border-radius: 980px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.btn-outline:hover {
  background: #f5f5f7;
  border-color: rgba(0, 0, 0, 0.22);
}

/* Ghost – kein Border, kein Background */
.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid transparent;
  border-radius: 980px;
}
.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Danger */
.btn-danger {
  background: #d70015;
  color: #ffffff;
  border-radius: 980px;
}
.btn-danger:hover { background: #b0000f; }

/* Size Variants */
.btn-sm  { padding: 6px 14px; font-size: 13px; border-radius: 980px; }
.btn-lg  { padding: 12px 22px; font-size: 16px; border-radius: 980px; }
.btn-icon { padding: 9px; border-radius: 980px; }

/* ── Cards – apple.com Radius ───────────────────────────── */
.card {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.card:hover {
  box-shadow: var(--shadow-md);
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-blue   { background: rgba(0, 122, 255, 0.10);   color: #007aff; }
.badge-gold   { background: rgba(245, 99, 0, 0.12);    color: #b25900; }
.badge-green  { background: rgba(52, 199, 89, 0.12);   color: #1d8348; }
.badge-red    { background: rgba(215, 0, 21, 0.10);    color: #d70015; }
.badge-violet { background: rgba(94, 92, 230, 0.10);   color: #4541c7; }
.badge-orange { background: rgba(245, 99, 0, 0.12);    color: #b25900; }
.badge-purple { background: rgba(175, 82, 222, 0.10);  color: #8944ab; }
.badge-gray   { background: rgba(0, 0, 0, 0.06);       color: #6e6e73; }

/* ── Forms – apple.com Stil ─────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
  display: block;
  margin-bottom: 6px;
}
.form-control {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  color: #1d1d1f;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  font-family: var(--font-main);
}
.form-control:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
  background: rgba(0, 0, 0, 0.02);
  outline: none;
}
.form-control::placeholder { color: #c7c7cc; }
select.form-control option { background: #ffffff; color: #1d1d1f; }
.form-hint { font-size: 12px; color: #6e6e73; margin-top: 4px; }
textarea.form-control { resize: vertical; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
.data-table,
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th,
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #86868b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  white-space: nowrap;
}
.data-table thead tr,
thead tr { border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.data-table tbody td,
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  color: #1d1d1f;
  vertical-align: middle;
}
.data-table tbody tr:hover td,
tbody tr:hover { background: #f5f5f7; }
.data-table tbody tr:last-child td,
tbody tr:last-child td { border-bottom: none; }
tbody td:first-child { font-weight: 500; }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  margin: 0;
}
hr { border: none; border-top: 1px solid rgba(0, 0, 0, 0.08); }

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.2); }
}
@keyframes typing-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1); opacity: 1; }
}

.animate-fade-up    { animation: fadeInUp 0.5s ease both; }
.animate-fade       { animation: fadeIn 0.4s ease both; }
.animate-float      { animation: float 4s ease-in-out infinite; }
.animate-pulse-glow { animation: none; }
.animate-pulse-gold { animation: none; }

/* delay helpers */
.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }
.delay-4 { animation-delay: .4s; }
.delay-5 { animation-delay: .5s; }
.delay-6 { animation-delay: .6s; }

/* ── Utility ─────────────────────────────────────────────── */
.flex            { display: flex; }
.flex-col        { display: flex; 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; }
.gap-4           { gap: 4px; }
.gap-8           { gap: 8px; }
.gap-12          { gap: 12px; }
.gap-16          { gap: 16px; }
.gap-24          { gap: 24px; }
.gap-32          { gap: 32px; }
.w-full          { width: 100%; }
.h-full          { height: 100%; }
.relative        { position: relative; }
.hidden          { display: none !important; }

/* ── Notification Toast ─────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 14px;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s ease both;
  color: var(--text-primary);
}
.toast.success { border-color: rgba(52, 199, 89, 0.35); }
.toast.error   { border-color: rgba(215, 0, 21, 0.30); }
.toast.warning { border-color: rgba(245, 99, 0, 0.35); }
.toast i { font-size: 16px; }
.toast.success i { color: #34c759; }
.toast.error   i { color: #d70015; }
.toast.warning i { color: #f56300; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal,
.modal-sheet {
  background: #ffffff;
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeInUp 0.25s ease both;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.modal-body { padding: 20px 24px; }
.modal-title { font-size: 17px; font-weight: 700; color: #1d1d1f; letter-spacing: -0.02em; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sec);
  background: var(--surface-sec);
  transition: all 0.15s;
}
.modal-close:hover { background: rgba(215, 0, 21, 0.08); color: #d70015; }
.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── Loader ─────────────────────────────────────────────── */
.loader {
  width: 20px; height: 20px;
  border: 2px solid rgba(0, 122, 255, 0.15);
  border-top-color: #007aff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Flash Messages (base) ──────────────────────────────── */
.flash-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  border: 1px solid transparent;
}
.flash-success { background: rgba(52, 199, 89, 0.10);  color: #1d8348; border-color: rgba(52, 199, 89, 0.25); }
.flash-error   { background: rgba(215, 0, 21, 0.08);   color: #d70015; border-color: rgba(215, 0, 21, 0.20); }
.flash-warning { background: rgba(245, 99, 0, 0.10);   color: #b24400; border-color: rgba(245, 99, 0, 0.25); }
.flash-info    { background: rgba(0, 122, 255, 0.08);  color: #004f9f; border-color: rgba(0, 122, 255, 0.20); }
