﻿/*
 * Purpose: Page-specific styles for lagerbestand, including layout, components, states, and responsive behavior.
 * Keep page-only rules here; shared primitives belong in app.css.
 */
/* INVENTORY PAGE - Liquid Glass */

.inventory { animation: fade-in-up 0.40s ease both; }

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.inventory-header-text { min-width: 0; }

.inventory-eyebrow {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--text-tertiary);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.inventory-header h1 { font-size: 28px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.02em; }
.inventory-header p { color: var(--text-secondary); font-size: 13px; }

.inventory-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.inventory-header-actions .history-btn,
.inventory-header-actions .manage-products-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  min-height: 40px;
  border-radius: var(--r-md);
  background: var(--glass-8);
  border: 1px solid var(--border-glass-mid);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: none;
  margin: 0;
  transition:
    background var(--t-fast) var(--ease-snappy),
    color var(--t-fast) var(--ease-snappy),
    border-color var(--t-fast) var(--ease-snappy);
}

.inventory-header-actions .history-btn:hover,
.inventory-header-actions .manage-products-btn:hover {
  background: var(--glass-12);
  color: var(--text);
}

.inventory-header-actions .history-btn:focus-visible,
.inventory-header-actions .manage-products-btn:focus-visible {
  outline: none;
  border-color: var(--border-primary);
  box-shadow: 0 0 0 3px rgba(255, 51, 71, 0.15);
}

/* Products grid */

#inventory-grid,
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
  max-height: 580px;
  overflow-y: scroll;
  scrollbar-width: none;
}

/* Empty state: no products loaded (e.g. initial fetch failed). */
#inventory-grid:empty::after {
  content: "Keine Lagerartikel vorhanden.";
  grid-column: 1 / -1;
  display: block;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 600;
}

.product-card {
  background: var(--glass-8);
  border: 1px solid var(--border-glass-mid);
  border-radius: var(--r-xl);
  padding: 22px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: var(--blur-md);
  backdrop-filter: var(--blur-md);
  position: relative;
  overflow: hidden;
  transition:
    transform var(--t-base) var(--ease-spring),
    box-shadow var(--t-base) var(--ease-snappy),
    border-color var(--t-base) var(--ease-snappy);
  animation: fade-in-up 0.40s ease both;
}

.product-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.20), transparent);
}

.product-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-primary);
  box-shadow: var(--shadow-card-hover);
}

.product-card.danger {
  border-color: rgba(255,69,58,0.40);
  box-shadow: 0 0 0 1px rgba(255,69,58,0.20), var(--shadow-card);
}

.product-card.danger .stock-number { color: var(--danger); }

.product-card.warning {
  border-color: rgba(255,214,10,0.40);
  box-shadow: 0 0 0 1px rgba(255,214,10,0.20), var(--shadow-card);
}

.product-card.warning .stock-number { color: var(--warning); }

.product-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: var(--glass-8);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin-bottom: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.product-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
}

.product-card h3 { font-size: 14px; font-weight: 700; }

.stock-number {
  font-size: 32px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.stock-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }

.custom-product-label,
.auto-reorder-label {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.custom-product-label { background: var(--info-glass); color: var(--info); border: 1px solid rgba(10,132,255,0.22); }
.auto-reorder-label { background: var(--success-glass); color: var(--success); border: 1px solid rgba(48,209,88,0.22); }

.quick-out-btn {
  padding: 9px 14px;
  min-height: 40px;
  border-radius: var(--r-sm);
  background: var(--primary-glass);
  color: var(--primary);
  border: 1px solid rgba(255,51,71,0.25);
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.quick-out-btn:hover { background: var(--primary); color: #fff; }

.quick-out-btn:focus-visible {
  outline: none;
  border-color: var(--border-primary);
  box-shadow: 0 0 0 3px rgba(255, 51, 71, 0.20);
}

.product-card-actions { display: flex; align-items: center; gap: 8px; width: 100%; }
.product-card-actions .quick-out-btn { flex: 1; }
.icon-btn.quick-correct-btn:hover,
.icon-btn.correct-stock-btn:hover {
  background: var(--info-glass);
  border-color: rgba(10,132,255,0.25);
  color: var(--info);
}

/* Deliveries & bookings */

.delivery-list,
.booking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.delivery-item,
.booking-item {
  display: grid;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--glass-4);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-lg);
  transition:
    background var(--t-base) var(--ease-snappy),
    border-color var(--t-base) var(--ease-snappy);
}

.delivery-item:hover,
.booking-item:hover { background: var(--glass-8); }

/* Empty states: lists render blank innerHTML when nothing matches. */
#delivery-list:empty::after,
#ordered-list:empty::after {
  content: "Keine Eintr\00e4ge vorhanden.";
  display: block;
  padding: 20px 4px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 600;
}

