@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --gold:    #ffd166;
  --gold2:   #f4b942;
  --dark:    #0d0d12;
  --dark2:   #13131c;
  --dark3:   #1c1c28;
  --border:  #252535;
  --border2: #353550;
  --text:    #e8e8f0;
  --text2:   #9898b8;
  --text3:   #555570;
  --success: #22c55e;
  --danger:  #ef4444;
  --warn:    #f59e0b;
  --info:    #3b82f6;
  --teal:    #06d6a0;
  --pink:    #f472b6;
  --orange:  #f97316;
  --r:       8px;
  --r2:      12px;
  --r3:      16px;
  --shadow:  0 4px 24px rgba(0,0,0,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; background: var(--dark); color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--dark); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ════════ LAYOUT ════════ */
#app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 240px; background: var(--dark2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  transition: transform .25s ease; z-index: 200;
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.sidebar-logo { font-size: 24px; }
.sidebar-title { font-weight: 700; color: var(--gold); flex: 1; }
.sidebar-close { display: none; background: none; border: none; color: var(--text3); font-size: 18px; cursor: pointer; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,209,102,.15); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 11px; margin-top: 2px; font-weight: 600; border-radius: 5px; display: inline-block; padding: 1px 6px; }
.role-admin     { background: rgba(255,209,102,.15); color: var(--gold); }
.role-kasse     { background: rgba(59,130,246,.15);  color: var(--info); }
.role-stand     { background: rgba(34,197,94,.15);   color: var(--success); }
.role-bedienung { background: rgba(244,114,182,.15); color: var(--pink); }
.role-kueche    { background: rgba(249,115,22,.15);  color: var(--orange); }

.nav-links { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 14px; font-weight: 500;
  color: var(--text2); cursor: pointer; transition: all .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--dark3); color: var(--text); }
.nav-item.active { background: rgba(255,209,102,.08); color: var(--gold); border-left-color: var(--gold); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }

.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 190; }

.main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 56px; background: var(--dark2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px; flex-shrink: 0;
}
.menu-btn { display: none; background: none; border: none; color: var(--text2); font-size: 22px; cursor: pointer; padding: 4px; }
.topbar-title { font-weight: 700; font-size: 16px; flex: 1; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ════════ COMPONENTS ════════ */

/* Cards */
.card {
  background: var(--dark2); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 18px; margin-bottom: 14px;
}
.card-accent-gold  { border-color: rgba(255,209,102,.3); }
.card-accent-green { border-color: rgba(34,197,94,.3); }
.card-accent-red   { border-color: rgba(239,68,68,.3); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s; white-space: nowrap; font-family: inherit;
}
.btn-primary  { background: var(--gold); color: var(--dark); }
.btn-primary:hover { background: var(--gold2); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-ghost    { background: var(--dark3); border: 1px solid var(--border2); color: var(--text2); }
.btn-ghost:hover { color: var(--text); border-color: var(--text3); }
.btn-sm  { padding: 5px 11px; font-size: 13px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Inputs */
.field-group { margin-bottom: 14px; }
.field-group label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; font-weight: 600; }
.input, input[type=text], input[type=password], input[type=number], input[type=email], input[type=url], input[type=date], select, textarea {
  width: 100%; background: var(--dark); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 9px 13px; color: var(--text);
  font-size: 14px; font-family: inherit; outline: none; transition: border-color .15s;
}
.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--gold); }
select option { background: var(--dark2); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 8px 12px; text-align: left; color: var(--text3); font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* Section title */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.section-title h2 { font-size: 20px; font-weight: 700; }
.section-title .actions { display: flex; gap: 8px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 14px; }

/* KPI Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 12px; margin-bottom: 24px; }
.kpi-card { background: var(--dark2); border: 1px solid var(--border); border-radius: var(--r2); padding: 16px; text-align: center; }
.kpi-icon { font-size: 22px; margin-bottom: 6px; }
.kpi-val  { font-size: 22px; font-weight: 800; }
.kpi-lbl  { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* Article tiles */
.art-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(var(--tile-size,150px),1fr)); gap: 8px; }
.art-tile {
  background: var(--dark3); border: 2px solid var(--border2);
  border-radius: var(--r2); padding: 10px; cursor: pointer;
  transition: all .1s; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.art-tile:hover { border-color: var(--border); background: var(--dark2); }
.art-tile.in-cart { background: rgba(255,209,102,.08); border-color: var(--gold); }
.art-tile.out-of-stock { opacity: .5; cursor: not-allowed; }
.art-tile img { width: 100%; border-radius: 6px; object-fit: cover; }
.art-tile .art-name { font-weight: 700; font-size: 13px; line-height: 1.2; }
.art-tile .art-price { color: var(--gold); font-weight: 700; font-size: 12px; }
.art-tile .art-stock { font-size: 11px; color: var(--text3); }
.art-tile .art-stock.low { color: var(--warn); }
.art-tile .art-stock.out { color: var(--danger); }

/* Cart */
.cart { background: var(--dark); border-radius: var(--r); padding: 12px; margin: 10px 0; border: 1px solid var(--border); }
.cart-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.cart-row:last-child { border-bottom: none; font-weight: 700; }
.qty-ctrl { display: flex; align-items: center; gap: 5px; }
.qty-btn { background: var(--dark3); border: 1px solid var(--border2); color: var(--text); border-radius: 5px; width: 24px; height: 24px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }

/* Deposit toggle */
.deposit-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; }
.toggle { position: relative; width: 34px; height: 19px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border2);
  border-radius: 10px; cursor: pointer; transition: .2s;
}
.toggle-slider:before {
  content: ''; position: absolute; width: 14px; height: 14px;
  left: 2.5px; top: 2.5px; background: #fff; border-radius: 50%; transition: .2s;
}
.toggle input:checked + .toggle-slider { background: var(--teal); }
.toggle input:checked + .toggle-slider:before { transform: translateX(15px); }

