/* ===========================================================================
   KP Medienshop Admin – modernes Layout (Sidebar + Topbar + heller Content).
   Orientiert am Mockup-Aufbau, aber in zeitgemaesser Optik.
   =========================================================================== */

:root {
  --accent:        #e2001a;   /* KP-Rot (Marke) */
  --accent-600:    #b80016;
  --accent-tint:   rgba(226, 0, 26, .12);

  --sidebar-bg:    #14161b;
  --sidebar-fg:    #c9ced7;
  --sidebar-muted: #767d8a;
  --sidebar-hover: rgba(255, 255, 255, .06);

  --content-bg:    #f4f5f7;
  --card-bg:       #ffffff;
  --border:        #e6e8ec;
  --text:          #1f2329;
  --text-muted:    #6b7280;

  --radius:        .65rem;
  --radius-sm:     .4rem;
  --shadow-sm:     0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-md:     0 4px 12px rgba(16, 24, 40, .08);

  --sidebar-w:     248px;
}

body {
  background: var(--content-bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* --- App-Shell ----------------------------------------------------------- */
.app { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.15rem 1.25rem; color: #fff; text-decoration: none;
  font-weight: 800; letter-spacing: .02em; font-size: 1.05rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: .55rem;
  background: var(--accent); color: #fff; font-size: 1.05rem;
}
.sidebar-brand:hover { color: #fff; }

.sidebar-section {
  padding: 1.1rem 1.25rem .35rem; font-size: .68rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--sidebar-muted);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .6rem; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .7rem; border-radius: var(--radius-sm);
  color: var(--sidebar-fg); text-decoration: none;
  font-size: .9rem; font-weight: 500; line-height: 1.2;
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-link .bi { font-size: 1.05rem; color: var(--sidebar-muted); width: 1.2rem; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link:hover .bi { color: var(--sidebar-fg); }
.sidebar-nav .nav-link.active {
  background: var(--accent-tint); color: #fff; font-weight: 600;
  border-left-color: var(--accent);
}
.sidebar-nav .nav-link.active .bi { color: var(--accent); }

.sidebar-foot {
  margin-top: auto; padding: 1rem 1.25rem;
  font-size: .72rem; color: var(--sidebar-muted);
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* --- Topbar -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem 1.75rem; background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.user-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .7rem; border-radius: 999px;
  background: var(--content-bg); border: 1px solid var(--border);
  font-size: .82rem; color: var(--text); font-weight: 500;
}
.user-chip .bi { color: var(--text-muted); }

/* --- Content ------------------------------------------------------------- */
.content { padding: 1.6rem 1.75rem 2.5rem; }

/* --- Auth (nicht eingeloggt): zentriert, ohne Sidebar -------------------- */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.auth-shell > * { width: 100%; max-width: 420px; }

/* --- Cards --------------------------------------------------------------- */
.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card .card-body { padding: 1.1rem 1.25rem; }
.card .card-header {
  background: #fafbfc; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: .92rem; padding: .8rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* --- Buttons (Akzent) ---------------------------------------------------- */
.btn { border-radius: var(--radius-sm); font-weight: 500; }
.btn-kino { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-kino:hover, .btn-kino:focus { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.btn-outline-kino { border-color: var(--accent); color: var(--accent); }
.btn-outline-kino:hover, .btn-outline-kino:focus { background: var(--accent); color: #fff; }

/* --- Tabellen ------------------------------------------------------------ */
.table { --bs-table-hover-bg: #fafbfc; margin-bottom: 0; }
.table > thead th {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); background: #fafbfc;
  border-bottom: 1px solid var(--border); padding: .7rem .85rem; white-space: nowrap;
}
.table > tbody td { padding: .7rem .85rem; border-color: #f0f1f3; vertical-align: middle; }
.table > tbody tr:last-child td { border-bottom: 0; }
.table code { color: var(--text); background: #f4f5f7; padding: .1rem .35rem; border-radius: .3rem; font-size: .84rem; }

/* Sortierbare Header */
th.sort-header a { white-space: nowrap; color: inherit; text-decoration: none; }
th.sort-header a:hover { color: var(--accent) !important; }
th.sort-header a:hover .bi { opacity: 1 !important; }

/* --- Status-Badge (Pill mit Statusfarbe) --------------------------------- */
.status-cell {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .28rem .7rem; border-radius: 999px;
  font-weight: 600; font-size: .76rem; line-height: 1.25; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .07);
}

/* --- Tracking-Aufklappen (natives <details>) ----------------------------- */
details.tracking > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem;
}
details.tracking > summary::-webkit-details-marker { display: none; }
details.tracking .tracking-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; border: 1px solid #cfd4da; border-radius: .3rem;
  font-weight: 700; line-height: 1; color: #6b7280; background: #fff;
}
details.tracking[open] .tracking-toggle::before { content: "\2212"; }
details.tracking:not([open]) .tracking-toggle::before { content: "+"; }
details.tracking .tracking-more { margin-top: .3rem; }

/* --- Paket-Zuordnung der Barcodes (Bestelldetail) ------------------------ */
.pkg-badge {
  display: inline-flex; align-items: center;
  padding: .12rem .5rem; border-radius: 999px;
  font-size: .7rem; font-weight: 600; line-height: 1.35; white-space: nowrap;
  background: var(--accent-tint); color: var(--accent-600);
}
.pkg-badge-none {
  background: #eef0f3; color: var(--text-muted); font-weight: 500;
}

/* --- Pagination ---------------------------------------------------------- */
.pagination { --bs-pagination-color: var(--accent); --bs-pagination-hover-color: var(--accent-600); }
.pagination .active > .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }

/* --- Responsive: Sidebar wird zur oberen Leiste -------------------------- */
@media (max-width: 991.98px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; flex-basis: auto; height: auto; position: static;
    flex-direction: row; align-items: center; flex-wrap: wrap;
  }
  .sidebar-brand { border-bottom: 0; padding: .85rem 1rem; }
  .sidebar-section { display: none; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 0 .6rem .6rem; }
  .sidebar-nav .nav-link { border-left: 0; }
  .sidebar-nav .nav-link.active { border-left: 0; box-shadow: inset 0 -2px 0 var(--accent); }
  .sidebar-foot { display: none; }
  .content { padding: 1.1rem 1rem 2rem; }
  .topbar { padding: .7rem 1rem; }
}
