/* ============================================================================
   components.css – Reusable UI Components
   ============================================================================ */

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  min-height: 40px;
  position: relative;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.01em;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm  { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); min-height: 32px; border-radius: var(--radius-sm); }
.btn-lg  { padding: var(--space-3) var(--space-7); font-size: var(--text-base); min-height: 48px; border-radius: var(--radius-md); }
.btn-xl  { padding: var(--space-4) var(--space-8); font-size: var(--text-lg); min-height: 56px; border-radius: var(--radius-lg); }
.btn-block { display: flex; width: 100%; }

.btn-primary {
  background: var(--gradient-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 1px 0 color-mix(in srgb, white 25%, transparent) inset,
              0 4px 12px -2px color-mix(in srgb, var(--color-primary) 25%, transparent);
}

.btn-primary:hover {
  background: var(--gradient-primary);
  filter: brightness(1.08) saturate(1.05);
  border-color: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 1px 0 color-mix(in srgb, white 25%, transparent) inset,
              0 10px 24px -4px color-mix(in srgb, var(--color-primary) 40%, transparent);
  color: #ffffff;
}

.btn-primary:active {
  transform: translateY(0);
  filter: brightness(0.95);
  box-shadow: 0 1px 0 color-mix(in srgb, white 25%, transparent) inset, var(--shadow-xs);
}

.btn-secondary {
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border-color: var(--color-border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--color-bg-muted);
  border-color: var(--color-border-strong);
  color: var(--color-text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--color-bg-muted);
  color: var(--color-text);
}

.btn-success {
  background: linear-gradient(180deg, var(--color-success) 0%, color-mix(in srgb, var(--color-success) 100%, black 12%) 100%);
  color: #ffffff;
  border-color: var(--color-success);
  box-shadow: 0 1px 0 color-mix(in srgb, white 25%, transparent) inset, var(--shadow-xs);
}

.btn-success:hover {
  filter: brightness(1.05);
  border-color: color-mix(in srgb, var(--color-success) 100%, black 12%);
  transform: translateY(-2px);
  box-shadow: 0 1px 0 color-mix(in srgb, white 25%, transparent) inset,
              0 8px 16px -4px color-mix(in srgb, var(--color-success) 30%, transparent);
  color: #ffffff;
}

.btn-success:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn-danger {
  background: linear-gradient(180deg, var(--color-danger) 0%, color-mix(in srgb, var(--color-danger) 100%, black 12%) 100%);
  color: #ffffff;
  border-color: var(--color-danger);
  box-shadow: 0 1px 0 color-mix(in srgb, white 25%, transparent) inset, var(--shadow-xs);
}

.btn-danger:hover {
  background: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
  transform: translateY(-2px);
  box-shadow: 0 1px 0 color-mix(in srgb, white 25%, transparent) inset,
              0 8px 16px -4px color-mix(in srgb, var(--color-danger) 30%, transparent);
  color: #ffffff;
}

.btn-danger:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--color-danger-text);
  border-color: transparent;
}

.btn-danger-ghost:hover {
  background: var(--color-danger-soft);
  color: var(--color-danger-text);
}

.btn-outline-primary {
  background: transparent;
  color: var(--color-primary-text);
  border-color: color-mix(in srgb, var(--color-primary) 40%, transparent);
}

.btn-outline-primary:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary-text);
  transform: translateY(-1px);
}

.btn-outline-primary:active {
  transform: translateY(0);
}

/* Icon-only button (auto-scales with parent size) */
.btn-icon {
  padding: 0;
  flex-shrink: 0;
  width: 40px;
  min-height: 0;
  height: 40px;
}

.btn-sm.btn-icon { width: 32px; height: 32px; }
.btn-lg.btn-icon { width: 48px; height: 48px; }

/* Inline SVG icons (Lucide via {{ icon() }} Jinja helper).
   All icons inherit text color via stroke="currentColor" and use
   a 24x24 viewBox, so width/height set display size. */
.icon {
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
  width: 1.25em;
  height: 1.25em;
  stroke-width: 2;
}

.icon-xs { width: 0.875em;  height: 0.875em;  }
.icon-sm { width: 1em;     height: 1em;     }
.icon-md { width: 1.25em;  height: 1.25em;  }
.icon-lg { width: 1.5em;   height: 1.5em;   }
.icon-xl { width: 2em;     height: 2em;     }
.icon-2xl{ width: 2.5em;   height: 2.5em;   }
.icon-3xl{ width: 3rem;    height: 3rem;    }

