/* =============================================================================
   Hoard – Globale Tokens, Resets und Vuetify-Anpassungen
   Quelle: GUI/style.md
   ============================================================================= */

:root {
  color-scheme: light;

  /* Surfaces */
  --color-bg: #f5f8f2;
  --color-bg-tint: #eef3ea;
  --color-surface: #ffffff;
  --color-surface-alt: #f1f4ee;
  --color-surface-elevated: #fbfcf8;

  --color-border: #dce3d6;
  --color-border-strong: #c5cfbe;
  --color-border-subtle: #e8ede2;

  /* Text */
  --color-text: #1a2a1e;
  --color-text-secondary: #5a6a5e;
  --color-text-muted: #7b897f;
  --color-text-on-primary: #ffffff;

  /* Brand */
  --color-primary-800: #10421e;
  --color-primary-700: #1c652f;
  --color-primary-600: #2e7d32;
  --color-primary-500: #3c8f42;
  --color-primary-300: #a8d5a2;
  --color-primary-100: #eaf5e8;
  --color-primary-050: #f4faf1;
  --color-accent-lime: #b7e36b;

  /* Status */
  --color-success: #2e7d32;
  --color-warning: #b7791f;
  --color-danger: #c0392b;
  --color-info: #2f6fb3;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 1px rgb(20 30 22 / 4%);
  --shadow-sm: 0 2px 6px rgb(20 30 22 / 6%);
  --shadow-md: 0 8px 22px rgb(20 30 22 / 8%);
  --shadow-lg: 0 18px 44px rgb(20 30 22 / 12%);
  --shadow-glow: 0 12px 36px rgb(28 101 47 / 18%);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-family-sans:
    'Inter', 'Segoe UI', Roboto, system-ui, -apple-system, BlinkMacSystemFont,
    'Helvetica Neue', Arial, sans-serif;
  --font-family-mono:
    'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo,
    'SF Mono', Consolas, 'Liberation Mono', monospace;

  --font-size-2xs: 11px;
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 26px;
  --font-size-3xl: 32px;
  --font-size-display: 44px;

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-loose: 1.65;

  /* Motion */
  --transition-fast: 160ms cubic-bezier(0.2, 0, 0, 1);
  --transition-medium: 220ms cubic-bezier(0.2, 0, 0, 1);
  --transition-slow: 320ms cubic-bezier(0.2, 0, 0, 1);

  /* Atmospheric helpers */
  --page-bg-ambient:
    radial-gradient(
      90% 60% at 12% -10%,
      color-mix(in srgb, var(--color-primary-100) 75%, transparent) 0%,
      transparent 60%
    ),
    radial-gradient(
      80% 60% at 100% 0%,
      color-mix(in srgb, var(--color-accent-lime) 12%, transparent) 0%,
      transparent 55%
    ),
    linear-gradient(180deg, var(--color-bg-tint) 0%, var(--color-bg) 360px);

  --scrollbar-thumb: #b1bcab;
  --scrollbar-thumb-hover: #95a290;
  --scrollbar-track: transparent;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --color-bg: #0e1115;
  --color-bg-tint: #11161c;
  --color-surface: #161a20;
  --color-surface-alt: #1b2028;
  --color-surface-elevated: #1f252e;

  --color-border: #2a323d;
  --color-border-strong: #3a4452;
  --color-border-subtle: #232a34;

  --color-text: #e9eff3;
  --color-text-secondary: #b6bec8;
  --color-text-muted: #8b94a0;
  --color-text-on-primary: #08120a;

  --color-primary-800: #8be194;
  --color-primary-700: #5fb968;
  --color-primary-600: #4ea758;
  --color-primary-500: #3f9148;
  --color-primary-300: #2e6a37;
  --color-primary-100: #1f2922;
  --color-primary-050: #161e19;
  --color-accent-lime: #b7e36b;

  --color-success: #5fb968;
  --color-warning: #d0a34e;
  --color-danger: #e07a7a;
  --color-info: #6aa8de;

  --shadow-xs: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow-sm: 0 2px 6px rgb(0 0 0 / 35%);
  --shadow-md: 0 10px 26px rgb(0 0 0 / 40%);
  --shadow-lg: 0 18px 44px rgb(0 0 0 / 48%);
  --shadow-glow: 0 14px 40px rgb(95 185 104 / 22%);

  --page-bg-ambient:
    radial-gradient(
      90% 60% at 12% -10%,
      color-mix(in srgb, var(--color-primary-700) 18%, transparent) 0%,
      transparent 60%
    ),
    radial-gradient(
      80% 60% at 100% 0%,
      color-mix(in srgb, var(--color-accent-lime) 6%, transparent) 0%,
      transparent 55%
    ),
    linear-gradient(180deg, var(--color-bg-tint) 0%, var(--color-bg) 360px);

  --scrollbar-thumb: #404a57;
  --scrollbar-thumb-hover: #5a6573;
}

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

