/* inventory/static/inventory/css/inventory.css */

/* ------------------------------
   Базовые переменные и сброс
--------------------------------*/
:root {
  --accent: #0078d7;
  --muted: #6c757d;
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #e6e6e6;
  --radius: 8px;
  --font-stack: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font-stack);
  background: var(--bg);
  color: #222;
}

/* ------------------------------
   Контейнер страницы
--------------------------------*/
.app.container {
  max-width: 1100px;
  margin: 24px auto;
  background: var(--card);
  border-radius: 10px;
  padding: 0 18px 28px 18px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}

/* ------------------------------
   Заголовок страницы
--------------------------------*/
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin: 18px 0;
  background: transparent;
  color: #0b3a66;
  border-radius: 6px;
}

.page-header--accent {
  background: var(--accent);
  color: #fff;
}

.page-header input {
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  width: 220px;
}

/* ------------------------------
   Кнопки и панель действий
--------------------------------*/
.buttons {
  margin: 16px 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
}

.btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  background: #f1f3f5;
  color: #222;
  transition: background .12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn:hover {
  background: #e5e7ea;
}

.btn.scan-btn { background: #7b2ff7; color: #fff; }
.btn.scan-btn:hover { background: #6320d0; }
.btn.add-btn { background: #28a745; color: #fff; }
.btn.remove-btn { background: #dc3545; color: #fff; }
.btn.list-btn { background: #0078d7; color: #fff; text-decoration: none; }
.btn.sale-btn { background: #ff8c00; color: #fff; text-decoration: none; }
.btn.sale-btn:hover { background: #e07800; }
.btn.add-to-cart-btn { background: #17a2b8; color: #fff; }
.btn.add-to-cart-btn:hover { background: #138496; }

.manual-btn {
  background: #767677;
  color: #e5e7ea;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  width: auto;
}

.sale-form .btn {
  background: #ffb100;
  color: #000;
}

/* ------------------------------
   Таблица товаров
--------------------------------*/

/* Только inventory-table имеет overflow: hidden */
.inventory-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

/* Глобальные таблицы — без overflow */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
}

.inventory-table thead tr,
table thead tr {
  background: #f1f3f5;
}

.inventory-table th,
.inventory-table td,
table th,
table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.inventory-table td input.new-qty {
  width: 100px;
  padding: 6px;
  border-radius: 4px;
  border: 1px solid #ccc;
  text-align: center;
}

/* ------------------------------
   Футер
--------------------------------*/
.footer {
  display: flex;
  justify-content: flex-end;
  padding: 20px 0;
  gap: 10px;
}

/* ------------------------------
   Выделение строки
--------------------------------*/
.selectable-row:hover {
  background-color: #ffe4b3;
  cursor: pointer;
}

.selected-row {
  background-color: #ff9800 !important;
  color: #000 !important;
}

.selectable-row.htmx-request {
  background-color: #ffd28a !important;
}

.qty-updated {
  animation: qtyFlash 0.6s ease;
}

@keyframes qtyFlash {
  0%   { background: #fff3cd; }
  100% { background: transparent; }
}

.hidden-row {
  display: none;
}


/* Зебра */
.inventory-table tbody tr:nth-child(odd) {
  background: #fafafa;
}

.inventory-table tbody tr:nth-child(even) {
  background: #ffffff;
}

/* Наведение */
.inventory-table tbody tr:hover {
  background-color: #e9f3ff;
}

/* Выделенная строка */
.selected-row {
  background-color: #ffe0a3 !important;
  color: #000 !important;
  font-weight: 600;
}

/* Выравнивание чисел */
.inventory-table td:nth-child(7),
.inventory-table td:nth-child(8),
.inventory-table td:nth-child(9) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Узкие числовые колонки */
.inventory-table th:nth-child(7),
.inventory-table th:nth-child(8),
.inventory-table th:nth-child(9),
.inventory-table td:nth-child(7),
.inventory-table td:nth-child(8),
.inventory-table td:nth-child(9) {
  width: 90px;
}

/* Курсор */
.inventory-table tbody tr {
  cursor: pointer;
}





/* ------------------------------
   АДАПТИВ — телефон
--------------------------------*/
@media (max-width: 768px) {

  /* Контейнер */
  .app.container {
    margin: 8px;
    padding: 0 10px 20px;
  }

  /* Шапка страницы */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .page-header input {
    width: 100%;
  }

  /* Кнопки */
  .buttons {
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 8px;
  }

  .btn {
    font-size: 12px;
    padding: 7px 10px;
    min-height: 36px;
  }

  .btn-text {
    display: none;
  }

  /* Таблицы — скролл по горизонтали */
  .inventory-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Уменьшаем паддинги в ячейках */
  .inventory-table th,
  .inventory-table td,
  table th,
  table td {
    padding: 8px 10px;
    font-size: 13px;
  }

  /* Футер */
  .footer {
    justify-content: center;
    flex-wrap: wrap;
  }
}