/* =======================================================================
   ClusterBuy – Interne Styles (Bestellungen + Bestellung + Profil)
   Struktur:
   1) Reset & Basis
   2) Design-Tokens (:root)
   3) Header (fix) & Grundlayout
   4) Utilities (Links, Buttons, Cards, Breadcrumbs, Container)
   5) Bestellungen (Liste/Übersicht)
   6) Bestellung (Detail: Tabelle & Zusammenfassung)
   7) Profil (Formularseite)
   8) Responsive
   ======================================================================= */


/* =========================================================
   1) RESET & BASIS
   ========================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }


/* =========================================================
   2) DESIGN-TOKENS (:root)
   ========================================================= */
:root {
  /* Farben & Typo */
  --color-text:#191818;
  --color-text-muted:#6b7280;
  --color-bg:#FBFAF9;
  --color-surface:#FFFFFF;
  --color-surface-soft:#FBF1EB;
  --color-accent:#FFD786;
  --link:#0a66c2;

  --border:#E5E7EB;
  --border-subtle:#E6E6E6;

  /* Layout */
  --header-h:80px;
  --radius-s:6px; --radius-m:8px; --radius-l:12px;
  --bw-1:1px; --bw-2:1px;
  --logo-h:50px; /* Einheitliche Logo-Höhe */

  /* Typo-Größen */
  --fz-12:12px; --fz-13:13px; --fz-14:14px;
}


/* =========================================================
   3) HEADER (fix) & GRUNDLAYOUT
   ========================================================= */
.site-header {
  position: fixed; top:0; left:0; right:0; z-index:1000;
  height: var(--header-h);
  display:flex; align-items:center; justify-content:space-between;
  padding: 10px 24px;
  background: #fff;
  border-bottom: var(--bw-1) solid #E6E6E6;
}

.brand {
  display:flex;
  align-items:center;
  gap:12px;
}
.site-logo {
  display:block;
  height:var(--logo-h);
  width:auto;
}

.has-fixed-header { padding-top: var(--header-h); }

/* Standard-Container für statische Rechtstexte etc. */
.container {
  width:100%;
  max-width:1000px;
  margin:24px auto;
  padding:0 16px;
}


/* =========================================================
   4) UTILITIES (Links, Buttons, Cards, Breadcrumbs)
   ========================================================= */
.link-back {
  font-size: var(--fz-12);
  color: var(--color-text);
  border: var(--bw-1) solid var(--border-subtle);
  padding:6px 10px;
  border-radius: var(--radius-s);
  background: var(--color-surface);
  cursor:pointer;
}
.link-back:hover { text-decoration:none; filter:brightness(.98); }

.breadcrumbs, .order-breadcrumbs, .profil_breadcrumbs {
  font-size: var(--fz-12);
  color: var(--color-text-muted);
  margin: 0 0 12px;
}

.card {
  background: var(--color-surface);
  border: var(--bw-1) solid var(--border-subtle);
  border-radius: var(--radius-l);
  padding:18px;
}

.h2 { margin:0 0 8px; font-size: var(--fz-14); }
.note { font-size: var(--fz-12); color: var(--color-text-muted); margin-bottom:12px; }

.filters {
  display:flex; flex-wrap:wrap; gap:10px; margin-bottom:12px;
}
.filters .input, .filters .select {
  height:38px; padding:6px 10px;
  border: var(--bw-1) solid var(--border);
  border-radius: var(--radius-s);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--fz-12);
}

/* globaler Octagon-Innenrand */
.hex{ position:relative; overflow:visible; }
.hex::before{
  content:""; position:absolute; inset:5px; clip-path:inherit;
  background:rgba(0,0,0,0.04); filter:blur(2px); pointer-events:none;
}


/* =========================================================
   5) BESTELLUNGEN (ALLE)
   ========================================================= */
.table-wrap { overflow-x:auto; }

table.orders {
  width:100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--color-surface);
  border: var(--bw-1) solid var(--border-subtle);
  border-radius: var(--radius-l);
}

table.orders col.col-ord   { width:100px; }
table.orders col.col-date  { width:120px; }
table.orders col.col-articles { width:auto; }
table.orders col.col-sum   { width:120px; }
table.orders col.col-status{ width:110px; }

.orders thead th {
  font-weight:600;
  font-size: var(--fz-12);
  color: var(--color-text);
  padding:10px;
  text-align:left;
  border-bottom: var(--bw-1) solid var(--border-subtle);
}
.orders td {
  padding:10px;
  border-bottom: var(--bw-1) solid var(--border-subtle);
  font-size: var(--fz-12);
  vertical-align:top;
  text-align:left;
}
.orders th.sum, .orders td.sum,
.orders th.status, .orders td.status { text-align:right; }