html,
body,
#app {
  min-height: 100%;
}

html {
  font-size: 14px;
  line-height: var(--line-height-normal);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-md);
  color: var(--color-text);
  background: var(--page-bg-ambient);
  background-attachment: fixed;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
}

::selection {
  background-color: color-mix(in srgb, var(--color-primary-300) 42%, transparent);
  color: var(--color-text);
}

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

a:hover {
  color: var(--color-primary-600);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-4);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  margin: 0 0 var(--space-4);
  color: var(--color-text-secondary);
  line-height: var(--line-height-loose);
}

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

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ---------- App shell ---------- */
.v-application {
  font-family: var(--font-family-sans) !important;
  color: var(--color-text) !important;
  background-color: transparent !important;
}

.v-main {
  background-color: transparent;
}

.v-app-bar {
  background-color: color-mix(in srgb, var(--color-surface) 92%, transparent) !important;
  backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--color-border) !important;
  box-shadow: var(--shadow-xs) !important;
}

.v-navigation-drawer {
  background-color: var(--color-surface-alt) !important;
  border-right: 1px solid var(--color-border) !important;
  background-image: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-surface-alt) 96%, var(--color-primary-100) 4%),
    var(--color-surface-alt) 220px
  );
}

.v-navigation-drawer .v-list-item {
  position: relative;
  border-radius: var(--radius-md) !important;
  margin: 2px var(--space-2);
  min-height: 44px;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.v-navigation-drawer .v-list-item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  width: 3px;
  height: 0;
  background-color: var(--color-primary-600);
  border-radius: var(--radius-full);
  transform: translateY(-50%);
  transition: height var(--transition-medium);
}

.v-navigation-drawer .v-list-item:hover {
  background-color: color-mix(
    in srgb,
    var(--color-primary-100) 50%,
    var(--color-surface-alt) 50%
  ) !important;
}

.v-navigation-drawer .v-list-item--active {
  color: var(--color-primary-700) !important;
  background-color: color-mix(
    in srgb,
    var(--color-primary-100) 75%,
    var(--color-surface) 25%
  ) !important;
  font-weight: 600;
}

.v-navigation-drawer .v-list-item--active::before {
  height: 60%;
}

/* ---------- Cards / surfaces ---------- */
.v-card {
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-lg) !important;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--color-surface) 96%, var(--color-surface-alt) 4%),
      var(--color-surface)
    ) !important;
  box-shadow: var(--shadow-sm) !important;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.v-card-title {
  color: var(--color-text) !important;
  font-size: var(--font-size-xl) !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
}

.v-card-text {
  color: var(--color-text-secondary) !important;
}

.v-footer {
  border-top: 1px solid var(--color-border);
  background-color: color-mix(in srgb, var(--color-surface) 92%, var(--color-bg) 8%) !important;
}

/* ---------- Buttons ---------- */
.v-btn {
  letter-spacing: 0 !important;
  text-transform: none !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 500 !important;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast) !important;
}

