/* ========================================
   KitchOS Inventory Dashboard Styles
   ======================================== */

:root {
  --bg: #FBF8F3;
  --bg-alt: #F2EDE4;
  --fg: #1A1A1A;
  --fg-muted: #6B6560;
  --accent: #E8922A;
  --accent-dark: #C4771E;
  --accent-light: rgba(232,146,42,0.1);
  --white: #FFFFFF;
  --border: rgba(26,26,26,0.10);
  --danger: #DC2626;
  --danger-light: #FEF2F2;
  --success: #1a6b35;
  --success-light: #F0FDF4;
  --warn: #B45309;
  --warn-light: #FFFBEB;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* --- Layout --- */
.inv-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.inv-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.inv-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}
.inv-brand { display: flex; align-items: baseline; gap: 0.75rem; }
.inv-logo {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.inv-section-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* --- Alert Banner --- */
.inv-alert-banner {
  background: var(--warn-light);
  border-bottom: 1px solid rgba(180,83,9,0.15);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--warn);
}
.inv-alert-banner svg { flex-shrink: 0; }

/* --- Stats --- */
.inv-stats {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.inv-stat-card {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.inv-stat-card--warn { border-color: rgba(180,83,9,0.25); background: var(--warn-light); }
.inv-stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 0.35rem;
}
.inv-stat-card--warn .inv-stat-num { color: var(--warn); }
.inv-stat-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --- Table --- */
.inv-table-wrap {
  flex: 1;
  padding: 0 2rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.inv-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.inv-table thead tr {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.inv-table th {
  text-align: left;
  padding: 0.875rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}
.inv-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}
.inv-row:last-child td { border-bottom: none; }
.inv-row--low td { background: var(--warn-light); }

.inv-cell-name { min-width: 160px; }
.inv-item-name { font-weight: 600; color: var(--fg); }
.inv-item-unit { font-size: 0.8rem; color: var(--fg-muted); margin-top: 0.15rem; }
.inv-cell-supplier { color: var(--fg-muted); font-size: 0.875rem; min-width: 120px; }

.inv-stock-bar-wrap { display: flex; flex-direction: column; gap: 0.3rem; }
.inv-stock-bar {
  height: 6px;
  background: var(--bg-alt);
  border-radius: 3px;
  overflow: hidden;
  width: 120px;
}
.inv-stock-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.inv-stock-fill--low { background: var(--danger); }
.inv-stock-val { font-size: 0.8rem; color: var(--fg-muted); }
.inv-cell-par { color: var(--fg-muted); font-size: 0.875rem; }

.inv-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
}
.inv-badge--low { background: var(--danger); color: var(--white); }
.inv-badge--ok { background: var(--success-light); color: var(--success); }

.inv-cell-actions { text-align: right; white-space: nowrap; }
.inv-empty { text-align: center; padding: 3rem; }
.inv-empty-inner { display: flex; flex-direction: column; align-items: center; gap: 1rem; color: var(--fg-muted); }
.inv-empty-inner svg { opacity: 0.4; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: inherit;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
}
.btn-ghost:hover { background: var(--bg-alt); }
.btn-primary {
  background: var(--fg);
  color: var(--white);
}
.btn-primary:hover { background: #333; }
.btn-accent {
  background: var(--accent);
  color: var(--white);
}
.btn-accent:hover { background: var(--accent-dark); }
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
  padding: 0;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--fg-muted);
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg-alt); color: var(--fg); }
.btn-icon--danger:hover { background: var(--danger-light); color: var(--danger); }

/* --- Modal --- */
.inv-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.inv-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}
.inv-modal-panel {
  position: relative;
  background: var(--white);
  border-radius: 12px;
  padding: 1.75rem;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.2s ease;
}
.inv-modal-panel--sm { max-width: 420px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.inv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.inv-modal-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
}
.inv-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* --- Form --- */
.inv-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.inv-field { display: flex; flex-direction: column; gap: 0.35rem; }
.inv-field--span2 { grid-column: span 2; }
.inv-field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.inv-field input,
.inv-field textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.15s;
  outline: none;
}
.inv-field input:focus,
.inv-field textarea:focus { border-color: var(--accent); }
.inv-field textarea { resize: vertical; min-height: 80px; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .inv-stats { flex-direction: column; padding: 1rem; }
  .inv-table-wrap { padding: 0 1rem 2rem; }
  .inv-form-grid { grid-template-columns: 1fr; }
  .inv-field--span2 { grid-column: span 1; }
  .inv-table th:nth-child(3),
  .inv-table td:nth-child(3),
  .inv-table th:nth-child(4),
  .inv-table td:nth-child(4) { display: none; }
}