/* ============================================================
   FACADE INVENTORY MANAGEMENT SYSTEM — NLG SmartFabX Theme
   Shared base CSS for all Materials Hub pages
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg-base:        #f0f2f5;
  --bg-surface:     #ffffff;
  --bg-raised:      #f7f8fa;
  --bg-card:        #eef1f5;
  --bg-hover:       #e8ecf1;
  --border:         #d5dbe3;
  --border-light:   #c4cdd7;
  --teal:           #0b7dda;
  --teal-dim:       #0966b8;
  --teal-glow:      rgba(11,125,218,0.08);
  --emerald:        #0d9668;
  --emerald-dim:    #087a54;
  --amber:          #d97706;
  --amber-dim:      #b45309;
  --red:            #dc2626;
  --red-dim:        #b91c1c;
  --text-primary:   #1e293b;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --font-display:   'Syne', sans-serif;
  --font-body:      'Inter', sans-serif;
  --font-mono:      'JetBrains Mono', monospace;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-xl:      20px;
  --shadow-md:      0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:      0 4px 20px rgba(0,0,0,0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Container ─────────────────────────── */
.container { max-width: 100%; padding: 12px 16px; }

/* ── Header ────────────────────────────── */
.header {
  background: linear-gradient(135deg, #1a6b5a, #1b7a68, #1a6b5a);
  border: none;
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #6ee7b7, #a7f3d0, #6ee7b7, transparent);
  background-size: 300% 100%;
  animation: shimmer 4s linear infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.header-brand { display: flex; align-items: center; gap: 12px; }
.header-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.header h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
}
.header h1 span { color: #a7f3d0; }
.header p {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}

.header-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.78rem;
  text-decoration: none;
  display: flex; align-items: center; gap: 5px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.nav-btn:hover { background: rgba(255,255,255,0.22); }
.nav-btn.danger { color: #fca5a5; border-color: rgba(252,165,165,0.35); }
.nav-btn.danger:hover { background: rgba(220,38,38,0.2); }

/* ── Stats Bar ─────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-md);
}
.stat-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.stat-count {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}
.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 2px;
}

/* ── Toolbar ───────────────────────────── */
.toolbar {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-md);
}
.toolbar-sep { width: 1px; height: 26px; background: var(--border); margin: 0 2px; }

/* ── Search Bar ────────────────────────── */
.search-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-md);
}
.search-box {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  flex: 1; min-width: 160px;
}
.search-box:focus-within { border-color: var(--teal); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text-primary);
  font-size: 0.82rem; font-family: var(--font-body);
  width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }
.filter-select {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 0.8rem; font-family: var(--font-body);
  cursor: pointer; outline: none; min-width: 120px;
}
.filter-select:focus { border-color: var(--teal); }
.filter-select option { background: var(--bg-surface); }
.results-info {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}
.results-info span { color: var(--teal); font-weight: 600; }

/* ── Tab Navigation ────────────────────── */
.tab-nav {
  display: flex; gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-md);
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--text-secondary);
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-raised); }
.tab-btn.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal-dim);
  box-shadow: 0 2px 8px rgba(11,125,218,0.25);
}
.tab-count {
  background: rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 0.67rem;
  font-family: var(--font-mono);
  font-weight: 600;
}
.tab-btn:not(.active) .tab-count { background: var(--bg-raised); color: var(--text-muted); }

/* ── Buttons ───────────────────────────── */
.btn {
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  font-family: var(--font-body);
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none !important; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dim); box-shadow: 0 4px 12px rgba(11,125,218,0.3); }
.btn-secondary { background: var(--emerald); color: #fff; }
.btn-success { background: var(--emerald); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-dim); }
.btn-ghost {
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 4px 10px; font-size: 0.73rem; }
.btn-delete {
  background: rgba(220,38,38,0.06);
  color: var(--red);
  border: 1px solid rgba(220,38,38,0.2);
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-delete:hover { background: rgba(220,38,38,0.14); }

/* ── Badges ────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 0.67rem;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
  border: 1px solid;
}
.badge-ok,
.badge-delivered { background: rgba(13,150,104,0.08); color: var(--emerald); border-color: rgba(13,150,104,0.2); }
.badge-partial,
.badge-low       { background: rgba(217,119,6,0.08);  color: var(--amber);   border-color: rgba(217,119,6,0.2); }
.badge-pending,
.badge-hold,
.badge-draft     { background: rgba(148,163,184,0.1); color: var(--text-muted); border-color: rgba(148,163,184,0.2); }
.badge-critical,
.badge-cancelled { background: rgba(220,38,38,0.08);  color: var(--red);     border-color: rgba(220,38,38,0.2); }
.badge-sent      { background: rgba(11,125,218,0.08); color: var(--teal);    border-color: rgba(11,125,218,0.2); }

/* Category badges */
.cat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.67rem; font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid;
}
.cat-profiles    { background: rgba(11,125,218,0.08); color: var(--teal);    border-color: rgba(11,125,218,0.2); }
.cat-accessories { background: rgba(13,150,104,0.08); color: var(--emerald); border-color: rgba(13,150,104,0.2); }
.cat-hardwares   { background: rgba(217,119,6,0.08);  color: var(--amber);   border-color: rgba(217,119,6,0.2); }
.cat-gaskets     { background: rgba(139,92,246,0.08); color: #8b5cf6;        border-color: rgba(139,92,246,0.2); }
.cat-steels      { background: rgba(220,38,38,0.08);  color: var(--red);     border-color: rgba(220,38,38,0.2); }

/* ── Tables ────────────────────────────── */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.table-container {
  overflow-x: auto;
  max-height: calc(100vh - 380px);
  overflow-y: auto;
}
.table-container::-webkit-scrollbar { width: 5px; height: 5px; }
.table-container::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

table {
  width: 100%;
  border-collapse: collapse;
}
table th {
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 2;
}
table th:hover { color: var(--teal); }
table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  vertical-align: middle;
}
table tbody tr:hover { background: var(--bg-raised); }
table tbody tr:nth-child(even) { background: var(--bg-card); }
table tbody tr:nth-child(even):hover { background: var(--bg-raised); }

