/* ============================================================
   SENTOS — Main Stylesheet
   Design: Industrial-luxury dark theme with amber accents
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Mono:wght@300;400;500&family=Inter:wght@300;400;500;600&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg:        #0d0f14;
  --bg2:       #13161e;
  --bg3:       #1a1e28;
  --surface:   #1f2433;
  --surface2:  #252a38;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);

  --amber:     #e2b04a;
  --amber2:    #f0c86a;
  --amber-dim: rgba(226,176,74,0.12);
  --amber-glow:rgba(226,176,74,0.25);

  --red:       #ef4444;
  --red-dim:   rgba(239,68,68,0.12);
  --green:     #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --blue:      #60a5fa;
  --blue-dim:  rgba(96,165,250,0.12);
  --orange:    #f97316;
  --orange-dim:rgba(249,115,22,0.12);

  --text:      #e2e8f0;
  --text2:     #94a3b8;
  --text3:     #64748b;

  --font-display: 'Syne', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'DM Mono', monospace;

  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);

  --sidebar-w: 240px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--amber); text-decoration: none; }
a:hover { color: var(--amber2); }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--amber);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  color: var(--bg);
  font-family: var(--font-display);
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--amber);
}
.brand-tagline { font-size: 10px; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 16px 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-right: 2px solid transparent;
  position: relative;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-item.active {
  color: var(--amber);
  background: var(--amber-dim);
  border-right-color: var(--amber);
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--surface2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--amber);
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11px; color: var(--text3); text-transform: capitalize; }
.user-actions { margin-left: auto; display: flex; gap: 6px; }
.btn-icon { background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px; border-radius: 4px; transition: color var(--transition); font-size: 14px; }
.btn-icon:hover { color: var(--text); }

/* ── Main Content ────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: 60px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 90;
}
.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
.topbar-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text); }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.alert-bell {
  position: relative;
  background: none; border: none;
  color: var(--text2); font-size: 18px;
  cursor: pointer; padding: 6px;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.alert-bell:hover { background: var(--surface); color: var(--text); }
.bell-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg2);
}

/* ── Page Content ────────────────────────────────────────────── */
.page-content { flex: 1; padding: 28px; }
.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.page-header p { color: var(--text2); font-size: 14px; }

/* ── Stats Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--amber);
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover { border-color: var(--border2); }
.stat-card:hover::before { opacity: 1; }
.stat-icon { font-size: 24px; margin-bottom: 12px; }
.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 13px; color: var(--text2); font-weight: 500; }
.stat-card.danger .stat-value { color: var(--red); }
.stat-card.warning .stat-value { color: var(--amber); }
.stat-card.success .stat-value { color: var(--green); }

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.card-body { padding: 22px; }

/* ── Grid Layouts ───────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-12 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
.grid-21 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--bg2);
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody td { padding: 12px 16px; color: var(--text); vertical-align: middle; }
.td-muted { color: var(--text2); font-size: 13px; }
.td-mono { font-family: var(--font-mono); font-size: 13px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-danger  { background: var(--red-dim);    color: var(--red);    }
.badge-warning { background: var(--amber-dim);  color: var(--amber);  }
.badge-success { background: var(--green-dim);  color: var(--green);  }
.badge-info    { background: var(--blue-dim);   color: var(--blue);   }
.badge-orange  { background: var(--orange-dim); color: var(--orange); }
.badge-neutral { background: var(--surface2);   color: var(--text2);  }

/* ── Stock level indicator ──────────────────────────────────── */
.stock-bar-wrap { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.stock-bar {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.stock-bar-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.stock-bar-fill.ok      { background: var(--green); }
.stock-bar-fill.low     { background: var(--amber); }
.stock-bar-fill.critical{ background: var(--red); }
.stock-pct { font-family: var(--font-mono); font-size: 12px; color: var(--text2); min-width: 36px; text-align: right; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--amber);    color: var(--bg); }
.btn-primary:hover  { background: var(--amber2); }
.btn-danger   { background: var(--red-dim);  color: var(--red);   border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover   { background: var(--red); color: #fff; }
.btn-ghost    { background: transparent;     color: var(--text2); border: 1px solid var(--border2); }
.btn-ghost:hover    { background: var(--surface2); color: var(--text); }
.btn-success  { background: var(--green-dim);color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.btn-success:hover  { background: var(--green); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
  margin-bottom: 7px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  transition: all var(--transition);
  outline: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text3); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 5px; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-lg { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text3); font-size: 20px; cursor: pointer; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ── Alerts/Notifications ───────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid;
}
.alert-danger  { background: var(--red-dim);    color: var(--red);    border-color: rgba(239,68,68,0.3); }
.alert-warning { background: var(--amber-dim);  color: var(--amber);  border-color: rgba(226,176,74,0.3); }
.alert-success { background: var(--green-dim);  color: var(--green);  border-color: rgba(34,197,94,0.3); }
.alert-info    { background: var(--blue-dim);   color: var(--blue);   border-color: rgba(96,165,250,0.3); }

/* ── Toast notifications ────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 14px;
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: slideRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
}
.toast.success { border-color: rgba(34,197,94,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
.toast.warning { border-color: rgba(226,176,74,0.4); }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg { flex: 1; }
.toast-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 16px; padding: 0; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
}
.page-btn {
  min-width: 34px; height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.page-btn:hover, .page-btn.active { background: var(--amber); color: var(--bg); border-color: var(--amber); }

/* ── Chart containers ───────────────────────────────────────── */
.chart-container { position: relative; }
.chart-filters {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-btn {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn.active, .filter-btn:hover {
  background: var(--amber-dim);
  border-color: var(--amber);
  color: var(--amber);
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 4px;
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text3);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--amber); border-bottom-color: var(--amber); }
.tab-btn:hover { color: var(--text); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Search & Filters bar ───────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-box input {
  padding-left: 36px;
}
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 14px;
  pointer-events: none;
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text3);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { color: var(--text2); font-size: 16px; margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ── Login page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(226,176,74,0.06) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(96,165,250,0.04) 0%, transparent 70%);
  bottom: -50px; right: -50px;
  pointer-events: none;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .brand-icon {
  width: 52px; height: 52px;
  font-size: 26px;
  margin: 0 auto 12px;
}
.login-logo .brand-name { font-size: 28px; }
.login-logo .brand-tagline { margin-top: 4px; }
.login-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--text3); font-size: 14px; margin-bottom: 28px; }

/* ── Leaderboard ────────────────────────────────────────────── */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.leaderboard-item:last-child { border-bottom: none; }
.rank-num {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--text3);
  width: 28px;
  flex-shrink: 0;
  text-align: center;
}
.leaderboard-item:nth-child(1) .rank-num { color: #ffd700; }
.leaderboard-item:nth-child(2) .rank-num { color: #c0c0c0; }
.leaderboard-item:nth-child(3) .rank-num { color: #cd7f32; }
.rank-bar-wrap { flex: 1; }
.rank-name { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.rank-bar { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.rank-bar-fill { height: 100%; background: linear-gradient(90deg, var(--amber), var(--amber2)); border-radius: 3px; }
.rank-qty { font-family: var(--font-mono); font-size: 13px; color: var(--amber); font-weight: 600; white-space: nowrap; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.fade-in { animation: fadeIn 0.4s ease; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-content { margin-left: 0; }
  .topbar-menu-btn { display: block; }
  .grid-2, .grid-3, .grid-12, .grid-21 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .login-card { padding: 32px 24px; }
}