/* Seat grid */
.seat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.seat-btn {
  padding: 8px 14px; border-radius: var(--r); font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--dark3); color: var(--text2); cursor: pointer; transition: all .1s;
}
.seat-btn:hover { border-color: var(--border2); color: var(--text); }
.seat-btn.sel  { background: rgba(255,209,102,.15); border-color: var(--gold); color: var(--gold); }
.seat-btn.used { border-color: var(--info); color: var(--info); }

/* Kitchen cards */
.k-card { background: var(--dark2); border-radius: var(--r2); margin-bottom: 12px; overflow: hidden; border: 1px solid var(--border); }
.k-card-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; }
.k-card-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; border-top: 1px solid var(--border); background: var(--dark); }
.k-qty { font-size: 20px; font-weight: 900; color: var(--gold); width: 32px; text-align: center; }
.wait-green { color: var(--success); }
.wait-warn  { color: var(--warn); }
.wait-red   { color: var(--danger); }

/* Sitzplan canvas */
.seating-canvas {
  background: radial-gradient(circle, #252535 1px, transparent 1px);
  background-size: 28px 28px;
  background-color: var(--dark);
  width: 1000px; height: 650px; position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r2);
}
.s-table {
  position: absolute; background: var(--dark3); border: 2px solid var(--border2);
  border-radius: var(--r2); min-width: 80px; min-height: 36px;
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.s-table.selected { border-color: var(--gold); background: rgba(255,209,102,.05); }
.s-table-head { display: flex; align-items: center; justify-content: center; padding: 4px 10px; cursor: grab; font-size: 13px; font-weight: 700; }
.s-table-head:active { cursor: grabbing; }
.s-resize { position: absolute; bottom: 0; right: 0; width: 14px; height: 14px; cursor: nwse-resize; color: var(--border2); font-size: 11px; display: flex; align-items: flex-end; justify-content: flex-end; line-height: 1; }
.s-seat {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--border2); background: var(--dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; cursor: grab; transition: box-shadow .1s;
  transform: translate(-50%,-50%);
}
.s-seat.selected { border-color: var(--gold); background: var(--gold); color: var(--dark); box-shadow: 0 0 12px rgba(255,209,102,.5); }

/* Bar chart */
.bar-row { margin-bottom: 10px; }
.bar-track { height: 5px; background: var(--border); border-radius: 99px; }
.bar-fill  { height: 100%; border-radius: 99px; transition: width .5s; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: var(--r2); font-weight: 600; font-size: 14px;
  color: #fff; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 9999;
  white-space: nowrap; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; }
.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
.modal {
  background: var(--dark2); border: 1px solid var(--border); border-radius: var(--r3);
  padding: 24px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--dark2); border: 1px solid var(--border); border-radius: var(--r3); padding: 36px; }
.login-logo { font-size: 56px; text-align: center; }
.login-title { font-size: 28px; font-weight: 800; color: var(--gold); text-align: center; margin: 10px 0 4px; }
.login-sub { color: var(--text2); text-align: center; margin-bottom: 24px; }
.login-version { color: var(--text3); font-size: 12px; text-align: center; margin-top: 20px; }