.v-btn--variant-elevated,
.v-btn--variant-flat {
  box-shadow: var(--shadow-xs) !important;
}

.v-btn--variant-elevated:not(.v-btn--disabled):hover,
.v-btn--variant-flat:not(.v-btn--disabled):hover {
  box-shadow: var(--shadow-sm) !important;
  transform: translateY(-1px);
}

.v-btn:not(.v-btn--disabled):active {
  transform: translateY(0);
}

.v-btn.v-btn--variant-elevated:not(.v-btn--disabled),
.v-btn.v-btn--variant-flat:not(.v-btn--disabled) {
  color: var(--color-text-on-primary) !important;
  background:
    linear-gradient(
      180deg,
      var(--color-primary-600),
      var(--color-primary-700)
    ) !important;
}

.v-btn.v-btn--variant-elevated:not(.v-btn--disabled):hover,
.v-btn.v-btn--variant-flat:not(.v-btn--disabled):hover {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--color-primary-600) 90%, var(--color-accent-lime) 10%),
      var(--color-primary-700)
    ) !important;
}

.v-btn.v-btn--disabled {
  opacity: 1 !important;
  color: var(--color-text-muted) !important;
  background:
    color-mix(in srgb, var(--color-surface-alt) 80%, var(--color-surface) 20%) !important;
  border-color: var(--color-border) !important;
  box-shadow: none !important;
}

.v-btn--variant-outlined {
  border-color: var(--color-border-strong) !important;
  color: var(--color-text) !important;
  background-color: color-mix(
    in srgb,
    var(--color-surface) 88%,
    var(--color-surface-alt) 12%
  ) !important;
}

.v-btn--variant-outlined:not(.v-btn--disabled):hover,
.v-btn--variant-text:not(.v-btn--disabled):hover {
  background-color: color-mix(
    in srgb,
    var(--color-primary-100) 38%,
    transparent
  ) !important;
  border-color: color-mix(
    in srgb,
    var(--color-primary-600) 50%,
    var(--color-border-strong) 50%
  ) !important;
  color: var(--color-primary-700) !important;
}

/* ---------- Inputs ---------- */
.v-input .v-field {
  border-radius: var(--radius-md) !important;
  background-color: var(--color-surface) !important;
  transition:
    background-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.v-input .v-field__outline {
  --v-field-border-opacity: 1;
  color: var(--color-border-strong) !important;
}

.v-input.v-input--focused .v-field__outline {
  color: var(--color-primary-600) !important;
}

.v-input.v-input--focused .v-field {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary-300) 32%, transparent);
}

.v-input .v-field :is(input, textarea, select):focus-visible {
  outline: none !important;
}

.v-label {
  color: var(--color-text-secondary) !important;
}

.v-overlay .v-list {
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  background-color: var(--color-surface-elevated) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ---------- Tables ---------- */
.v-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface) !important;
  overflow: hidden;
}

.v-table thead th {
  color: var(--color-text-secondary) !important;
  font-weight: 600 !important;
  background-color: var(--color-surface-alt) !important;
  font-size: var(--font-size-xs) !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.v-table tbody tr:hover td {
  background-color: color-mix(
    in srgb,
    var(--color-primary-100) 32%,
    var(--color-surface) 68%
  ) !important;
}

.v-table tbody td {
  border-bottom-color: var(--color-border-subtle) !important;
}

/* ---------- Status pills ---------- */
.hoard-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 3px var(--space-2);
  border-radius: var(--radius-xs);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hoard-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: currentcolor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentcolor 22%, transparent);
}

.hoard-status--success {
  color: var(--color-success);
  background-color: color-mix(in srgb, var(--color-success) 14%, var(--color-surface) 86%);
}

.hoard-status--warning {
  color: var(--color-warning);
  background-color: color-mix(in srgb, var(--color-warning) 16%, var(--color-surface) 84%);
}