.artikel-liste {
  margin:0; padding-left:18px;
  font-size: var(--fz-12); color: var(--color-text);
}
.artikel-liste li { margin-bottom:2px; overflow-wrap:anywhere; }

.row-toggle { cursor:pointer; }
.row-toggle:hover { background: var(--color-surface-soft); }

/* Status-Badges */
.status-badge {
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  font-size: var(--fz-12);
  border: var(--bw-1) solid var(--border-subtle);
  background: var(--color-surface);
  white-space:nowrap;
}
.status-badge.open    { background:#eef2ff; }
.status-badge.paid    { background:#fdf6ec; }
.status-badge.shipped { background:#ecfdf5; }
.status-badge.cancel  { background:#fef2f2; }


/* =========================================================
   6) BESTELLUNG (DETAIL)
   ========================================================= */
.order-container {
  width:100%;
  max-width:1100px;            /* etwas breiter, damit die rechte Spalte wirken kann */
  margin:0 auto;
  padding:calc(var(--header-h) + 16px) 16px 24px;
}

.order-head {
  display:grid;
  grid-template-columns:1fr max-content;
  align-items:center;
  margin-bottom:12px;
}
.order-meta { font-size: var(--fz-13); color: var(--color-text-muted); }

/* Layout: Liste links – Zusammenfassung rechts (rechte Spalte bewusst breiter) */
.order-layout{
  display:grid;
  grid-template-columns: 0.9fr 1.7fr;   /* rechte Spalte deutlich größer */
  gap: 32px;
  align-items:start;
}

/* Zusammenfassung soll NICHT vom Hex/Oktagon begrenzt werden */
.order-summary.hex {
  width: 100% !important;
  max-width: none !important;
  aspect-ratio: unset !important;
  clip-path: none !important;
  border-radius: 12px !important;
  padding: 24px 26px !important;
  background: #fff !important;
  position: relative;
}
/* Innenrand der Zusammenfassung neu zeichnen (ohne clip-path) */
.order-summary.hex::before {
  content:"";
  position:absolute;
  inset:6px;
  border-radius:inherit;
  background:rgba(0,0,0,0.04);
  filter:blur(2px);
  pointer-events:none;
  clip-path:none !important;
}

.order-summary h3{ margin: 4px 0 14px; }
.sum-row{
  display:flex; justify-content:space-between; align-items:center;
  padding:8px 0;
}
.sum-sub{
  display:flex; justify-content:space-between; align-items:center;
  font-size: 13px; opacity: .8;
}
.sum-row.total{ font-weight: 700; font-size: 18px; }
.sum-row.surcharge strong{ color:#b30000; }
.sum-note{
  background:#fff7e6; border:1px dashed #f0c16b; border-radius:8px;
  padding:10px 12px; margin-top:10px; font-size:13px;
}
.sep{ border:none; border-top:1px solid #eee; margin:14px 0; }

.iban-box{ margin-top:16px; }
.iban-box h4{ margin:6px 0 10px; }
.iban{
  display:grid; grid-template-columns:auto 1fr; gap:10px; align-items:center;
  margin:6px 0;
}
.iban code{
  display:inline-block; padding:7px 10px; border:1px solid #eee; border-radius:6px; background:#fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:13px;
}

/* Tabelle der Positionen */
.order-table{
  width:100%;
  border-collapse: collapse;
  background:#fff;
  border:1px solid #eee;
  border-radius:8px;
  overflow:hidden;
  font-size:14px;
}
.order-table th, .order-table td{
  padding:10px 12px;
  border-bottom:1px solid #f0f0f0;
  vertical-align:middle;
}
.order-table thead th{
  background:#fafafa;
  font-weight:600;
  text-align:left;
}
.ta-right{ text-align:right; }
.sum-row-table td{
  background:#f6f6f6;
  font-weight:600;
  border-top:2px solid #ddd;
}

/* (Alte Kartenansicht – belassen, falls anderswo genutzt) */
.order-lines { list-style:none; margin:12px 0 0; padding:0; display:flex; flex-direction:column; gap:8px; }
.order-item {
  display:grid;
  grid-template-columns:1fr clamp(220px, 28vw, 320px) 36px;
  gap:8px; align-items:start;
  background: var(--color-surface);
  border: var(--bw-1) solid var(--border-subtle);
  border-radius: var(--radius-l);
  padding:8px;
}
.product-desc { font-size: var(--fz-12); line-height:1.2; color: var(--color-text); overflow-wrap:anywhere; }
.product-desc .url { display:block; font-size: var(--fz-12); color: var(--color-text); text-decoration: underline; opacity:.9; }
.product-meta-ro { display:grid; gap:6px; }
.meta-row-ro {
  display:flex; justify-content:space-between; gap:8px;
  border: var(--bw-1) solid var(--border-subtle);
  border-radius: var(--radius-s);
  padding:4px 6px;
  background: var(--color-surface-soft);
  font-size: var(--fz-12);
}
.meta-row-ro .k { color: var(--color-text-muted); }
.meta-row-ro .v { color: var(--color-text); font-weight:600; }
.meta-row-ro.total { background: var(--color-bg); font-size: var(--fz-13); }
.select-col { display:flex; align-items:center; justify-content:center; }
.order-actions { margin-top:12px; text-align:right; }


/* =========================================================
   7) PROFIL (Formularseite)
   ========================================================= */
.profil_container {
  max-width:440px;
  margin:20px auto;
  padding:0 16px;
  padding-top:var(--header-h);
}
.profil_status { font-size: var(--fz-12); margin-left:10px; font-weight:600; }
.profil_card {
  border: var(--bw-1) solid var(--border-subtle);
  border-radius:8px;
  padding:16px;
  background: var(--color-surface);
  max-width:1000px;
}

/* Grid */
.profil_formGrid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.profil_namesRow { grid-template-columns:80px 100px auto; }
.profil_full { grid-column:1 / -1; }

/* Felder */
.profil_field { display:flex; flex-direction:column; gap:4px; }
.profil_label { font-size: var(--fz-12); }

/* Inputs / Select / Textarea */
.profil_input, .profil_select {
  width:100%; height:28px; padding:4px 8px;
  border:1px solid var(--border);
  border-radius:4px;
  font-size: var(--fz-12);
  background: var(--color-surface);
}
.profil_textarea {
  min-height:84px;
  resize:vertical;
  padding:6px 8px;
  border:1px solid var(--border);
  border-radius:4px;
  font-size: var(--fz-12);
  background: var(--color-surface);
}

/* Spezifische Breiten */
.profil_anrede { max-width:80px; }
.profil_vorname { max-width:200px; }
.profil_nachname { max-width:360px; }
.profil_strasse { max-width:250px; }

.profil_plzOrtRow { display:grid; grid-template-columns:60px 180px; gap:10px; }
.profil_plz { max-width:60px; }
.profil_ort { max-width:200px; }
.profil_land { max-width:120px; }
.profil_email { min-width:250px; max-width:600px; width:250px; }
.profil_telefon { max-width:100%; }

.profil_actions { margin-top:8px; text-align:right; }
.profil_btn {
  padding:6px 12px;
  border:1px solid var(--border);
  border-radius:4px;
  font-size: var(--fz-12);
  cursor:pointer;
  background: var(--color-accent);
  color:#000;
}


/* =========================================================
   8) RESPONSIVE
   ========================================================= */
@media (max-width:760px){
  table.orders col.col-ord,
  table.orders col.col-date,
  table.orders col.col-sum,
  table.orders col.col-status { width:auto; }
}

@media (max-width:900px){
  .order-item { grid-template-columns:1fr; }
  .select-col { justify-content:flex-end; }
}

@media (max-width:560px){
  .select-col { justify-content:flex-start; }
}

@media (max-width: 980px){
  .order-layout{ grid-template-columns: 1fr; } /* Mobil einspaltig */
}

.order-submit-wrapper {
  margin-top: 18px;
}

.btn-primary-wide {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: #ffd786;    /* gleiche Farbe wie Portal */
  color: #000;
  text-align: center;
  transition: filter .15s ease;
}

.btn-primary-wide:hover {
  filter: brightness(.92);
}

.address-select-box {
  padding: 18px 20px;
  border-radius: 12px;
  margin-bottom: 18px;
  background: #fff;
}

.address-select-box h4 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
}

.address-option {
  display:flex;
  align-items:center;
  gap:8px;
  margin:6px 0;
  font-size:14px;
}

.new-address-fields {
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.addr-input {
  width:100%;
  padding:8px 10px;
  border:1px solid #ddd;
  border-radius:6px;
  font-size:14px;
}

.addr-row {
  display:flex;
  gap:8px;
}

.addr-input.short {
  width:100px;
}