.delivery-icon,
.booking-icon {
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--glass-8);
  border: 1px solid var(--border-glass);
  font-size: 22px;
  overflow: hidden;
  flex-shrink: 0;
}

.delivery-icon img,
.booking-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.delivery-info h3,
.booking-info h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.delivery-info p,
.booking-info p { color: var(--text-secondary); font-size: 13px; }
.delivery-info span,
.booking-info span { display: block; color: var(--text-secondary); font-size: 12px; margin-top: 2px; }

.deliver-stock-btn {
  padding: 10px 14px;
  min-height: 40px;
  border-radius: var(--r-sm);
  background: var(--success-glass);
  color: var(--success);
  border: 1px solid rgba(48,209,88,0.25);
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
  white-space: nowrap;
}

.deliver-stock-btn:hover { background: var(--success); color: #fff; }

.deliver-stock-btn:focus-visible {
  outline: none;
  border-color: rgba(48,209,88,0.5);
  box-shadow: 0 0 0 3px rgba(48,209,88,0.20);
}

.delivery-status {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.ordered-status { background: var(--info-glass); color: var(--info); border: 1px solid rgba(10,132,255,0.22); }

.booking-badge {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.booking-badge.in { background: var(--success-glass); color: var(--success); border: 1px solid rgba(48,209,88,0.22); }
.booking-badge.out { background: var(--danger-glass); color: var(--danger); border: 1px solid rgba(255,69,58,0.22); }
.booking-badge.korrektur { background: var(--info-glass); color: var(--info); border: 1px solid rgba(10,132,255,0.22); }

/* Static product management */

.static-product-list { display: flex; flex-direction: column; gap: 10px; }

.static-product-item {
  display: grid;
  grid-template-columns: 80px 1fr 80px auto auto;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--glass-4);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-lg);
}

.static-product-item input { padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px; }

.auto-reorder-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.auto-reorder-switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.auto-reorder-min {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.auto-reorder-min input { width: 70px; }

.static-product-actions { display: flex; gap: 6px; }

.save-static-product-btn {
  padding: 8px 12px;
  min-height: 36px;
  border-radius: var(--r-sm);
  background: var(--primary-glass);
  color: var(--primary);
  border: 1px solid rgba(255,51,71,0.25);
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.delete-static-product-btn:not(.icon-btn) {
  padding: 8px 12px;
  min-height: 36px;
  border-radius: var(--r-sm);
  background: var(--danger-glass);
  color: var(--danger);
  border: 1px solid rgba(255,69,58,0.25);
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.save-static-product-btn:hover { background: var(--primary); color: #fff; }
.delete-static-product-btn:not(.icon-btn):hover { background: var(--danger); color: #fff; }

.save-static-product-btn:focus-visible,
.delete-static-product-btn:not(.icon-btn):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 51, 71, 0.20);
}

.static-product-actions .icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 69, 58, 0.20);
}

/* Empty state: all products removed from the manager list. */
#static-products-list:empty::after {
  content: "Keine statischen Artikel vorhanden.";
  display: block;
  padding: 20px 4px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 600;
}

/* -- Order Tab System ------------------------------ */

.order-tabs-wrapper {
  margin-top: 28px;
  margin-bottom: 28px;
  background: var(--glass-8);
  border: 1px solid var(--border-glass-mid);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: var(--blur-md);
  backdrop-filter: var(--blur-md);
  overflow: hidden;
  position: relative;
}

.order-tabs-wrapper::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  pointer-events: none;
}

.order-tab-nav {
  display: flex;
  gap: 2px;
  padding: 14px 16px 0;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(0,0,0,.06);
  overflow-x: auto;
  scrollbar-width: none;
}

.order-tab-nav::-webkit-scrollbar { display: none; }

.order-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px 10px;
  border-radius: 10px 10px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition:
    background var(--t-fast) var(--ease-snappy),
    color var(--t-fast) var(--ease-snappy);
  position: relative;
  bottom: -1px;
}

.order-tab:hover {
  background: rgba(255,255,255,.05);
  color: var(--text);
}

.order-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 51, 71, 0.20);
}

.order-tab.is-active {
  background: var(--glass-8);
  border-color: var(--border-glass-mid);
  border-bottom-color: var(--glass-8);
  color: var(--primary);
}