.hoard-status--danger {
  color: var(--color-danger);
  background-color: color-mix(in srgb, var(--color-danger) 14%, var(--color-surface) 86%);
}

.hoard-status--info {
  color: var(--color-info);
  background-color: color-mix(in srgb, var(--color-info) 14%, var(--color-surface) 86%);
}

.hoard-status--muted {
  color: var(--color-text-muted);
  background-color: color-mix(in srgb, var(--color-surface-alt) 70%, var(--color-surface) 30%);
}

.hoard-status--muted::before {
  background-color: var(--color-text-muted);
}

/* ---------- Reusable surfaces ---------- */
.hoard-panel {
  position: relative;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--color-surface) 95%, var(--color-surface-alt) 5%),
      var(--color-surface)
    );
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.hoard-panel--elevated {
  background-color: var(--color-surface-elevated);
  box-shadow: var(--shadow-md);
}

.hoard-panel--ghost {
  background:
    color-mix(in srgb, var(--color-surface-alt) 60%, var(--color-surface) 40%);
  border-color: var(--color-border-subtle);
  box-shadow: none;
}

.hoard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  background-color: var(--color-surface-alt);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.hoard-list-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1fr);
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast);
}

.hoard-list-row:hover {
  background-color: color-mix(
    in srgb,
    var(--color-primary-100) 32%,
    var(--color-surface) 68%
  );
  transform: translateX(2px);
}

.hoard-list-row.is-selected {
  color: var(--color-primary-700);
  background-color: color-mix(
    in srgb,
    var(--color-primary-100) 70%,
    var(--color-surface) 30%
  );
}

.hoard-meta {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.hoard-empty-state {
  padding: var(--space-10) var(--space-6);
  text-align: center;
  color: var(--color-text-secondary);
}

.hoard-empty-state h2 {
  margin-bottom: var(--space-2);
  font-size: var(--font-size-xl);
  font-weight: 600;
}

.hoard-empty-state p {
  margin: 0 auto;
  max-width: 44ch;
}

/* ---------- Scrollbar ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
  background-clip: content-box;
}

/* ---------- Animations ---------- */
@keyframes hoard-soft-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hoard-pulse-ring {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary-300) 35%, transparent);
  }

  70% {
    box-shadow: 0 0 0 12px color-mix(in srgb, var(--color-primary-300) 0%, transparent);
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .v-btn,
  .v-navigation-drawer .v-list-item,
  .hoard-list-row {
    transform: none !important;
  }
}

/* ---------- Responsive ---------- */
@media (width <= 960px) {
  :root {
    --hoard-mobile-safe-left: max(var(--space-2), env(safe-area-inset-left));
    --hoard-mobile-safe-right: max(var(--space-2), env(safe-area-inset-right));
    --hoard-mobile-safe-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  }

  .v-main {
    padding-bottom: var(--hoard-mobile-safe-bottom);
  }

  .v-btn {
    min-height: 44px;
  }

  .v-btn--icon.v-btn {
    width: 44px;
    height: 44px;
  }

  .v-navigation-drawer .v-list-item {
    min-height: 48px;
    margin: 4px var(--space-2);
  }

  .hoard-list-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
    align-items: start;
    padding-block: var(--space-4);
  }

  .hoard-toolbar {
    flex-wrap: wrap;
    align-items: stretch;
    padding: var(--space-3);
  }

  .hoard-empty-state {
    padding: var(--space-8) var(--space-4);
  }

  .v-navigation-drawer {
    border-right: none !important;
    border-top: 1px solid var(--color-border) !important;
    padding-bottom: var(--hoard-mobile-safe-bottom);
  }
}

@media (width <= 600px) {
  .hoard-toolbar {
    gap: var(--space-2);
  }

  .hoard-list-row {
    padding-inline: var(--space-3);
  }

  .hoard-meta {
    font-size: var(--font-size-xs);
  }
}
