/* =====================================================
   Inventory System — Design System
   Style: Soft UI Evolution | Stack: html-tailwind
   Font: Plus Jakarta Sans
   ===================================================== */

/* Hide entire body until i18n translations are applied, then reveal instantly */
body:not(.page-ready) { visibility: hidden; }
body.page-ready { visibility: visible; }

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Backgrounds */
  --bg:           #f8f7f4;
  --bg-soft:      #fdfcfa;
  --panel:        rgba(255, 254, 252, 0.93);
  --panel-strong: #fffefb;
  --panel-border: rgba(15, 23, 42, 0.08);

  /* Sidebar */
  --nav-bg:       #111827;
  --nav-border:   rgba(255, 255, 255, 0.07);
  --nav-muted:    #9ca3af;
  --nav-hover:    rgba(255, 255, 255, 0.07);
  --nav-active-bg:rgba(255, 255, 255, 0.1);
  --nav-active-fg:#f9fafb;

  /* Text */
  --text:         #0f172a;
  --text-muted:   #475569;
  --text-soft:    #94a3b8;

  /* Brand — teal + amber kept, palette tightened */
  --brand:        #0d9488;
  --brand-strong: #0f766e;
  --brand-soft:   rgba(13, 148, 136, 0.1);

  --accent:       #d97706;
  --accent-soft:  rgba(217, 119, 6, 0.12);

  /* Semantic */
  --success:      #15803d;
  --success-soft: rgba(22, 163, 74, 0.1);
  --warning:      #b45309;
  --warning-soft: rgba(217, 119, 6, 0.1);
  --danger:       #b91c1c;
  --danger-soft:  rgba(185, 28, 28, 0.1);

  /* Shadows — soft, layered */
  --shadow-sm:    0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:    0 4px 12px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:    0 12px 28px rgba(15, 23, 42, 0.09), 0 4px 8px rgba(15, 23, 42, 0.05);

  /* Focus ring */
  --ring:         0 0 0 3px rgba(13, 148, 136, 0.22);
}

/* ── Reset & base ─────────────────────────────────── */

html {
  background: var(--bg);
}

body {
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.35) 1px, transparent 1px);
  background-size: 32px 32px;
}

a, button, select, input[type="submit"] {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── App shell ────────────────────────────────────── */

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-border);
}

.app-topbar {
  background: rgba(248, 247, 244, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ── Brand mark ───────────────────────────────────── */

.brand-mark {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16),
              0 2px 8px rgba(13, 148, 136, 0.28);
}

/* ── Page header accent bar ───────────────────────── */

.page-head-mark {
  position: relative;
  padding-left: 1rem;
}

.page-head-mark::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2rem;
  bottom: 0.2rem;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
}

/* ── Navigation ───────────────────────────────────── */

.nav-link {
  position: relative;
  color: var(--nav-muted);
  transition: background-color 200ms ease, color 200ms ease;
}

.nav-link:hover {
  background: var(--nav-hover);
  color: #f9fafb;
}

.nav-link:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.5);
}

.nav-link.is-active {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
}

.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

/* ── Surfaces ─────────────────────────────────────── */

.surface-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.surface-panel-strong {
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-sm);
}

.surface-tint {
  background:
    linear-gradient(135deg, rgba(13, 148, 136, 0.05), transparent 50%),
    var(--panel-strong);
}

/* ── Typography helpers ───────────────────────────── */

.eyebrow {
  color: var(--text-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ── Metric cards ─────────────────────────────────── */

.metric-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.metric-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.metric-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  border-radius: 0.75rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ── Buttons ──────────────────────────────────────── */

.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.625rem;
  padding: 0.65rem 1.1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 200ms ease, box-shadow 200ms ease,
              transform 200ms ease, border-color 200ms ease, color 200ms ease;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  box-shadow: 0 1px 3px rgba(13, 148, 136, 0.3), 0 4px 12px rgba(13, 148, 136, 0.15);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.35), 0 6px 16px rgba(13, 148, 136, 0.2);
}

.btn-secondary {
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 254, 252, 0.96);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: rgba(13, 148, 136, 0.28);
  background: #fff;
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  color: var(--brand-strong);
  border: 1px solid rgba(13, 148, 136, 0.2);
  background: var(--brand-soft);
}

.btn-ghost:hover {
  background: rgba(13, 148, 136, 0.15);
  border-color: rgba(13, 148, 136, 0.3);
}

.btn-primary:focus,
.btn-secondary:focus,
.btn-ghost:focus {
  outline: none;
  box-shadow: var(--ring);
}

/* ── Form fields ──────────────────────────────────── */

.field-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field-input,
.field-select {
  width: 100%;
  min-height: 2.625rem;
  padding: 0.65rem 0.875rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.field-input::placeholder {
  color: var(--text-soft);
}

.field-input:focus,
.field-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
  background: #fff;
}

.form-field.is-invalid {
  border-color: rgba(185, 28, 28, 0.5);
  background: rgba(254, 242, 242, 0.8);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.form-field.is-invalid + .invalid-feedback {
  display: block !important;
}

/* ── Section kicker ───────────────────────────────── */

.section-kicker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-kicker::before {
  content: "";
  width: 1.5rem;
  height: 2px;
  border-radius: 999px;
  background: var(--brand);
  flex-shrink: 0;
}

/* ── Tables ───────────────────────────────────────── */

.table-shell {
  overflow: hidden;
  border-radius: 1rem;
}

/* Fade hint on right edge when table overflows horizontally */
.table-scroll-wrap {
  position: relative;
}

.table-scroll-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.5rem;
  background: linear-gradient(to right, transparent, rgba(248, 247, 244, 0.85));
  pointer-events: none;
  border-radius: 0 1rem 1rem 0;
}

@media (min-width: 768px) {
  .table-scroll-wrap::after { display: none; }
}

.data-table th {
  color: var(--text-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.data-table td {
  color: var(--text);
  font-size: 0.875rem;
}

.data-table tbody tr {
  transition: background-color 150ms ease;
}

.data-table tbody tr:hover {
  background: rgba(13, 148, 136, 0.04);
}

/* ── Status pills ─────────────────────────────────── */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.status-pill-success {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-pill-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill-info {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

/* ── Table action button ──────────────────────────── */

.table-action {
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

/* ── Stat strip / tiles ───────────────────────────── */

.stat-strip {
  display: grid;
  gap: 0.75rem;
}

.stat-tile {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 0.875rem;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

/* ── Form layout ──────────────────────────────────── */

.form-shell {
  display: grid;
  gap: 1.25rem;
}

.form-sidebar-note {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 1rem;
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow-sm);
}

.muted-rule {
  border-top: 1px solid var(--panel-border);
}

/* ── Empty state ──────────────────────────────────── */

.empty-state {
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.empty-state svg {
  color: #cbd5e1;
}

/* ── Responsive sidebar ───────────────────────────── */

@media (max-width: 1023px) {
  .app-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--nav-border);
  }
}
