/* ═══════════════════════════════════════════════════════
   МИНИ-КАССА — стили
   ═══════════════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #faf6f0;
  color: #333;
  padding-bottom: 70px;
}

.hidden { display: none !important; }

/* ─── Шапка ─── */
.header {
  background: linear-gradient(135deg, #f5a623, #e8912d);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

[data-mode="wholesale"] .header {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.logo {
  height: 36px;
  margin-right: 10px;
  transition: opacity 0.15s;
}

.header h1 {
  font-size: 18px;
  font-weight: 700;
}

.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }

/* ─── Кнопки режимов ─── */
.mode-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid rgba(255,255,255,0.5);
  background: transparent;
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn.active {
  background: white;
  color: #e8912d;
  border-color: white;
}

[data-mode="wholesale"] .mode-btn.active {
  color: #7c3aed;
}

/* ─── Поиск ─── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: white;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 60px;
  z-index: 99;
}

.search-icon { font-size: 18px; }

.input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus { border-color: #f5a623; }

[data-mode="wholesale"] .input:focus { border-color: #8b5cf6; }

/* ─── Сканер ─── */
.scanner-box {
  position: relative;
  max-width: 400px;
  margin: 0 auto;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.scanner-box video {
  width: 100%;
  display: block;
}

.scanner-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: #e74c3c;
  animation: scanMove 2s ease-in-out infinite;
}

@keyframes scanMove {
  0%, 100% { top: 30%; }
  50% { top: 70%; }
}

/* ─── Контент ─── */
.content {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px;
}

/* ─── Карточки ─── */
.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.card h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #555;
}

/* ─── Сетка групп ─── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px;
  background: #fff9f0;
  border: 1px solid #f0e6d6;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s;
  color: #333;
}

.tile:hover {
  background: #fff3e0;
  border-color: #f5a623;
  transform: translateY(-1px);
}

[data-mode="wholesale"] .tile {
  background: #f5f0ff;
  border-color: #e0d4f5;
}

[data-mode="wholesale"] .tile:hover {
  background: #ede5ff;
  border-color: #8b5cf6;
}

.tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f5a623;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

[data-mode="wholesale"] .tile-icon {
  background: #8b5cf6;
}

/* ─── Список товаров ─── */
.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.item:last-child { border-bottom: none; }

.item-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.muted {
  color: #888;
  font-size: 13px;
}

/* ─── Остатки ─── */
.stock {
  font-size: 12px;
  margin-top: 2px;
}
.stock.ok { color: #27ae60; }
.stock.mid { color: #f39c12; }
.stock.low { color: #e74c3c; }

/* ─── Кнопки ─── */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: #f5a623;
  color: white;
}

.btn-primary:hover { background: #e8912d; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }

[data-mode="wholesale"] .btn-primary {
  background: #8b5cf6;
}

[data-mode="wholesale"] .btn-primary:hover {
  background: #7c3aed;
}

.btn-ghost {
  background: transparent;
  color: #666;
  border: 1px solid #ddd;
}

.btn-ghost:hover { background: #f5f5f5; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ─── Модалки ─── */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 20px;
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

/* ─── Единицы ─── */
.unit-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid #ddd;
  background: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 6px;
  margin-bottom: 6px;
}

.unit-btn.active {
  border-color: #f5a623;
  background: #fff3e0;
  color: #e8912d;
}

[data-mode="wholesale"] .unit-btn.active {
  border-color: #8b5cf6;
  background: #f5f0ff;
  color: #7c3aed;
}

.qty-input {
  width: 60px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

/* ─── Корзина нижняя панель ─── */
.cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 2px solid #f5a623;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 150;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

[data-mode="wholesale"] .cart-bar {
  border-top-color: #8b5cf6;
}

.cart-bar span {
  font-weight: 600;
  font-size: 15px;
}

/* ─── Корзина модалка ─── */
.cart-list {
  max-height: 50vh;
  overflow-y: auto;
}

.cart-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid #f0f0f0;
  flex-wrap: wrap;
}

.cart-total {
  font-size: 18px;
  font-weight: 700;
  color: #e67e22;
  flex: 1;
}

[data-mode="wholesale"] .cart-total {
  color: #8b5cf6;
}

/* ─── Уведомления ─── */
.notice {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  transition: opacity 0.3s;
  max-width: 90%;
  text-align: center;
}

.notice.ok {
  background: #27ae60;
  color: white;
}

.notice.error {
  background: #e74c3c;
  color: white;
}

.notice.success {
  background: #27ae60;
  color: white;
}

/* ─── Навигация ─── */
.nav-card {
  padding: 12px 16px;
}

/* ─── Адаптив ─── */
@media (max-width: 480px) {
  .header h1 { font-size: 15px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .item .btn { align-self: flex-end; }
  .cart-footer { flex-direction: column; }
}