/* ==============================
   Inventory Pulse — Dashboard Styles
   Extends theme.css design tokens
   ============================== */

.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 48px 80px;
}

/* ── Stats Bar ─────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 2px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}

.stat {
  flex: 1;
  background: var(--white);
  padding: 20px 24px;
  text-align: center;
}

.stat--alert { background: #FFF8F5; }
.stat--ok    { background: #F4FBF6; }

.stat__num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 4px;
}

.stat--alert .stat__num { color: #B8562A; }
.stat--ok    .stat__num { color: #2D7A4F; }

.stat__label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}

/* ── Alerts Banner ────────────────────────────── */
.alerts-banner {
  border-radius: 8px;
  background: #FFF0E8;
  border: 1px solid #F5C5A3;
  padding: 14px 20px;
  margin-bottom: 24px;
}

.alerts-banner__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #7A3D1A;
}

.alerts-banner__icon { font-size: 1.1rem; }

/* ── Toolbar ──────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.toolbar__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--fg);
}

.toolbar__count {
  display: inline-block;
  margin-left: 12px;
  font-size: 0.85rem;
  color: var(--fg-muted);
  background: var(--bg-alt);
  padding: 3px 10px;
  border-radius: 100px;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s, background 0.15s;
}

.btn--primary {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}
.btn--primary:hover { background: #A04A23; }

.btn--ghost {
  background: transparent;
  color: var(--fg-muted);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--bg-alt); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--fg-muted);
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--bg-alt); color: var(--fg); }

/* ── Product Table ────────────────────────────── */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.product-table {
  width: 100%;
  border-collapse: collapse;
}

.product-table thead tr {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.product-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  white-space: nowrap;
}

.product-table td {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.product-table tbody tr:last-child td { border-bottom: none; }

.product-row:hover { background: #FDFAF5; }

/* Status color rows */
.product-row--critical td { background: #FFF5F2; }
.product-row--low td       { background: #FFFDF5; }

/* Column widths */
.product-table th:first-child { width: 80px; }
.product-table th:last-child  { width: 90px; text-align: right; }
.product-sku { color: var(--fg-muted); font-size: 0.8rem; letter-spacing: 0.05em; }
.product-qty { font-variant-numeric: tabular-nums; font-weight: 500; }
.product-date { color: var(--fg-muted); font-size: 0.8rem; }

/* ── Status Badges ───────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-badge--ok       { background: #E8F7EE; color: #2D7A4F; }
.status-badge--low     { background: #FFF3E0; color: #B8562A; }
.status-badge--critical { background: #FFE8E0; color: #C0392B; }

/* ── Empty State ─────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* ── Modal ───────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal--open { display: flex; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
}

.modal__panel {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  margin: 24px;
  box-shadow: 0 20px 60px rgba(28, 25, 23, 0.15);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--fg);
}

.modal__close { font-size: 1rem; }

/* ── Form ───────────────────────────────────── */
.product-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--white);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.form-error {
  margin: 0 24px 20px;
  padding: 10px 14px;
  background: #FFF0E8;
  border: 1px solid #F5C5A3;
  border-radius: 6px;
  color: #7A3D1A;
  font-size: 0.85rem;
}

/* ── Toast ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--fg);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: transform 0.25s ease;
  z-index: 300;
  white-space: nowrap;
}

.toast--visible { transform: translateX(-50%) translateY(0); }
.toast--error   { background: #C0392B; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  .dashboard { padding: 24px 20px 60px; }
  .stats-bar { flex-direction: column; }
  .toolbar   { flex-direction: column; align-items: flex-start; gap: 12px; }
  .form-row  { grid-template-columns: 1fr; }
  .product-table th:nth-child(4),
  .product-table td:nth-child(4),
  .product-table th:nth-child(5),
  .product-table td:nth-child(5) { display: none; }
}