@charset "UTF-8";

/* Basisfarben – orientiert an deinem Naturkontor-Theme */
:root {
  --brown-900: #2f2417; /* tiefes Kontor-Braun */
  --brown-800: #3a2a1b;
  --brown-700: #5b3b24;
  --brown-400: #c7a97a;
  --brown-100: #f4ecdf;

  --yellow: #e2b857; /* Goldgelb für Badges / Akzente */

  --ink: var(--brown-900);
  --muted: #7b6a57;
  --paper: #fffaf2;
  --bg: #f4ecdf;
  --border: #e0d4c5;
  --beige: #efe1cf;

  --green: #5f7b4a;
  --green-700: #3f5531;

  --danger: #b3261e;
}

/* GLOBAL */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top left, #fdf7ec, #e8ddc8);
  color: var(--ink);
}

/* HEADER */
.admin-header {
  background: linear-gradient(120deg, var(--brown-900), var(--brown-700));
  color: #fffaf2;
  padding: 1.1rem 1.5rem 1.25rem;
  box-shadow: 0 6px 18px rgba(22, 15, 8, 0.55);
}

.admin-header-inner {
  max-width: 1120px;
  margin: 0 auto;
}

.admin-header h1 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
}

/* MAIN-LAYOUT */
.admin-main-full {
  max-width: 1120px;
  width: 100%;
  margin: 1.5rem auto 2rem;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-panel {
  background: var(--paper);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: 0 4px 14px rgba(47, 36, 23, 0.06);
}

.admin-panel--fullwidth {
  width: 100%;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--brown-900);
}

/* TABLE + TOOLBAR */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.table-search {
  flex: 1 1 220px;
}

.table-search-input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fdf7ec;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  color: var(--ink);
}

.table-search-input::placeholder {
  color: var(--muted);
}

.table-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.table-filter-select {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--brown-100);
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

.table-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* TABELLE */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

.admin-table thead {
  background: var(--beige);
}

.admin-table th,
.admin-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: normal; /* Standard: darf umbrechen */
}

/* Header brauchen wir fürs Resizing */
.admin-table th {
  position: relative;
}

/* Optischer Griff für Spalten-Resize */
.admin-table th::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;               /* gleiche Zone wie unser JS (±6px) */
  height: 100%;
  border-right: 1px solid var(--border);
  background: transparent;
  cursor: col-resize;       /* zeigt direkt: hier kannst du ziehen */
  opacity: 0.4;
}

/* Wenn du über der Spalte bist: Griff deutlicher */
.admin-table th:hover::before {
  background: rgba(0, 0, 0, 0.04); /* ganz leichte Schattierung */
  opacity: 1;
}

/* kompakte Spalten: ID */
.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
  width: 3rem;
  white-space: nowrap;
}

/* Preis-Spalte kompakt */
.admin-table th:nth-child(4),
.admin-table td:nth-child(4) {
  width: 4.5rem;
  white-space: nowrap;
}

/* Aktiv / Lager kompakt */
.admin-table th:nth-child(5),
.admin-table td:nth-child(5),
.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
  width: 6.5rem;
  white-space: nowrap;
}

/* Aktionen: etwas breiter, darf umbrechen */
.admin-table th:nth-child(7),
.admin-table td:nth-child(7) {
  width: 9rem; /* genug Platz für 2 Buttons */
  white-space: normal;
}

.admin-table tbody tr:hover {
  background: var(--brown-100);
}

/* Sortierbare Spalten */
.admin-table th[data-sort] {
  position: relative;
  padding-right: 1.1rem;
  user-select: none;
}

.admin-table th[data-sort]::after {
  content: "";
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid rgba(47, 36, 23, 0.25);
}

.admin-table th.is-sorted-asc::after {
  border-top: 6px solid rgba(47, 36, 23, 0.9);
  transform: translateY(-50%) rotate(180deg);
}

.admin-table th.is-sorted-desc::after {
  border-top: 6px solid rgba(47, 36, 23, 0.9);
}

.admin-table tbody tr.is-dragging {
  opacity: 0.7;
  background: var(--brown-100);
}

/* BADGES */
.badge-active {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(95, 123, 74, 0.15);
  color: var(--green-700);
}

.badge-inactive {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(123, 106, 87, 0.15);
  color: var(--muted);
}

.stock-label {
  font-size: 0.8rem;
  color: var(--muted);
}

/* FORMULAR */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-section-heading {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
  color: var(--brown-800);
}

/* Tabs im Formular */
.form-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.form-tab {
  border: none;
  background: transparent;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 999px 999px 0 0;
  cursor: pointer;
  color: var(--muted);
}

.form-tab.is-active {
  background: var(--brown-100);
  color: var(--brown-900);
  font-weight: 600;
}

.form-tabs-panels {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-tab-panel {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.form-tab-panel.is-active {
  display: flex;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-group--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.admin-form label {
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-form input[type="text"],
.admin-form input[type="number"],
.admin-form textarea {
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--paper);
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

.form-help {
  font-size: 0.8rem;
  color: #777;
  margin-top: 0.25rem;
}

/* BUTTONS */
.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: #fffaf2;
}

.btn-primary:hover {
  background: var(--green-700);
}

.btn-secondary {
  background: var(--brown-100);
  border-color: var(--border);
  color: #333;
}

.btn-secondary:hover {
  background: var(--beige);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #8f1c17;
}

/* ACTION-BUTTONS IN DER TABELLE */
.row-actions {
  display: flex;
  flex-wrap: wrap; /* darf umbrechen */
  justify-content: flex-end;
  gap: 0.25rem;
}

.row-actions .btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

/* STATUS */
.form-status {
  min-height: 1.2rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Bild-Dropzone (wird auch für Produkte benutzt) */
.image-dropzone {
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--brown-100);
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-size: 0.9rem;
}

.image-dropzone--products {
  background: #fcf5e6;
}

.image-dropzone:hover,
.image-dropzone--dragover {
  background: #e9dcc6;
  border-color: var(--green);
}

.image-dropzone-preview {
  margin-top: 0.5rem;
  max-width: 100%;
  max-height: 180px;
  border-radius: 0.5rem;
  display: block;
  object-fit: cover;
}

.image-dropzone-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .admin-main-full {
    padding: 0 0.75rem;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .table-filters {
    justify-content: flex-start;
  }
}

/* ADMIN NAVIGATION ----------------------------------- */
.admin-nav {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-nav-link {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fffaf2;
  text-decoration: none;
  transition: background 0.2s ease;
}

.admin-nav-link:hover {
  background: rgba(255, 255, 255, 0.25);
}

.admin-nav-link.active {
  background: var(--yellow);
  color: var(--brown-900);
  font-weight: 600;
}

/* Kontorbuch-Beiträge – Detailansicht (bestehend) */
.admin-table--clickable tbody tr {
  cursor: pointer;
}

.message-preview {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.message-preview-body {
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--brown-100);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.message-meta {
  font-size: 0.85rem;
  color: var(--muted);
}
