/* ==========================================================================
   FRIDGEPLANER — HAUSSTIL STYLESHEET (Stand 22.09.2026 / ResC Palette)
   Tokens:
   - Papier: #F1F0EA
   - Dunkelblaugrau / Tinte: #2D2E43
   - Primärrot: #E30613
   - Signalgelb: #FFEE00
   - Instrument Grün: #0F6E5A
   - Hilfsfläche: #F5F6F8
   - Linie: #C9CBD3
   - Radius: 0-3px (Strikte Obergrenze)
   - Schatten: Harte versetzte Schatten 2px 2px 0 #2D2E43
   ========================================================================== */

:root {
  --color-paper: #F1F0EA;
  --color-ink: #1C1B18;
  --color-dark: #2D2E43;
  --color-red: #E30613;
  --color-yellow: #FFEE00;
  --color-green: #0F6E5A;
  --color-surface: #F5F6F8;
  --color-line: #C9CBD3;
  --color-subtext: #55576B;

  --font-display: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius: 2px;
  --shadow-hard: 2px 2px 0 var(--color-dark);
  --shadow-line: 0 2px 0 var(--color-line);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--color-paper);
  color: var(--color-dark);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 70px;
}

/* --- Typografie & Hilfsklassen --- */
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* --- Kopfbereich (Header) --- */
.app-header {
  background-color: var(--color-dark);
  color: #FFFFFF;
  padding: 12px 16px;
  border-bottom: 2px solid var(--color-ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #FFFFFF;
  letter-spacing: 0.05em;
}

.brand-tag {
  color: var(--color-yellow);
  font-size: 0.65rem;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius);
}

.system-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: #FFFFFF;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #27AE60;
  border-radius: 50%;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Hauptumschalter: Wareneingang vs. Warenausgang --- */
.mode-switch-container {
  background-color: var(--color-surface);
  border-bottom: 2px solid var(--color-dark);
  padding: 10px 14px;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-btn {
  background: #FFFFFF;
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  padding: 12px 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--color-dark);
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  transition: transform 0.05s ease, background-color 0.1s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.mode-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.mode-btn .subtext {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  opacity: 0.8;
}

/* Aktiver Wareneingang: Signalgelb mit dunkler Schrift */
.mode-btn.active-in {
  background-color: var(--color-yellow);
  color: var(--color-dark);
  border-color: var(--color-dark);
}

/* Aktiver Warenausgang: Primärrot mit weißer Schrift */
.mode-btn.active-out {
  background-color: var(--color-red);
  color: #FFFFFF;
  border-color: var(--color-dark);
}

/* --- Hauptinhalte / Tabs --- */
.tab-content {
  display: none;
  padding: 14px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.tab-content.active {
  display: block;
}

/* --- Scanner Tab & Kamera-Viewfinder --- */
.camera-card {
  background: var(--color-dark);
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-hard);
  position: relative;
  display: flex;
  flex-direction: column;
}

.camera-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: #000000;
  overflow: hidden;
}

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

/* Visueller Fadenkreuz-Sucher */
.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.scan-reticle {
  width: 70%;
  height: 55%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  position: relative;
  transition: border-color 0.15s ease;
}

.scan-reticle.flash-success {
  border-color: var(--color-yellow);
  box-shadow: 0 0 15px var(--color-yellow);
}

.scan-reticle.flash-out {
  border-color: var(--color-red);
  box-shadow: 0 0 15px var(--color-red);
}

/* Eck-Markierungen für industriellen Look */
.scan-reticle::before,
.scan-reticle::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--color-yellow);
  border-style: solid;
}

.scan-reticle::before {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
}

.scan-reticle::after {
  bottom: -2px;
  right: -2px;
  border-width: 0 3px 3px 0;
}

.scan-laser {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-red);
  box-shadow: 0 0 8px var(--color-red);
  opacity: 0.85;
  animation: scanMove 2.2s infinite ease-in-out;
}

