/* =========================================================================
   Inventory Management System - LSA Builder
   style.css - Polished UI: large readable text, high contrast, icons,
   soft shadows, smooth transitions and clean print templates.
   Tailwind CDN handles layout; these classes keep buttons, forms and
   tables consistent everywhere.
   ========================================================================= */

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-size: 17px;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  overflow-x: hidden;   /* guard against any element pushing the page sideways */
}
*, *::before, *::after { box-sizing: border-box; }

/* ---------- Lucide icon sizing ---------- */
.lucide, svg.lucide { width: 20px; height: 20px; flex-shrink: 0; }
.btn .lucide { width: 18px; height: 18px; }
.btn-sm .lucide { width: 16px; height: 16px; }
.nav-btn .lucide { width: 20px; height: 20px; }
.stat-icon .lucide { width: 26px; height: 26px; }
.footer-icon { width: 18px; height: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  cursor: pointer;
  border: none;
  color: #ffffff;
  text-align: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover { filter: brightness(1.1); box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18); }
.btn:active { transform: scale(0.98); filter: brightness(0.95); }
.btn-blue   { background: linear-gradient(180deg, #2563eb, #1d4ed8); }
.btn-green  { background: linear-gradient(180deg, #16a34a, #15803d); }
.btn-red    { background: linear-gradient(180deg, #dc2626, #b91c1c); }
.btn-gray   { background: linear-gradient(180deg, #64748b, #475569); }
.btn-yellow { background: linear-gradient(180deg, #eab308, #ca8a04); color: #111111; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 15px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* ---------- Form fields ---------- */
.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 16px;
  color: #1e293b;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 17px;
  background: #ffffff;
  min-height: 46px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea { min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}
.field input[readonly] { color: #334155; }
.field .hint { font-size: 14px; color: #64748b; margin-top: 4px; }

/* Inputs with a leading icon (login screen) */
.field-icon { position: relative; }
.field-icon .input-icon {
  position: absolute;
  left: 14px;
  bottom: 13px;
  color: #94a3b8;
  pointer-events: none;
}
.field-icon input { padding-left: 44px; }

/* ---------- Cards ---------- */
.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* Dashboard stat cards */
.stat-card { display: flex; align-items: center; gap: 16px; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.stat-card.stat-click:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  cursor: pointer;
}
.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-blue   { background: #dbeafe; color: #1d4ed8; }
.stat-green  { background: #dcfce7; color: #15803d; }
.stat-yellow { background: #fef9c3; color: #a16207; }
.stat-red    { background: #fee2e2; color: #b91c1c; }

/* ---------- Tables ---------- */
.table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow-x: auto;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.ims-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 16px;
}
.ims-table th {
  background: #0f172a;
  color: #f1f5f9;
  text-align: left;
  padding: 13px 12px;
  font-size: 15px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-bottom: 2px solid #1e293b;
}
.ims-table td {
  padding: 13px 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.ims-table tbody tr:nth-child(even) { background: #f8fafc; }
.ims-table tbody tr:hover { background: #eff6ff; }
.ims-table tbody tr:last-child td { border-bottom: none; }

/* Empty state shown instead of an empty table */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #64748b;
}
.empty-state .lucide { width: 44px; height: 44px; margin: 0 auto 12px; color: #94a3b8; }
.empty-state p { font-size: 19px; font-weight: 600; }

/* ---------- Sidebar ---------- */
.sidebar-bg { background: linear-gradient(180deg, #0b1220 0%, #101c33 100%); }
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}
.brand-logo .lucide { width: 24px; height: 24px; }

/* Collapsible group in the sidebar (Master Data, Stock Operations...) */
.nav-group { margin-bottom: 10px; }
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 9px 12px 7px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}
.nav-group-header:hover { color: #e2e8f0; }
.nav-group-dot {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}
.nav-group-name { flex: 1; text-align: left; }
.nav-chevron {
  width: 16px !important;
  height: 16px !important;
  color: #64748b;
  transition: transform 0.22s ease;
}
.nav-group.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-group-items {
  overflow: hidden;
  max-height: 500px;
  opacity: 1;
  transition: max-height 0.26s ease, opacity 0.18s ease;
}
.nav-group.collapsed .nav-group-items { max-height: 0; opacity: 0; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  margin-bottom: 2px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #cbd5e1;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-btn .lucide { color: var(--nav-accent, #64748b); opacity: 0.9; transition: color 0.15s ease, opacity 0.15s ease; }
.nav-btn:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.nav-btn:hover .lucide { opacity: 1; }
.nav-btn.active {
  background: var(--nav-accent, #2563eb);
  color: #0b1220;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.nav-btn.active .lucide { color: #0b1220; opacity: 1; }

/* ---------- Header ---------- */
.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
  color: #ffffff;
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* ---------- Login screen (split panel) ---------- */
.login-bg {
  background:
    radial-gradient(1000px 600px at 12% 8%, rgba(37, 99, 235, 0.38), transparent 60%),
    radial-gradient(900px 600px at 92% 96%, rgba(124, 58, 237, 0.30), transparent 60%),
    linear-gradient(160deg, #070c17 0%, #111d38 100%);
}
.login-shell {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #ffffff;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(2, 6, 23, 0.55);
}
/* Let both columns shrink below their content width so the card never
   overflows a narrow screen (grid items default to min-width: auto). */
.login-brand, .login-form-panel { min-width: 0; }

/* Left brand panel */
.login-brand {
  padding: 44px 40px;
  color: #eef2ff;
  background:
    radial-gradient(600px 340px at 100% 0%, rgba(96, 165, 250, 0.35), transparent 60%),
    linear-gradient(160deg, #1e3a8a 0%, #4c1d95 100%);
  display: flex;
  flex-direction: column;
}
.login-brand-top { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.login-brand-sub { font-size: 13px; font-weight: 700; letter-spacing: 0.18em; color: #c7d2fe; }
.login-brand-head { font-size: 30px; font-weight: 800; line-height: 1.15; margin-bottom: 12px; }
.login-brand-text { font-size: 17px; line-height: 1.6; color: #dbe4ff; margin-bottom: 26px; }
.login-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.login-features li { display: flex; align-items: center; gap: 13px; font-size: 16px; font-weight: 600; color: #eef2ff; }
.lf-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lf-icon .lucide { width: 22px; height: 22px; color: #ffffff; }

/* Right form panel */
.login-form-panel { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-mobile-logo { display: none; align-items: center; gap: 12px; margin-bottom: 24px; }

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4);
}
.login-logo .lucide { width: 30px; height: 30px; }
.login-logo-sm { width: 48px; height: 48px; border-radius: 13px; }
.login-logo-sm .lucide { width: 26px; height: 26px; }

/* Brand panel developer footer */
.login-brand-footer { margin-top: auto; padding-top: 30px; }
.login-badge {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ffffff;
}
.login-brand-dev { margin-top: 12px; font-size: 15px; color: #dbe4ff; }
.login-brand-dev a { color: #ffffff; font-weight: 800; text-decoration: none; border-bottom: 2px solid rgba(255, 255, 255, 0.5); }
.login-brand-dev a:hover { border-bottom-color: #ffffff; }

/* Form panel developer credit (always visible, also on mobile) */
.login-credit { margin-top: 24px; padding-top: 18px; border-top: 1px solid #eef2f7; text-align: center; }
.login-credit p { font-size: 15px; color: #475569; margin: 3px 0; }
.login-credit a { color: #1d4ed8; font-weight: 700; text-decoration: none; }
.login-credit a:hover { text-decoration: underline; }
.login-credit-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 9999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}
.login-credit-contact { font-size: 14px; color: #64748b; }
.login-credit-sep { color: #cbd5e1; margin: 0 8px; }

/* Quick-login chips */
.login-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.login-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 9999px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  font-weight: 700;
  font-size: 15px;
  color: #1e293b;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.login-chip:hover { border-color: var(--chip, #2563eb); background: #ffffff; }
.login-chip:active { transform: scale(0.97); }
.login-chip-dot { width: 11px; height: 11px; border-radius: 9999px; background: var(--chip, #2563eb); }

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; max-width: 440px; width: 100%; }
  .login-brand { display: none; }
  .login-mobile-logo { display: flex; }
  .login-form-panel { padding: 30px 22px; }
  .login-brand-head { font-size: 26px; }
}
@media (max-width: 420px) {
  .login-form-panel { padding: 26px 18px; }
  .login-chip { font-size: 14px; padding: 7px 12px; }
}

/* ---------- Help button and drawer ---------- */
.help-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
  color: #1d4ed8;
  background: #eff6ff;
  border: 2px solid #bfdbfe;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.help-btn:hover { background: #dbeafe; box-shadow: 0 3px 8px rgba(37, 99, 235, 0.18); }
.help-btn .lucide { width: 20px; height: 20px; }

.help-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 420px;
  max-width: 92vw;
  background: #ffffff;
  z-index: 65;
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.25);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
}
.help-drawer.open { transform: translateX(0); }

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #1d4ed8, #4f46e5);
  color: #ffffff;
}
.help-head-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.help-head-icon .lucide { width: 24px; height: 24px; }

.help-body { padding: 20px; overflow-y: auto; flex: 1; }
.help-intro {
  font-size: 17px;
  line-height: 1.55;
  color: #1e293b;
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}
.help-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin: 18px 0 10px;
}
.help-section-label .lucide { width: 20px; height: 20px; color: #2563eb; }
.help-steps {
  list-style: none;
  counter-reset: help-step;
  padding: 0;
  margin: 0;
}
.help-steps li {
  counter-increment: help-step;
  position: relative;
  padding: 10px 0 10px 44px;
  font-size: 16px;
  line-height: 1.5;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
}
.help-steps li::before {
  content: counter(help-step);
  position: absolute;
  left: 0;
  top: 9px;
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.help-tips { list-style: none; padding: 0; margin: 0; }
.help-tips li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 15.5px;
  line-height: 1.5;
  color: #334155;
  padding: 7px 0;
}
.help-tips li .lucide { width: 14px; height: 14px; color: #16a34a; margin-top: 4px; flex-shrink: 0; }

/* ---------- Quick actions (dashboard) ---------- */
.quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  color: #ffffff;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  border: none;
  text-align: left;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.quick-action:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2); filter: brightness(1.06); }
.quick-action .qa-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quick-action .qa-icon .lucide { width: 24px; height: 24px; }
.qa-sub { font-size: 13px; font-weight: 600; opacity: 0.9; }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}
.badge-green  { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.badge-red    { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.badge-yellow { background: #fef9c3; color: #713f12; border: 1px solid #fde047; }
.badge-blue   { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }
.badge-gray   { background: #e2e8f0; color: #1e293b; border: 1px solid #cbd5e1; }

/* ---------- Toast messages ---------- */
.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
  animation: toast-in 0.25s ease;
}
.toast-item .lucide { width: 22px; height: 22px; margin-top: 1px; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---------- Modal ---------- */
#modal-overlay { animation: fade-in 0.15s ease; }
#modal-box { animation: pop-in 0.18s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
#sidebar::-webkit-scrollbar-thumb { background: #334155; }

/* ---------- Printing ---------- */
#print-area { display: none; }

@page { size: A4; margin: 12mm; }

@media print {
  /* Hide the whole application; show only the print sheet. */
  #login-screen, #app-root, #toast, #modal-overlay,
  #help-drawer, #help-overlay { display: none !important; }
  #print-area { display: block !important; }
  html, body {
    background: #ffffff !important;
    margin: 0;
    padding: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-page { padding: 0; font-size: 14px; color: #000000; }
  .print-page h1, .print-page h2, .print-page h3 { color: #000000; }
  .print-table { width: 100%; border-collapse: collapse; font-size: 12px; }
  .print-table th {
    border: 1px solid #000000;
    padding: 6px;
    text-align: left;
    background: #e5e7eb !important;
    color: #000000;
  }
  .print-table td { border: 1px solid #000000; padding: 6px; text-align: left; }
  .print-table tr { page-break-inside: avoid; }
  .label-box { page-break-inside: avoid; }
  a { color: #000000; text-decoration: none; }
}

/* Barcode label layout (screen preview and print) */
.label-box {
  display: inline-block;
  border: 1px solid #000000;
  padding: 8px 12px;
  margin: 4px;
  text-align: center;
  background: #ffffff;
}