.icon-thin   { stroke-width: 1; }
.icon-thick  { stroke-width: 2.5; }

.icon-muted     { color: var(--color-text-muted); }
.icon-primary   { color: var(--color-primary); }
.icon-accent    { color: var(--color-info); }
.icon-success   { color: var(--color-success); }
.icon-warning   { color: var(--color-warning); }
.icon-danger    { color: var(--color-danger); }
.icon-info      { color: var(--color-info); }

.icon-missing {
  font-family: monospace;
  color: var(--color-danger);
  font-weight: bold;
  display: inline-block;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
}

/* Loading state (shows spinner, disables interaction) */
.btn.is-loading {
  pointer-events: none;
  color: transparent !important;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  color: var(--color-text-inverse);
}

/* Button group (horizontal inline group) */
.btn-group {
  display: inline-flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* === Utility: Textarea Größen === */
.textarea-short { min-height: 80px; }
.textarea-tall  { min-height: 200px; }
.textarea-mono  { font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.6; tab-size: 2; }

/* === Utility: Click-Feedback & Hover-Lift === */
.hover-lift {
  transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.click-feedback {
  transition: transform var(--duration-instant) var(--ease-out);
}

.click-feedback:active {
  transform: scale(0.97);
}

/* === Utility: Section dividers === */
.divider {
  height: 1px;
  background: var(--color-border);
  border: 0;
  margin: var(--space-6) 0;
}

.divider-vertical {
  width: 1px;
  background: var(--color-border);
  align-self: stretch;
  margin: 0 var(--space-3);
}

/* === Utility: Hover-Glow (für primary actions) === */
.hover-glow {
  transition: box-shadow var(--duration-base) var(--ease-out);
}

.hover-glow:hover {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

/* === Card === */
.card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}

.card-interactive {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-border-strong);
  color: inherit;
}

.card-interactive:active {
  transform: translateY(-1px);
}

.card-elevated {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}

.card-elevated:hover {
  box-shadow: var(--shadow-md);
}

.card-bordered {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}

.card-flat {
  background: var(--color-bg-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
}

.card-padded {
  padding: var(--space-6);
}

.card-body {
  padding: var(--space-6);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-subtle);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  color: var(--color-text);
  margin: 0;
}

.card-text {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  margin: 0;
}

/* === Card with image === */
.media-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--duration-base) var(--ease-out);
  text-decoration: none;
  color: inherit;
}

.media-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-strong);
  color: inherit;
}

.media-card:active {
  transform: translateY(-2px);
}

.media-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-bg-muted);
  overflow: hidden;
}

.media-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.media-card:hover .media-card-img img {
  transform: scale(1.05);
}

.media-card-body {
  padding: var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.media-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  color: var(--color-text);
  margin: 0;
}

.media-card-text {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  flex: 1;
}

.media-card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

/* === Badge === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1;
  white-space: nowrap;
}

.badge-primary {
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.badge-info {
  background: var(--color-info-soft);
  color: var(--color-info-text);
}

.badge-warning {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
}

.badge-success {
  background: var(--color-success-soft);
  color: var(--color-success-text);
}

.badge-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger-text);
}

.badge-outline {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.badge-lg {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

/* === Forms === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 600px) {
  .form-row-2 { grid-template-columns: 1fr 1fr; }
  .form-row-3 { grid-template-columns: repeat(3, 1fr); }
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.form-label .required {
  color: var(--color-danger-text);
  margin-left: var(--space-1);
}

.form-help {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  line-height: var(--leading-snug);
}

.form-error {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-danger-text);
  margin-top: var(--space-1);
  font-weight: var(--weight-medium);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-sm);
  line-height: var(--leading-base);
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  min-height: 40px;
}

.input:hover:not(:disabled):not(:focus),
.textarea:hover:not(:disabled):not(:focus),
.select:hover:not(:disabled):not(:focus) {
  border-color: var(--color-border-strong);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--color-bg-muted);
}

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

.input.input-lg,
.textarea.input-lg,
.select.input-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-base);
  min-height: 48px;
  border-radius: var(--radius-md);
}

.input.input-sm,
.textarea.input-sm,
.select.input-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  min-height: 32px;
  border-radius: var(--radius-sm);
}

.textarea {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

.textarea-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  tab-size: 2;
}

.select {
  padding-right: var(--space-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%2371717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.select:disabled {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%23a1a1aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* File Input */