@keyframes scanMove {
  0% { top: 15%; opacity: 0.4; }
  50% { top: 85%; opacity: 0.95; }
  100% { top: 15%; opacity: 0.4; }
}

.camera-controls {
  background-color: var(--color-surface);
  border-top: 2px solid var(--color-dark);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Schnelltipp Frische-Scan Button */
.btn-produce-scan {
  background-color: #FFFFFF;
  color: var(--color-dark);
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  padding: 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.05s ease, background-color 0.15s ease;
}

.btn-produce-scan:hover {
  background-color: var(--color-yellow);
}

.btn-produce-scan:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* Manueller Barcode-Input */
.manual-input-row {
  display: flex;
  gap: 6px;
}

.input-field {
  flex: 1;
  background: #FFFFFF;
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-dark);
}

.input-field:focus {
  outline: 2px solid var(--color-yellow);
  outline-offset: 1px;
}

.btn-solid {
  background-color: var(--color-dark);
  color: #FFFFFF;
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
}

.btn-solid:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* --- Ticker / Undo Bar --- */
.scan-ticker {
  margin-top: 14px;
  background-color: #FFFFFF;
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticker-text {
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
}

.ticker-product {
  font-weight: 700;
  color: var(--color-dark);
}

.ticker-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-subtext);
}

.btn-undo {
  background-color: var(--color-surface);
  border: 1px solid var(--color-dark);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-undo:hover {
  background-color: var(--color-yellow);
}

/* --- Inventar Tab --- */
.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.inventory-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-card {
  background-color: #FFFFFF;
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 65%;
}

.item-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.item-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-subtext);
  letter-spacing: 0.05em;
}

.item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-bubble {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.1rem;
  min-width: 32px;
  text-align: center;
  background-color: var(--color-surface);
  border: 1px solid var(--color-dark);
  padding: 4px 6px;
  border-radius: var(--radius);
}

.btn-qty {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-surface);
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 1px 1px 0 var(--color-dark);
}

.btn-qty:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

/* --- Einkaufsliste Tab --- */
.shopping-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.shopping-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shopping-item {
  background-color: #FFFFFF;
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.shopping-item.checked {
  background-color: var(--color-surface);
  opacity: 0.6;
  text-decoration: line-through;
}

.shopping-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-dark);
  margin-right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9rem;
}

.shopping-item.checked .shopping-checkbox::after {
  content: '✓';
  color: var(--color-dark);
}

.btn-book-checked {
  background-color: var(--color-green);
  color: #FFFFFF;
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  padding: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  text-align: center;
}

.btn-book-checked:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* --- Rezepte Tab --- */
.recipes-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.recipe-card {
  background-color: #FFFFFF;
  border: 2px solid var(--color-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 14px;
}

.recipe-badge {
  display: inline-block;
  background-color: var(--color-yellow);
  color: var(--color-dark);
  border: 1px solid var(--color-dark);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.recipe-title {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.recipe-ingredients {
  margin: 8px 0;
  font-size: 0.85rem;
}

.recipe-instructions {
  font-size: 0.88rem;
  color: var(--color-dark);
  background-color: var(--color-surface);
  padding: 8px 10px;
  border-left: 3px solid var(--color-dark);
  margin-top: 8px;
}

/* --- Bottom Navigation Bar --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--color-dark);
  border-top: 2px solid var(--color-ink);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 100;
}

.nav-item {
  background: none;
  border: none;
  color: #FFFFFF;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  font-weight: 600;
  cursor: pointer;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
}

.nav-item:last-child {
  border-right: none;
}

.nav-item.active {
  background-color: var(--color-yellow);
  color: var(--color-dark);
}

.nav-item .icon {
  font-size: 1.1rem;
}

/* Feedback Banner */
.toast-msg {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-dark);
  color: #FFFFFF;
  padding: 10px 16px;
  border: 2px solid var(--color-yellow);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  z-index: 200;
  box-shadow: var(--shadow-hard);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast-msg.show {
  opacity: 1;
}
