/**
 * Backoffice4You — Design System (Theme) / UI Kit
 * Tokens: colors, spacing (--space-1 … 8), radius (--radius-sm/md/lg), typography, shadows
 * Buttons: .btn .btn-primary | .btn-outline | .btn-danger — min-height 44px, einheitliches Padding/Radius
 * Inputs/Labels: min-height 44px (inputs), einheitliche Labels (uppercase, muted)
 * Cards: .card, .card-title | Alerts: .alert .alert-success | .alert-error | .alert-info
 * Accessibility: Focus States, Kontrast, Labels
 */

/* ═══════════════════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ─── Colors ───────────────────────────────────────────── */
  --bg:           #06101f;
  --bg2:          #0a1628;
  --surface:      #0e1e35;
  --surface2:     #132540;
  --surface3:     #192d4d;
  --border:       #1e3557;
  --border2:      #264070;
  --gold:         #c9a84c;
  --gold2:        #e0c06a;
  --gold3:        #f0d48a;
  --gold-dim:     rgba(201, 168, 76, 0.15);
  --gold-glow:    rgba(201, 168, 76, 0.08);
  --text:         #e8e4d8;
  --text-dim:     #9ba8bc;
  --text-muted:   #5a6d87;
  --green:        #3dba7a;
  --green-bg:     rgba(61, 186, 122, 0.12);
  --red:          #e05555;
  --red-bg:       rgba(224, 85, 85, 0.12);
  --yellow:       #d4a04a;
  --yellow-bg:    rgba(212, 160, 74, 0.12);
  --blue:         #4a90d9;
  --blue-bg:      rgba(74, 144, 217, 0.12);
  --purple:       #9b6dd4;
  --purple-bg:    rgba(155, 109, 212, 0.12);
  --teal:         #0d9488;
  --teal-bg:      rgba(13, 148, 136, 0.12);
  --ink:          #06101f;

  /* ─── Spacing ─────────────────────────────────────────── */
  --space-1:      4px;
  --space-2:      8px;
  --space-3:      12px;
  --space-4:      16px;
  --space-5:      20px;
  --space-6:      24px;
  --space-8:      32px;
  --nav-h:        68px;
  --safe:         env(safe-area-inset-bottom, 0px);

  /* ─── Radius ──────────────────────────────────────────── */
  --radius-sm:    8px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --r:            14px;

  /* ─── Typography ──────────────────────────────────────── */
  --font-sans:    'Outfit', sans-serif;
  --font-serif:   'Cormorant Garamond', serif;
  --text-xs:      10px;
  --text-sm:      12px;
  --text-base:    14px;
  --text-md:      13px;
  --text-lg:      16px;
  --text-xl:      20px;
  --text-2xl:     22px;
  --text-3xl:     28px;
  --text-4xl:     32px;
  --leading-tight: 1.1;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --tracking-wide:  0.05em;
  --tracking-wider: 0.1em;
  --tracking-widest: 0.2em;

  /* ─── Shadows ──────────────────────────────────────────── */
  --shadow-sm:    0 2px 12px rgba(0, 0, 0, 0.2);
  --shadow-md:    0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg:    0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-xl:    0 24px 64px rgba(0, 0, 0, 0.5);
  --shadow-gold:  0 4px 16px rgba(201, 168, 76, 0.25);
  --shadow-focus: 0 0 0 3px rgba(201, 168, 76, 0.25);

  /* ─── Breakpoints (for reference / container) ───────────── */
  --bp-sm:        480px;
  --bp-md:        768px;
  --bp-lg:        960px;
  --container:    860px;
  --container-lg: 900px;
}

/* ═══════════════════════════════════════════════════════════
   BASE & RESET
   ═══════════════════════════════════════════════════════════ */

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