.input-file {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  min-height: 40px;
}

.input-file:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.input-file::file-selector-button {
  margin-right: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-muted);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.input-file:hover::file-selector-button {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-strong);
}

/* Search input (with leading icon) */
.input-search {
  position: relative;
  display: block;
}

.input-search::before {
  content: '';
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 1em;
  height: 1em;
  background: var(--color-text-muted);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center/contain no-repeat;
  pointer-events: none;
  opacity: 0.6;
}

.input-search .input {
  padding-left: var(--space-10);
}

/* Checkbox / Radio */
.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.3;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

/* Switch (toggle) */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.3;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.switch-track::before {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  background: var(--color-bg-elevated);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-fast) var(--ease-out);
}

.switch input:checked + .switch-track {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.switch input:checked + .switch-track::before {
  transform: translateX(16px);
  background: white;
}

.switch input:focus-visible + .switch-track {
  box-shadow: var(--shadow-focus);
}

/* Input group (addon prefix/suffix) */
.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.input-group .input,
.input-group .select {
  border-radius: 0;
  flex: 1;
  min-width: 0;
}

.input-group .input:first-child,
.input-group .select:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.input-group .input:last-child,
.input-group .select:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.input-group-addon {
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.input-group-addon:first-child {
  border-right: 0;
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.input-group-addon:last-child {
  border-left: 0;
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/* === Alert / Callout === */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-info-soft);
  color: var(--color-info-text);
  border: 1px solid color-mix(in srgb, var(--color-info) 20%, transparent);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.alert-icon {
  flex-shrink: 0;
  font-size: var(--text-lg);
  line-height: 1;
}

.alert-content {
  flex: 1;
}

.alert-content strong {
  display: block;
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
  color: inherit;
}

.alert-warning {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
  border-color: color-mix(in srgb, var(--color-warning) 20%, transparent);
}

.alert-success {
  background: var(--color-success-soft);
  color: var(--color-success-text);
  border-color: color-mix(in srgb, var(--color-success) 20%, transparent);
}

.alert-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger-text);
  border-color: color-mix(in srgb, var(--color-danger) 20%, transparent);
}

/* === Info Box (promo callout) === */
.info-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--color-primary-soft);
  border: 1px solid color-mix(in srgb, var(--color-primary) 20%, transparent);
  padding: var(--space-5) var(--space-6);
  margin: 0 auto var(--space-6);
  max-width: 720px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: var(--leading-relaxed);
  text-align: center;
}

.info-box strong {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-primary-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.info-box-info {
  background: var(--color-info-soft);
  border-color: color-mix(in srgb, var(--color-info) 20%, transparent);
}

.info-box-info strong {
  color: var(--color-info-text);
}

.info-box-warning {
  background: var(--color-warning-soft);
  border-color: color-mix(in srgb, var(--color-warning) 20%, transparent);
}

.info-box-warning strong {
  color: var(--color-warning-text);
}

/* === Tables === */
.table-wrap {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.table {
  width: 100%;
  font-size: var(--text-sm);
  line-height: var(--leading-base);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table th {
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
}

.table tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}

.table tbody tr:hover {
  background: var(--color-bg-muted);
}

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

.table-empty {
  padding: var(--space-12);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-3);
  opacity: 0.4;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

/* === Modal / Lightbox === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn var(--duration-base) var(--ease-out);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn var(--duration-slow) var(--ease-spring);
}

.modal-sm { max-width: 400px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1024px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 1.5rem;
  line-height: 1;
  transition: all var(--duration-fast) var(--ease-out);
}

.modal-close:hover {
  background: var(--color-bg-muted);
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* === Lightbox (image preview) === */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn var(--duration-base) var(--ease-out);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}

.lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-6);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: white;
  font-size: 1.75rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  transition: all var(--duration-fast) var(--ease-out);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  font-size: 2.5rem;
  line-height: 1;
  font-weight: 300;
  transition: all var(--duration-fast) var(--ease-out);
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: 1;
  cursor: pointer;
}

.lightbox-prev { left: var(--space-5); }
.lightbox-next { right: var(--space-5); }

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.05);
}

