/* ============================================================
   Getränke Auslieferung - Industrial Dark Theme
   ============================================================ */

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --surface3: #2e2e2e;
  --border: #333;
  --accent: #f5a623;
  --accent-dark: #c47d0a;
  --accent2: #4ecdc4;
  --danger: #e74c3c;
  --success: #2ecc71;
  --warning: #f39c12;
  --text: #f0f0f0;
  --text2: #aaa;
  --text3: #666;
  --font-display: 'Bebas Neue', 'Impact', sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.5);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ======================== SPLASH ======================== */
.splash-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 12px;
  background: radial-gradient(ellipse at center, #1a1200 0%, #0f0f0f 70%);
}
.splash-icon { font-size: 72px; animation: pulse 1s ease infinite; }
.splash-title {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--accent);
  letter-spacing: 4px;
  text-align: center;
  line-height: 1.1;
}
.splash-sub { color: var(--text3); font-size: 14px; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }

/* ======================== LAYOUT ======================== */
.page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--accent);
  letter-spacing: 2px;
  flex: 1;
}
.topbar-sub { font-size: 11px; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; }
.topbar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.topbar-username { font-size: 13px; font-weight: 600; color: var(--text); }
.topbar-event { font-size: 11px; color: var(--accent2); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* ======================== BOTTOM NAV ======================== */
.bottom-nav {
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav.tabs-3 { grid-template-columns: repeat(3, 1fr); }
.bottom-nav.tabs-4 { grid-template-columns: repeat(4, 1fr); }
.bottom-nav.tabs-5 { grid-template-columns: repeat(5, 1fr); }

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  color: var(--text3);
  font-family: var(--font-body);
  font-size: 10px;
  gap: 4px;
  position: relative;
}
.nav-tab .nav-icon { font-size: 22px; line-height: 1; }
.nav-tab.active { color: var(--accent); }
.nav-tab.active::after {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}
.nav-badge {
  position: absolute;
  top: 6px; right: calc(50% - 16px);
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ======================== FORMS ======================== */
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
}
.form-control::placeholder { color: var(--text3); }
select.form-control { cursor: pointer; }
select.form-control option { background: var(--surface2); }

/* ======================== BUTTONS ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-success {
  background: var(--success);
  color: #000;
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-full { width: 100%; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  -webkit-tap-highlight-color: transparent;
}
.btn-icon:hover { color: var(--text); background: var(--surface3); }
.btn-lg { padding: 16px 24px; font-size: 17px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ======================== CARDS ======================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.card-highlight {
  border-left: 3px solid var(--accent);
}

/* ======================== LOGIN PAGE ======================== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #1a1200 0%, #0f0f0f 60%);
}
.login-logo { font-size: 56px; margin-bottom: 8px; }
.login-title {
  font-family: var(--font-display);
  font-size: 42px;
  color: var(--accent);
  letter-spacing: 3px;
  text-align: center;
  line-height: 1.0;
  margin-bottom: 4px;
}
.login-subtitle {
  color: var(--text3);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 32px;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
}
.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.login-tab {
  padding: 10px;
  text-align: center;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  border: 1px solid var(--border);
  background: none;
  transition: all 0.15s;
}
.login-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(245, 166, 35, 0.08);
}

/* ======================== SCAN PAGE ======================== */
.scan-context-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.scan-context-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent2);
  flex-shrink: 0;
}
.scan-context-text { font-size: 13px; color: var(--text2); line-height: 1.4; }
.scan-context-text strong { color: var(--text); display: block; }

.scan-button-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.scan-big-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.scan-big-btn:active { transform: scale(0.97); border-color: var(--accent); }
.scan-big-btn .icon { font-size: 36px; margin-bottom: 8px; }
.scan-big-btn .label {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 1px;
}
.scan-big-btn .sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