html {
  height: -webkit-fill-available;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ═══════════════════════════════════════════════════════════
   TAP HIGHLIGHT (Accessibility / UX)
   ═══════════════════════════════════════════════════════════ */

button,
a,
input,
select,
textarea,
[role="button"],
.nav-item,
.chip,
.hbtn,
.kcard,
.pcard,
.rcard,
.titem {
  -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════════════════════
   FOCUS STATES (Accessibility)
   ═══════════════════════════════════════════════════════════ */

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex="0"]:focus-visible,
.nav-item:focus-visible,
.chip:focus-visible,
.hbtn:focus-visible,
.fcancel:focus-visible,
.fsave:focus-visible,
.dsh-close:focus-visible,
.kcard:focus-visible,
.pcard:focus-visible,
.rcard:focus-visible,
.titem:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Skip-Link (A11y): nur bei Fokus sichtbar */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: 12px 16px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════ */

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 15% 10%, rgba(201, 168, 76, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 85% 85%, rgba(74, 144, 217, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS (unified)
   ═══════════════════════════════════════════════════════════ */

.btn,
.hbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 16px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
}

.btn:active,
.hbtn:active {
  transform: scale(0.96);
}

.btn-primary,
.hbtn {
  background: var(--gold);
  color: var(--ink);
  box-shadow: var(--shadow-gold);
}

.btn-outline,
.hbtn.outline {
  background: transparent;
  border: 1.5px solid var(--border2);
  color: var(--text-dim);
  box-shadow: none;
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(224, 85, 85, 0.2);
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
}

/* Sekundär: Blau (E-Mail, Freigabe, Info-Aktionen) */
.btn-blue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid rgba(74, 144, 217, 0.3);
  transition: transform 0.2s, background 0.2s;
}
.btn-blue:hover { filter: brightness(1.08); }
.btn-blue:active { transform: scale(0.96); }

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn.outline,
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border2);
  color: var(--text-dim);
  box-shadow: none;
}

@media (hover: hover) {
  .btn-primary:hover:not(:disabled),
  .hbtn:hover:not(:disabled) {
    filter: brightness(1.08);
    box-shadow: 0 6px 20px rgba(201, 168, 76, 0.3);
  }
  .btn-outline:hover:not(:disabled),
  .btn.outline:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--text);
  }
  .btn-danger:hover:not(:disabled) {
    filter: brightness(1.1);
  }
}

/* ═══════════════════════════════════════════════════════════
   ALERTS (Success / Error / Info)
   ═══════════════════════════════════════════════════════════ */

.alert {
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-top: var(--space-3);
  display: none;
  line-height: var(--leading-normal);
}

.alert.show {
  display: block;
}

.alert-success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(61, 186, 122, 0.25);
}

.alert-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(224, 85, 85, 0.25);
}

.alert-info {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid rgba(74, 144, 217, 0.25);
}

/* ═══════════════════════════════════════════════════════════
   INPUTS & FORMS (44px min-height, consistent)
   ═══════════════════════════════════════════════════════════ */

label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

input,
select,
textarea,
.fi,
.fsel,
.fta {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

textarea,
.fta {
  min-height: auto;
}

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

input:focus,
select:focus,
textarea:focus,
.fi:focus,
.fsel:focus,
.fta:focus {
  border-color: var(--gold);
  box-shadow: var(--shadow-focus);
  background: var(--surface2);
}

/* ═══════════════════════════════════════════════════════════
   CARDS (base)
   ═══════════════════════════════════════════════════════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ═══════════════════════════════════════════════════════════
   TABLES (base)
   ═══════════════════════════════════════════════════════════ */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.theme-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.theme-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.theme-table tbody tr:last-child td {
  border-bottom: none;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE CONTAINER
   ═══════════════════════════════════════════════════════════ */

.container {
  width: 100%;
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

@media (min-width: 768px) {
  .container {
    max-width: var(--container-lg);
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

/* Mobile: Container-Padding, Safe-Area-freundlich */
@media (max-width: 767px) {
  .container {
    padding-left: max(var(--space-4), env(safe-area-inset-left));
    padding-right: max(var(--space-4), env(safe-area-inset-right));
  }
}

/* ═══════════════════════════════════════════════════════════
   UTILITY: Screen reader only (Accessibility)
   ═══════════════════════════════════════════════════════════ */

.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;
}