.order-tab-body {
  padding: 24px;
}

.order-tab-panel[hidden] { display: none; }

.order-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.order-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.order-form input,
.order-form select,
.order-form textarea {
  padding: 12px 14px;
  border: 1px solid var(--border-glass-mid);
  border-radius: var(--r-sm);
  background: var(--glass-8);
  color: var(--text);
  font: inherit;
}

.order-form input:focus,
.order-form select:focus,
.order-form textarea:focus {
  border-color: var(--border-primary);
  background: var(--glass-12);
  box-shadow: 0 0 0 3px rgba(255,51,71,0.15);
}

.order-form button[type="submit"] {
  padding: 13px;
  border-radius: var(--r-md);
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--primary-glow);
  margin-top: 4px;
}

.order-form button[type="submit"]:focus-visible {
  outline: none;
  box-shadow: var(--primary-glow-strong), 0 0 0 3px rgba(255, 51, 71, 0.25);
}

.order-form textarea { min-height: 80px; }

.correction-current {
  font-size: 13px;
  color: var(--text-secondary);
  margin: -4px 0 0;
}

.correction-current strong { color: var(--text); }

.correction-diff {
  font-size: 13px;
  font-weight: 700;
  margin: -4px 0 0;
  min-height: 1.4em;
}

.correction-diff.is-up { color: var(--success); }
.correction-diff.is-down { color: var(--danger); }

/* -- Delivery Grid --------------------------------- */

.delivery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 0;
}

.delivery-panel {
  background: var(--glass-8);
  padding: 24px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: var(--blur-md);
  backdrop-filter: var(--blur-md);
  border: 1px solid var(--border-glass-mid);
  position: relative;
  overflow: hidden;
}

.delivery-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  pointer-events: none;
}

.delivery-panel h2 { font-size: 15px; font-weight: 900; margin-bottom: 16px; }

.delivery-actions { display: flex; gap: 8px; align-items: center; }

/* Booking history list (inside modal) */

.booking-history-list { display: flex; flex-direction: column; gap: 10px; }

.history-range-filter {
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--glass-8);
  border: 1px solid var(--border-glass);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* Consumption analysis (inside history modal) */

.consumption-analysis {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--glass-8);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-lg);
}

.consumption-analysis:empty { display: none; }

.consumption-analysis-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.consumption-row { display: flex; flex-direction: column; gap: 4px; }

.consumption-row-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.consumption-row-amount { color: var(--text-secondary); font-weight: 700; }

.consumption-bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--glass-12);
  overflow: hidden;
}

.consumption-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gradient-brand);
}

.consumption-analysis-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.trend-chart-wrap {
  display: flex;
  gap: 8px;
}

.trend-chart-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 90px;
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: right;
}

.trend-chart {
  position: relative;
  height: 90px;
  flex: 1;
  display: flex;
}

.trend-bar {
  position: absolute;
  bottom: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  padding: 0 2px;
}

.trend-bar-fill {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--gradient-brand);
}

.trend-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Product manager modal variants */

.products-manager-content,
.history-modal-content { max-width: 90vw; }

.product-manager-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--glass-4);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-lg);
}

.product-manager-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.product-manager-form input {
  padding: 11px 13px;
  border: 1px solid var(--border-glass-mid);
  border-radius: var(--r-sm);
  background: var(--glass-8);
  color: var(--text);
  font: inherit;
}

.static-products-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

/* Responsive overrides for this breakpoint. */
@media (max-width: 860px) {
  .delivery-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  #inventory-grid {
    max-height: none;
    overflow: visible;
    gap: 12px;
  }
  .product-card {
    padding: 16px 12px;
    border-radius: var(--r-md);
    box-shadow: none;
    backdrop-filter: none;
  }
  .product-card:hover { transform: none; }
  .product-icon { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; }
  .product-card-actions { margin-top: auto; }
  .stock-number { font-variant-numeric: tabular-nums; }
}

@media (max-width: 700px) {
  .inventory { padding: 22px; }
  .inventory-header { flex-direction: column; align-items: flex-start; }
  .inventory-header-actions { width: 100%; flex-wrap: wrap; }
  #inventory-grid,
  .inventory-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .delivery-item, .booking-item, .static-product-item { grid-template-columns: 1fr; }
  .order-tab-nav { padding: 10px 10px 0; }
  .order-tab { padding: 8px 12px 9px; font-size: 12px; }
  .order-tab-body { padding: 16px; }
}