.scan-confirm {
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.scan-confirm-product {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.scan-confirm-detail {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 12px;
}
.scan-confirm-menge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.menge-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menge-input {
  flex: 1;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 2px;
}
.menge-unit { color: var(--text3); font-size: 13px; white-space: nowrap; }

/* ======================== HISTORY LIST ======================== */
.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.history-item.storniert { opacity: 0.4; }
.history-icon { font-size: 28px; flex-shrink: 0; }
.history-body { flex: 1; min-width: 0; }
.history-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }
.history-amount {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  letter-spacing: 1px;
  flex-shrink: 0;
  text-align: right;
}
.history-time { font-size: 11px; color: var(--text3); text-align: right; }

.storno-badge {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}
.pending-badge {
  display: inline-block;
  background: var(--warning);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

/* ======================== SCANNER OVERLAY ======================== */
#scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
}
#scanner-overlay.hidden { display: none; }

.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.8);
  color: white;
  font-weight: 600;
  flex-shrink: 0;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

.scanner-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-frame {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(80vw, 280px);
  height: 160px;
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 24px; height: 24px;
  border-color: var(--accent);
  border-style: solid;
}
.corner.tl { top: 0; left: 0; border-width: 3px 0 0 3px; }
.corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; }
.corner.bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; }
.corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; }

.scan-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: scanline 2s ease-in-out infinite;
}
@keyframes scanline {
  0% { top: 0; }
  50% { top: calc(100% - 2px); }
  100% { top: 0; }
}

.scanner-hint {
  position: absolute;
  bottom: 20%;
  left: 0; right: 0;
  text-align: center;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
}

.scanner-manual {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0,0,0,0.8);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
}
.scanner-manual input {
  flex: 1;
  background: #222;
  border: 1px solid #444;
  border-radius: var(--radius);
  padding: 12px;
  color: white;
  font-size: 16px;
}
.scanner-manual input:focus { outline: none; border-color: var(--accent); }

/* ======================== MODAL ======================== */
#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
}
#modal-overlay.hidden { display: none; }
#modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 8px 20px 32px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 20px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: 16px;
}

/* ======================== ADMIN / STATISTIK ======================== */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--accent);
  letter-spacing: 2px;
}
.stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  background: var(--surface2);
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 10px;
  text-align: left;
  position: sticky;
  top: 0;
  white-space: nowrap;
}
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }

.section-header {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 2px;
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ======================== TOAST ======================== */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 400px;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toast-in 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.info { border-color: var(--accent2); color: var(--accent2); }
.toast.warning { border-color: var(--warning); color: var(--warning); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ======================== MISC ======================== */
.hidden { display: none !important; }
.text-muted { color: var(--text3); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 8px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-col { flex-direction: column; }
.row-gap { display: flex; gap: 8px; }
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .text { font-size: 15px; }
.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface3);
  color: var(--text2);
  border: 1px solid var(--border);
}
.chip.accent { background: rgba(245,166,35,0.15); color: var(--accent); border-color: var(--accent); }
.chip.teal { background: rgba(78,205,196,0.15); color: var(--accent2); border-color: var(--accent2); }
.chip.danger { background: rgba(231,76,60,0.15); color: var(--danger); border-color: var(--danger); }

/* Config tabs */
.config-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.config-tabs::-webkit-scrollbar { display: none; }
.config-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text3);
  background: none;
  transition: all 0.15s;
}
.config-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(245,166,35,0.1);
}
.config-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.config-item-name { flex: 1; font-weight: 500; }
.config-item-sub { font-size: 12px; color: var(--text3); }

/* Lager scan area */
.lager-scan-area {
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 16px;
}
.lager-scan-area:active { background: rgba(245,166,35,0.05); }
.lager-scan-area .icon { font-size: 40px; margin-bottom: 8px; }
.lager-scan-area .text { color: var(--accent); font-weight: 600; }

/* Bestand indicator */
.bestand-bar {
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.bestand-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--success);
  transition: width 0.4s ease;
}
.bestand-fill.warn { background: var(--warning); }
.bestand-fill.danger { background: var(--danger); }

/* Admin notification banner */
.admin-banner {
  background: linear-gradient(135deg, rgba(231,76,60,0.2), rgba(231,76,60,0.1));
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  animation: banner-pulse 2s ease infinite;
}
@keyframes banner-pulse {
  0%,100% { border-color: var(--danger); }
  50% { border-color: rgba(231,76,60,0.3); }
}
