/* ══════════════════════════════════════════════════════════════
   CARE College Inventory — Design System
   ══════════════════════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }

/* ── Design Tokens ── */
:root {
  /* Backgrounds */
  --bg:         #0d1117;
  --surface:    #161c2d;
  --surface-2:  #1e2640;
  --surface-3:  #263052;

  /* Borders */
  --border:     rgba(255,255,255,0.07);
  --border-2:   rgba(255,255,255,0.12);

  /* Accent — indigo */
  --accent:       #6366f1;
  --accent-hover: #818cf8;
  --accent-dim:   rgba(99,102,241,0.15);

  /* Semantic colors */
  --success:     #22c55e;
  --success-dim: rgba(34,197,94,0.12);
  --warning:     #f59e0b;
  --warning-dim: rgba(245,158,11,0.12);
  --danger:      #ef4444;
  --danger-dim:  rgba(239,68,68,0.12);
  --info:        #38bdf8;
  --info-dim:    rgba(56,189,248,0.12);
  --purple:      #a855f7;
  --purple-dim:  rgba(168,85,247,0.12);

  /* Text */
  --text:       #e2e8f8;
  --text-muted: #8896b3;
  --text-dim:   #4a5568;

  /* Layout */
  --sidebar-w:  240px;
  --topbar-h:   62px;

  /* Radii */
  --radius:    14px;
  --radius-md: 10px;
  --radius-sm:  7px;

  /* Elevation */
  --shadow:    0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.55);

  --transition: all 0.18s ease;
}

/* ── Base ── */
html { font-size: 14px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar           { width: 5px; height: 5px; }
::-webkit-scrollbar-track     { background: transparent; }
::-webkit-scrollbar-thumb     { background: var(--surface-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Utility */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse at 65% 25%, rgba(99,102,241,0.14) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 80%, rgba(168,85,247,0.09) 0%, transparent 45%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
  flex-shrink: 0;
}

.login-logo h1  { font-size: 17px; font-weight: 700; line-height: 1.2; }
.login-logo span { font-size: 12px; color: var(--text-muted); }

.login-title    { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

.alert-error {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.22);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ══════════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}

.sidebar-brand-text h2  { font-size: 14px; font-weight: 700; line-height: 1.25; }
.sidebar-brand-text span { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { flex: 1; padding: 12px 10px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 14px 10px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  margin-bottom: 2px;
}

.nav-item:hover           { background: var(--surface-2); color: var(--text); }
.nav-item.active          { background: var(--accent-dim); color: var(--accent); }
.nav-item .nav-icon       { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}

.user-info .user-name { font-size: 12px; font-weight: 600; }
.user-info .user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

/* ── Main Area ── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 16px;
}

.topbar-title    { font-size: 18px; font-weight: 700; }
.topbar-actions  { display: flex; gap: 8px; align-items: center; }

.view-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover   { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.35); }

.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }
.btn-secondary:not(:disabled):hover { background: var(--surface-3); }

.btn-success   { background: var(--success-dim); color: var(--success); border-color: rgba(34,197,94,0.2); }
.btn-success:not(:disabled):hover   { background: rgba(34,197,94,0.22); }

.btn-warning   { background: var(--warning-dim); color: var(--warning); border-color: rgba(245,158,11,0.2); }
.btn-warning:not(:disabled):hover   { background: rgba(245,158,11,0.22); }

.btn-danger    { background: var(--danger-dim); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.btn-danger:not(:disabled):hover    { background: rgba(239,68,68,0.22); }

.btn-info      { background: var(--info-dim); color: var(--info); border-color: rgba(56,189,248,0.2); }
.btn-info:not(:disabled):hover      { background: rgba(56,189,248,0.22); }

.btn-ghost     { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:not(:disabled):hover     { background: var(--surface-2); color: var(--text); }

.btn-sm        { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block     { width: 100%; padding: 11px 16px; font-size: 14px; }

/* ══════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════ */
.form-group    { margin-bottom: 16px; }
.form-row      { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 9px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder, textarea::placeholder { color: var(--text-dim); }
select option   { background: var(--surface-2); }
textarea        { resize: vertical; min-height: 80px; line-height: 1.5; }

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-wrap .search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
}
.search-wrap input { padding-left: 33px; }

/* ══════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.card-title { font-size: 14px; font-weight: 600; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: 1px;
}
.stat-card.c-accent::after  { background: linear-gradient(90deg, var(--accent), #8b5cf6); }
.stat-card.c-success::after { background: var(--success); }
.stat-card.c-warning::after { background: var(--warning); }
.stat-card.c-danger::after  { background: var(--danger); }
.stat-card.c-info::after    { background: var(--info); }
.stat-card.c-purple::after  { background: var(--purple); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  margin-bottom: 14px;
}
.stat-icon.c-accent  { background: var(--accent-dim); }
.stat-icon.c-success { background: var(--success-dim); }
.stat-icon.c-warning { background: var(--warning-dim); }
.stat-icon.c-danger  { background: var(--danger-dim); }
.stat-icon.c-info    { background: var(--info-dim); }
.stat-icon.c-purple  { background: var(--purple-dim); }

.stat-value  { font-size: 30px; font-weight: 700; line-height: 1; margin-bottom: 5px; letter-spacing: -0.02em; }
.stat-label  { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ── Dashboard grid ── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Status summary rows ── */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.status-row:last-child { border-bottom: none; }
.status-row-label { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* ══════════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td      { background: rgba(255,255,255,0.025); }

.cell-name   { font-weight: 600; color: var(--text); }
.cell-muted  { color: var(--text-muted); }
.cell-mono   { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; }

tr.row-warn  { background: rgba(245,158,11,0.04); }

.table-meta { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* ── Toolbar above table ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger);  }
.badge-info    { background: var(--info-dim);    color: var(--info);    }
.badge-purple  { background: var(--purple-dim);  color: var(--purple);  }
.badge-accent  { background: var(--accent-dim);  color: var(--accent);  }
.badge-neutral { background: var(--surface-3);   color: var(--text-muted); }

/* Qty badge */
.qty {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
}
.qty-ok   { background: var(--success-dim); color: var(--success); }
.qty-low  { background: var(--warning-dim); color: var(--warning); }
.qty-zero { background: var(--danger-dim);  color: var(--danger);  }

/* ══════════════════════════════════════════════════════════════
   FILTER TABS
   ══════════════════════════════════════════════════════════════ */
.filter-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
}
.filter-tab:hover:not(.active) { color: var(--text); }
.filter-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ══════════════════════════════════════════════════════════════
   ACTION BUTTON GROUP
   ══════════════════════════════════════════════════════════════ */
.actions { display: flex; gap: 5px; align-items: center; flex-wrap: nowrap; }

/* ══════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 0;
  gap: 12px;
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 28px; height: 28px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  font-family: inherit;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

.modal-body   { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* Modal tab switcher */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}

.modal-tab {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}
.modal-tab.active        { color: var(--accent); border-bottom-color: var(--accent); }
.modal-tab:hover:not(.active) { color: var(--text); }

/* ══════════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 500;
  min-width: 220px;
  max-width: 340px;
  pointer-events: all;
  animation: toastIn 0.2s ease;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

.toast-icon { font-size: 15px; }

/* ══════════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty-icon  { font-size: 48px; opacity: 0.4; margin-bottom: 16px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; max-width: 280px; }

/* ── Loading ── */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════ */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { transform: translateY(18px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes toastIn  { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .dash-grid      { grid-template-columns: 1fr; }
  .form-row       { grid-template-columns: 1fr; }
  :root           { --sidebar-w: 200px; }
}
