/* Verwaltungsbereich. */

.admin-page { min-height: 100dvh; }

/* ------------------------------------------------------------- Anmeldung */

.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card { padding: 1.7rem; width: 100%; max-width: 380px; }
.login-card h1 { font-size: 1.3rem; }
.login-card .btn { width: 100%; margin-top: 0.3rem; }
.login-hint { margin: 0.9rem 0 0; }

/* ----------------------------------------------------------------- Kopf */

.admin-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.admin-header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem clamp(0.8rem, 2.5vw, 1.4rem);
  max-width: 1600px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.wordmark {
  font-weight: 720;
  font-size: 1.02rem;
  text-decoration: none;
  color: var(--ink);
}

.tabs { display: flex; gap: 0.25rem; flex: 1; }

.tab {
  font: inherit;
  font-weight: 550;
  font-size: 0.92rem;
  padding: 0.45em 0.85em;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tab:hover { background: #eef0f3; color: var(--ink); }

.tab[aria-selected="true"] {
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
}

.admin-header-actions { display: flex; align-items: center; gap: 0.6rem; }

/* --------------------------------------------------------------- Layout */

.admin-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: clamp(0.8rem, 2vw, 1.3rem);
}

.panel {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: clamp(0.8rem, 2vw, 1.2rem);
  align-items: start;
}

.panel-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: 4.2rem;
}

.panel-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.panel-list-head h2 { margin: 0; font-size: 0.98rem; }

.entity-list {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  max-height: min(62vh, 640px);
  overflow-y: auto;
}

.entity-item {
  width: 100%;
  text-align: left;
  font: inherit;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.entity-item:hover { background: #f1f3f5; }

.entity-item[aria-current="true"] {
  background: color-mix(in srgb, var(--brand) 11%, transparent);
}

.entity-thumb {
  width: 38px;
  height: 30px;
  border-radius: 5px;
  object-fit: cover;
  background: #eceef1;
  flex: 0 0 auto;
}

.entity-swatch {
  width: 10px;
  height: 34px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.entity-text { min-width: 0; }

.entity-title {
  display: block;
  font-weight: 550;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-sub { display: block; font-size: 0.78rem; color: var(--muted); }

.panel-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 2.2vw, 1.5rem);
  min-height: 300px;
}

.empty-hint { padding: 2.5rem 1rem; text-align: center; }

/* ------------------------------------------------------------ Formulare */

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.detail-head h2 { margin: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0 0.9rem;
}

.field-wide { grid-column: 1 / -1; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  margin: 0 0 1rem;
}

legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.4em;
}

.usp-row { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.4rem; }
.usp-row input { flex: 1; }

.form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------- Öffentlicher Link */

.public-url {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f1f3f5;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.35rem 0.35rem 0.7rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.public-url code {
  flex: 1;
  background: none;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------- Uploads */

.upload-slot {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.upload-slot-required { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }

.upload-info { flex: 1; min-width: 140px; }
.upload-info strong { font-size: 0.88rem; display: block; }
.upload-info span { font-size: 0.79rem; color: var(--muted); }

.upload-preview {
  width: 54px;
  height: 42px;
  border-radius: 5px;
  object-fit: cover;
  background: #eceef1;
}

input[type="file"] { padding: 0.4em; font-size: 0.82rem; min-height: 38px; }

/* ------------------------------------------------ Produkte im Karussell */

.member-list { list-style: none; margin: 0 0 0.8rem; padding: 0; display: grid; gap: 0.35rem; }

.member-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.member-item.dragging { opacity: 0.45; }
.member-item.drop-target { border-color: var(--brand); border-style: dashed; }

.member-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  user-select: none;
}

.member-pos {
  font-size: 0.76rem;
  color: var(--muted);
  min-width: 1.6em;
  font-variant-numeric: tabular-nums;
}

.member-name { flex: 1; font-size: 0.88rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-actions { display: flex; gap: 0.2rem; }
.member-warn { color: var(--danger); font-size: 0.78rem; }

.assign-row { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.assign-row .field { flex: 1; min-width: 200px; margin-bottom: 0; }

.checkbox-list { display: grid; gap: 0.3rem; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.89rem;
}

.checkbox-row input { width: auto; min-height: auto; }

/* ----------------------------------------------------------------- Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 0.65em 1.1em;
  border-radius: 999px;
  font-size: 0.88rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
  max-width: calc(100vw - 2rem);
  text-align: center;
}

.toast-error { background: var(--danger); }

/* ------------------------------------------------------------ Responsive */

@media (max-width: 860px) {
  .panel { grid-template-columns: minmax(0, 1fr); }
  .panel-list { position: static; }
  .entity-list { max-height: 42vh; }
  .tabs { order: 3; width: 100%; }
  .admin-header-actions { margin-left: auto; }
}