.lightbox-counter {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  display: none;
  padding: var(--space-2) var(--space-4);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  min-width: 280px;
  animation: toastIn var(--duration-slow) var(--ease-spring);
}

.toast.toast-exit {
  animation: toastOut var(--duration-base) var(--ease-out) forwards;
}

.toast-success { border-left-color: var(--color-success); }
.toast-error   { border-left-color: var(--color-danger); }
.toast-warning { border-left-color: var(--color-warning); }

.toast-icon {
  flex-shrink: 0;
  font-size: var(--text-xl);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
}
.toast-icon svg {
  width: 100%;
  height: 100%;
}

.toast-success .toast-icon { color: var(--color-success-text); }
.toast-error   .toast-icon { color: var(--color-danger-text); }
.toast-warning .toast-icon { color: var(--color-warning-text); }
.toast-info    .toast-icon { color: var(--color-info-text); }

.toast-body {
  flex: 1;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.toast-title {
  font-weight: var(--weight-semibold);
  margin-bottom: 2px;
}

.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-subtle);
  font-size: 1.25rem;
  line-height: 1;
}

.toast-close:hover {
  background: var(--color-bg-muted);
  color: var(--color-text);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(100%); }
}

/* === Tabs === */
.tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--color-bg-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.tab:hover {
  color: var(--color-text);
  background: var(--color-bg-elevated);
}

.tab.active {
  background: var(--color-bg-elevated);
  color: var(--color-text);
  box-shadow: var(--shadow-xs);
  font-weight: var(--weight-semibold);
}

.tab-panels {
  margin-top: var(--space-4);
}

.tab-panel {
  display: none;
  animation: fadeIn var(--duration-base) var(--ease-out);
}

.tab-panel.active {
  display: block;
}

/* === Filter pills (like filter-bar) === */
.filter-bar {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--space-6) var(--space-6);
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  flex-wrap: wrap;
}

.filter-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  transition: all var(--duration-fast) var(--ease-out);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.filter-btn:hover {
  background: var(--color-bg-muted);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.filter-btn.active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
  font-weight: var(--weight-semibold);
}

/* === Breadcrumb === */
.breadcrumb {
  padding: var(--space-4) var(--space-6);
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
}

.breadcrumb-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.breadcrumb-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumb-list li:not(:last-child)::after {
  content: '›';
  color: var(--color-text-subtle);
  font-size: 1.1em;
  line-height: 1;
}

.breadcrumb-list a {
  color: var(--color-primary);
  font-weight: var(--weight-medium);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumb-list a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

.breadcrumb-list [aria-current="page"] {
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* === Back to top button === */
.back-to-top {
  position: fixed;
  bottom: 96px;
  right: var(--space-6);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-lg);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--duration-base) var(--ease-out);
  z-index: var(--z-sticky);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-primary-hover);
  color: var(--color-text-inverse);
  transform: translateY(-2px);
}

@media (min-width: 1024px) {
  .back-to-top {
    bottom: var(--space-6);
  }
}

/* === Sticky CTA (mobile) === */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  z-index: var(--z-sticky);
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(100%);
  transition: transform var(--duration-base) var(--ease-out);
}

.sticky-cta.visible {
  transform: translateY(0);
}

.sticky-cta .btn {
  flex: 1;
  max-width: 240px;
}

@media (min-width: 1024px) {
  .sticky-cta {
    display: none;
  }
}

/* === Loading skeleton === */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-muted) 0%,
    var(--color-bg-subtle) 50%,
    var(--color-bg-muted) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Spinner === */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Scroll-Reveal Animationen === */
/* Default: visible (no JS / no IntersectionObserver / reduced motion) */
.reveal,
.reveal-stagger > * {
  opacity: 1;
  transform: none;
}

/* JS available + IO supported: hide until visible */
html.js .reveal:not(.reveal-in),
html.js .reveal-stagger > *:not(.reveal-in) {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  will-change: opacity, transform;
}

.reveal-in,
.reveal-stagger > .reveal-in {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > *:nth-child(1) { transition-delay: 0ms;   }
.reveal-stagger > *:nth-child(2) { transition-delay: 80ms;  }
.reveal-stagger > *:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger > *:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger > *:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger > *:nth-child(6) { transition-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* === Header scrolled state === */
.site-header.scrolled {
  box-shadow: var(--shadow-sm);
  border-bottom-color: color-mix(in srgb, var(--color-border) 50%, transparent);
}