/* ── Modals ────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
}
.modal.open { display: flex; }
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s ease-out;
}
.modal-content::-webkit-scrollbar { width: 4px; }
.modal-content::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg-surface);
  z-index: 5;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-close {
  width: 28px; height: 28px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(220,38,38,0.08); color: var(--red); border-color: var(--red); }
.modal-body { padding: 18px 22px; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
}

/* ── Forms ─────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-family: var(--font-mono);
}
.form-group label .req { color: var(--red); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-family: var(--font-body);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--teal); }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }
.form-group select option { background: var(--bg-surface); }
.form-group textarea { resize: vertical; min-height: 60px; }

/* ── Line Items Section (modals) ───────── */
.items-section {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 10px;
}
.items-section-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.items-header,
.line-header {
  display: grid;
  gap: 6px;
  margin-bottom: 6px;
}
.items-header span,
.line-header span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.item-row,
.line-row {
  display: grid;
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
}
.item-row input,
.item-row select,
.line-row input,
.line-row select {
  padding: 5px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: var(--font-body);
  color: var(--text-primary);
  outline: none;
}
.item-row input:focus,
.item-row select:focus,
.line-row input:focus,
.line-row select:focus { border-color: var(--teal); }
.remove-item-btn,
.remove-line-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--red);
  font-size: 14px;
  padding: 4px;
}

/* ── Panel Layout (Two column) ─────────── */
.panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: space-between;
}
.detail-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 300px;
  color: var(--text-muted);
  font-size: 0.85rem;
  gap: 10px;
}
.detail-empty .big-icon { font-size: 2.5rem; opacity: 0.3; }

/* ── Empty State ───────────────────────── */
.empty-state { text-align: center; padding: 52px; color: var(--text-muted); }
.empty-icon  { font-size: 2.5rem; opacity: 0.3; margin-bottom: 10px; }
.empty-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--text-secondary); }
.empty-sub   { font-size: 0.78rem; margin-top: 5px; color: var(--emerald); }

/* ── Toast Notifications ───────────────── */
.toast-wrap {
  position: fixed;
  bottom: 18px; right: 18px;
  z-index: 3000;
  display: flex; flex-direction: column; gap: 7px;
}
.toast {
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  display: flex; align-items: center; gap: 7px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.22s ease-out;
  border: 1px solid;
  min-width: 200px;
}
.toast.success { background: rgba(13,150,104,0.08); color: var(--emerald); border-color: rgba(13,150,104,0.2); }
.toast.error   { background: rgba(220,38,38,0.08);  color: var(--red);     border-color: rgba(220,38,38,0.2); }
.toast.info    { background: rgba(11,125,218,0.08);  color: var(--teal);    border-color: rgba(11,125,218,0.2); }
.toast.warning { background: rgba(217,119,6,0.08);   color: var(--amber);   border-color: rgba(217,119,6,0.2); }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }

/* ── Stock bars ────────────────────────── */
.stock-bar  { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 4px; width: 80px; }
.stock-fill { height: 100%; border-radius: 3px; }
.alloc-bar  { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 3px; width: 80px; }
.alloc-fill { height: 100%; border-radius: 3px; }

/* ── Progress bars ─────────────────────── */
.progress-bar  { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.progress-fill { height: 100%; border-radius: 2px; }

/* ── Reorder suggestion ────────────────── */
.reorder-suggest {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--teal);
  background: rgba(11,125,218,0.06);
  border: 1px solid rgba(11,125,218,0.15);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  display: inline-block;
  margin-top: 2px;
}

/* ── Responsive ────────────────────────── */
@media (max-width: 900px) {
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  body { background: #fff !important; color: #000 !important; }
  .header-nav, .toolbar, .search-bar, .tab-nav { display: none !important; }
  table th {
    background: #1f2937 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
