:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --primary: #2952cc;
  --primary-2: #1e40af;
  --accent: #0f766e;
  --text: #1f2430;
  --muted: #5d6778;
  --border: #d8dfeb;
  --success: #1d7a44;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.mit-ladeanzeige {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

header {
  background: linear-gradient(90deg, #0f172a, #111827 55%, #0b1220);
  color: #fff;
  padding: 1rem 1.5rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

header nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

header nav a {
  color: #fff;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  transition: background 0.15s ease;
}

header nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

main {
  padding: 1.5rem;
  max-width: 1440px;
  margin: 0 auto;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.1rem;
  box-shadow: 0 14px 40px rgba(17, 24, 39, 0.06);
}

.card h2,
.card h3 {
  margin-top: 0;
}

.stat {
  font-size: 1.9rem;
  font-weight: bold;
}

form {
  display: grid;
  gap: 0.8rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}

.barcode-input-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
}

.barcode-scan-trigger {
  width: 100%;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button,
.button {
  border: 0;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(41, 82, 204, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(41, 82, 204, 0.22);
}

button:active,
.button:active {
  transform: translateY(0);
}

button.secondary,
.button.secondary {
  background: linear-gradient(180deg, #eef4ff, #e7eefc);
  color: var(--primary);
  box-shadow: none;
}

button.danger {
  background: var(--error);
  box-shadow: none;
}

button .icon,
.button .icon {
  margin-right: 0.45rem;
  font-size: 0.95em;
}

button.secondary .icon,
.button.secondary .icon {
  color: var(--primary);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.column-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  background: #fff;
}

.column-toggle-label input[type='checkbox'] {
  accent-color: var(--primary);
}

.column-toggle-label.is-inactive {
  opacity: 0.85;
  color: var(--muted);
  background: #f7f9fc;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.7rem;
  text-align: left;
  vertical-align: top;
}

thead th {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: rgba(41, 82, 204, 0.03);
}

tr.article-row {
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

tr.article-row td:first-child {
  border-left: 3px solid transparent;
}

tr.article-row:hover td {
  background: rgba(41, 82, 204, 0.05);
}

tr.article-row:hover td:first-child {
  border-left-color: var(--primary);
}

tr.article-row input[type='checkbox'] {
  cursor: default;
}

.muted {
  color: var(--muted);
}

.message {
  padding: 0.9rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.message.notice {
  background: #ecfdf5;
  color: var(--success);
}

.message.error {
  background: #fdecea;
  color: var(--error);
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  background: rgba(41, 82, 204, 0.1);
  color: var(--primary-2);
  font-size: 0.85rem;
}

.pill-valuable {
  background: rgba(22, 163, 74, 0.15);
  color: #166534;
}

.status-draft {
  background: rgba(107, 114, 128, 0.14);
  color: #374151;
}

.status-imported {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
}

.status-listed {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.status-watching {
  background: rgba(168, 85, 247, 0.16);
  color: #7c3aed;
}

.status-sold {
  background: rgba(22, 163, 74, 0.16);
  color: #166534;
}

.status-archived {
  background: rgba(100, 116, 139, 0.18);
  color: #475569;
}

.images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.images img {
  width: min(100%, 400px);
  max-width: 400px;
  max-height: 400px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}

.image-select-button {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: none;
}

.image-select-button img {
  width: 100%;
}

.image-select-button.is-primary img {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
}

.image-primary-badge {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}

.image-primary-flag {
  position: absolute;
  right: 0.6rem;
  top: 0.6rem;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.thumbnail {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f3f4f6;
}

.small {
  font-size: 0.9rem;
}

canvas {
  width: 100%;
  max-height: 340px;
}

.ladeanzeige {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.2);
  display: grid;
  place-items: center;
  z-index: 1000;
}

.ladeanzeige[hidden] {
  display: none !important;
}

.ladeanzeige-box {
  width: min(420px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 50px rgba(17, 24, 39, 0.18);
  padding: 1rem;
}

.ladeanzeige-text {
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.ladeanzeige-balken {
  height: 10px;
  background: #e9edf5;
  border-radius: 999px;
  overflow: hidden;
}

.ladeanzeige-balken span {
  display: block;
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, #2952cc, #60a5fa);
  border-radius: 999px;
  animation: ladeanzeige-bewegung 1.2s ease-in-out infinite;
}

@keyframes ladeanzeige-bewegung {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: grid;
  place-items: center;
  z-index: 1200;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-content {
  width: min(840px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 1rem;
}

.modal-content--image {
  width: auto;
  max-width: calc(100vw - 2rem);
  background: transparent;
  border: 0;
  box-shadow: none;
  position: relative;
}

.modal-close {
  position: absolute;
  right: 0.25rem;
  top: 0.25rem;
  z-index: 1;
}

.modal-image-original {
  max-width: calc(100vw - 4rem);
  max-height: calc(100vh - 4rem);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.modal-content--scanner {
  width: min(560px, calc(100vw - 2rem));
}

.scanner-headline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.scanner-headline-row h3 {
  margin: 0;
}

.scanner-video-wrap {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0f172a;
  aspect-ratio: 4 / 3;
}

#barcodeScannerVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scanner-overlay::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(72vw, 360px);
  height: min(28vw, 120px);
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  box-shadow: 0 0 0 120vmax rgba(15, 23, 42, 0.28);
}

@media (min-width: 768px) {
  .barcode-input-group {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .barcode-scan-trigger {
    width: auto;
    white-space: nowrap;
  }
}

@media (max-width: 767px) {
  .modal-content--scanner {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    padding: 0.85rem;
  }

  .scanner-overlay::before {
    width: min(84vw, 360px);
    height: min(34vw, 140px);
  }
}