/* Misc */
.error-box { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; border-radius: var(--r); padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; }
.loading-spin { display: flex; align-items: center; justify-content: center; padding: 60px; }
@keyframes spin { to { transform: rotate(360deg); } }
.hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-gold   { color: var(--gold); }
.text-muted  { color: var(--text2); }
.text-small  { font-size: 12px; }
.fw-bold     { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.scroll-x { overflow-x: auto; }
.w-100 { width: 100%; }

/* ════════ RESPONSIVE ════════ */
@media (max-width: 768px) {
  /* ── Sidebar ── */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%); width: 280px;
    z-index: 200;
  }
  .sidebar.open { transform: none; box-shadow: 4px 0 24px rgba(0,0,0,.6); }
  .overlay.show { display: block; }
  .menu-btn { display: block; }
  .sidebar-close { display: block; }

  /* ── Layout ── */
  .main-wrap { width: 100%; }
  .content { padding: 12px; }
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 14px; }

  /* ── Grids ── */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .kpi-card { padding: 12px; }
  .kpi-val { font-size: 18px; }

  /* ── Cards ── */
  .card { padding: 14px; }
  .section-title { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-title .actions { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .section-title .actions .btn { flex: 1; min-width: 120px; justify-content: center; }

  /* ── Buttons ── */
  .btn { font-size: 13px; padding: 8px 12px; }
  .btn-sm { font-size: 12px; padding: 5px 10px; }

  /* ── Tables ── */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 12px; min-width: 500px; }
  th, td { padding: 7px 8px; }

  /* ── Modal ── */
  .modal { padding: 16px; margin: 8px; max-height: 95vh; }
  .modal-title { font-size: 16px; }

  /* ── Orders ── */
  .art-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important; }

  /* ── Sitzplan ── */
  .seating-canvas { width: 100%; min-width: 600px; overflow-x: auto; }

  /* ── Festival indicator ── */
  #festival-indicator { display: none; }

  /* ── Topbar actions ── */
  .topbar-actions { display: none; }

  /* ── Kitchen ── */
  .k-card-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .k-card-head .btn { width: 100%; justify-content: center; }

  /* ── Landing Page ── */
  .hero-section { padding: 40px 16px 32px; }
  .hero-section h1 { font-size: 28px; }
  .hero-header { padding: 12px 16px; }
  .hero-logo { font-size: 15px; }
  .features-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 12px; }
  .feature-card { padding: 14px; }
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-section { padding: 0 12px; }
  .auth-card { padding: 20px; margin: 8px; }

  /* ── Sidebar user info ── */
  .sidebar-user { padding: 10px 14px; }
  .user-name { font-size: 13px; }

  /* ── Nav ── */
  .nav-item { padding: 12px 16px; font-size: 15px; }
  .nav-icon { font-size: 18px; width: 24px; }
}

/* Sehr kleine Bildschirme (< 380px) */
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .features-grid { grid-template-columns: 1fr; }
  .hero-section h1 { font-size: 24px; }
  .content { padding: 8px; }
}

/* ════════ PUBLIC / LANDING PAGE ════════ */
.public-wrap { min-height: 100vh; background: var(--dark); }

.hero-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; background: var(--dark2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.hero-logo { font-size: 18px; font-weight: 800; color: var(--gold); }

.hero-section {
  text-align: center; padding: 80px 32px 60px;
  max-width: 700px; margin: 0 auto;
}
.hero-section h1 {
  font-size: clamp(28px, 5vw, 52px); font-weight: 900; line-height: 1.1;
  margin-bottom: 20px; color: var(--text);
}
.hero-section p { color: var(--text2); font-size: 17px; margin-bottom: 28px; }

.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 12px; }

.features-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; max-width: 900px; margin: 0 auto 60px; padding: 0 24px;
}
.feature-card {
  background: var(--dark2); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px;
}
.feature-icon { font-size: 28px; margin-bottom: 8px; }
.feature-title { font-weight: 700; margin-bottom: 5px; }
.feature-desc { color: var(--text3); font-size: 13px; line-height: 1.5; }

.pricing-section { max-width: 900px; margin: 0 auto 80px; padding: 0 24px; }
.pricing-section h2 { font-size: 28px; font-weight: 800; margin-bottom: 24px; text-align: center; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.price-card {
  background: var(--dark2); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; position: relative;
}
.price-card-pro { border-color: rgba(255,209,102,.4); background: rgba(255,209,102,.03); }
.price-badge {
  position: absolute; top: -10px; left: 20px;
  background: var(--gold); color: var(--dark);
  padding: 2px 12px; border-radius: 99px; font-size: 11px; font-weight: 700;
}
.price-name { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.price-amount { font-size: 32px; font-weight: 900; color: var(--gold); margin-bottom: 20px; }
.price-amount span { font-size: 15px; color: var(--text2); font-weight: 400; }
.price-features { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; font-size: 14px; }

.auth-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center; z-index: 999; padding: 16px;
}
.auth-card {
  background: var(--dark2); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px; width: 100%; max-width: 420px;
  position: relative; max-height: 90vh; overflow-y: auto;
}
.auth-logo { font-size: 48px; text-align: center; margin-bottom: 10px; }
.auth-card h2 { text-align: center; font-size: 22px; margin-bottom: 20px; }
.auth-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--text3);
  font-size: 18px; cursor: pointer; padding: 4px;
}
.success-box {
  background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3);
  color: #86efac; border-radius: var(--r); padding: 10px 14px; font-size: 13px; margin-bottom: 12px;
}

/* ════════ FOOTER ════════ */
.site-footer {
  background: var(--dark2);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  margin-top: auto;
}
.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text3);
}
.footer-links {
  display: flex;
  gap: 16px;
}
.footer-links a {
  color: var(--text2);
  text-decoration: none;
  font-size: 12px;
  transition: color .15s;
}
.footer-links a:hover { color: var(--gold); }

/* Footer auch in der App (eingeloggt) */
#app .site-footer {
  flex-shrink: 0;
}
