/* ==========================================================================
   Bestellsystem – Base / Layout (FINAL, konsolidiert)
   - Stabiler Hintergrund (kein Umbruch/Seam)
   - Tokens: Light/Dark via html[data-theme]
   - Panels/Buttons im „Login Look“
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root{
  --bg1:#0f172a;
  --bg2:#020617;

  --card: rgba(255,255,255,.10);
  --card2: rgba(255,255,255,.06);

  --border: rgba(255,255,255,.14);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.68);

  --shadow: 0 18px 55px rgba(0,0,0,.35);
  --radius: 22px;

  --focus: rgba(99,102,241,.30);
  --btn: #4f46e5;
  --btnHover: #4338ca;

  --danger: rgba(255,77,79,.95);
  --theme-ease: 220ms ease;

  --content-max: 1180px;
  --pad: 18px;
}

/* Explicit themes */
html[data-theme="dark"]{
  --bg1:#0f172a;
  --bg2:#020617;

  --card: rgba(255,255,255,.10);
  --card2: rgba(255,255,255,.06);

  --border: rgba(255,255,255,.14);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.68);

  --shadow: 0 18px 55px rgba(0,0,0,.35);
  --focus: rgba(99,102,241,.30);

  --btn: #4f46e5;
  --btnHover: #4338ca;
}

html[data-theme="light"]{
  --bg1:#f8fafc;
  --bg2:#e5e7eb;

  --card: rgba(255,255,255,.92);
  --card2: rgba(255,255,255,.76);

  --border: rgba(17,24,39,.12);
  --text: rgba(17,24,39,.92);
  --muted: rgba(17,24,39,.62);

  --shadow: 0 18px 55px rgba(17,24,39,.12);
  --focus: rgba(99,102,241,.22);

  --btn: #4f46e5;
  --btnHover: #4338ca;
}

/* ---------- Base ---------- */
*{ box-sizing:border-box; }
html, body{ height:100%; }

html{
  /* Stabiler Background ohne „Seam“ */
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body{
  margin:0;
  min-height: 100svh; /* verhindert mobile „Umbruch“-Artefakte */
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--text);
  background: transparent; /* Hintergrund sitzt auf html */
  transition: color var(--theme-ease);
}

/* Subtle glow – stabiler auf html statt body */
html::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(255,255,255,.04), transparent 60%);
  opacity: 1;
  transition: opacity var(--theme-ease);
  z-index: 0;
}
html[data-theme="light"]::before{ opacity: .8; }

/* Focus */
:focus-visible{
  outline: 3px solid rgba(99,102,241,.45);
  outline-offset: 3px;
}

/* ---------- Generic layout containers ---------- */
.layout,
.app-shell{
  width: min(var(--content-max), 100%);
  margin: 0 auto;
  padding: 26px 16px 40px;
  position: relative;
  z-index: 1; /* über html::before */
}

/* Panels (Glass) */
.panel{
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card), var(--card2));
  box-shadow: var(--shadow);
  overflow:hidden;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition:
    background-color var(--theme-ease),
    color var(--theme-ease),
    border-color var(--theme-ease),
    box-shadow var(--theme-ease);
}

/* ---------- Header ---------- */
.app-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px var(--pad);
  border-bottom: 1px solid rgba(255,255,255,.10);
}
html[data-theme="light"] .app-header{
  border-bottom: 1px solid rgba(17,24,39,.08);
}

.brand{
  display:flex;
  align-items:center;
  gap: 14px;
  min-width: 0;
}

.brand-logo{
  height: 46px;
  width: auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  background: rgba(255,255,255,.06);
}
html[data-theme="light"] .brand-logo{
  border: 1px solid rgba(17,24,39,.10);
  box-shadow: 0 12px 32px rgba(17,24,39,.10);
  background: rgba(17,24,39,.03);
}

.brand-titles{ min-width:0; }

.brand-kicker{
  display:flex;
  align-items:center;
  gap:10px;
  user-select:none;
  margin: 0 0 4px;
}
.dot{
  width:10px;height:10px;border-radius:999px;
  background: var(--btn);
  box-shadow: 0 10px 24px rgba(79,70,229,.20);
}
.brand-kicker-text{
  font-weight: 700;
  letter-spacing: .12em;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.brand-title{
  margin:0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

/* ---------- Header actions ---------- */
.header-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

/* Ghost link/button */
.btn-ghost{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  text-decoration:none;
  font-size:12px;
  font-weight:800;
  line-height:1;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
  transition: transform 120ms ease, box-shadow 180ms ease, background-color var(--theme-ease), border-color var(--theme-ease);
}
html[data-theme="light"] .btn-ghost{
  background: rgba(17,24,39,.03);
  box-shadow: 0 10px 22px rgba(17,24,39,.10);
}
.btn-ghost:hover{ transform: translateY(-1px); }
.btn-ghost:active{ transform: translateY(1px); }

/* Theme toggle */
.theme-toggle{
  display:inline-flex;
  align-items:center;
  gap:10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
  line-height: 1;
  transition: transform 120ms ease, box-shadow 180ms ease, background-color var(--theme-ease), border-color var(--theme-ease);
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
html[data-theme="light"] .theme-toggle{
  background: rgba(17,24,39,.03);
  box-shadow: 0 10px 22px rgba(17,24,39,.10);
}
.theme-toggle:hover{ transform: translateY(-1px); }
.theme-toggle:active{ transform: translateY(1px); }

.theme-icon{
  width: 18px;
  height: 18px;
  display:grid;
  place-items:center;
  position:relative;
}
.theme-icon svg{
  width: 18px;
  height: 18px;
  display:block;
  opacity: .9;
}
.theme-icon .sun,
.theme-icon .moon{
  position:absolute;
  transition: opacity var(--theme-ease), transform var(--theme-ease);
}
html[data-theme="dark"] .theme-icon .sun{ opacity: 0; transform: rotate(-25deg) scale(.85); }
html[data-theme="dark"] .theme-icon .moon{ opacity: 1; transform: rotate(0deg) scale(1); }
html[data-theme="light"] .theme-icon .sun{ opacity: 1; transform: rotate(0deg) scale(1); }
html[data-theme="light"] .theme-icon .moon{ opacity: 0; transform: rotate(25deg) scale(.85); }

/* ---------- Body content ---------- */
.app-body{ padding: var(--pad); }

/* ---------- Footer ---------- */
.app-footer{
  padding: 14px var(--pad);
  display:flex;
  flex-wrap:wrap;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,.10);
  color: var(--muted);
  font-size: 13px;
}
html[data-theme="light"] .app-footer{
  border-top: 1px solid rgba(17,24,39,.08);
}
.app-footer a{
  color: rgba(79,70,229,.95);
  text-decoration:none;
}
.app-footer a:hover{ text-decoration: underline; }

.footer-links{
  display:flex;
  gap: 10px;
  align-items:center;
}

/* ---------- Responsive header ---------- */
@media (max-width: 640px){
  .app-header{
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }
  .brand{
    width:100%;
    flex-direction: column;
    align-items:center;
    gap:10px;
  }
  .brand-kicker{ display:none; }
  .header-actions{
    width:100%;
    justify-content:center;
  }
  .header-actions > *{
    width:100%;
    justify-content:center;
  }
  .brand-title{
    white-space: normal;
    text-align:center;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}
