/* =========================================================
   SIMAS - Design System
   Palette: Indigo (primary) + Teal (accent) + slate neutrals
   ========================================================= */
:root {
  --sm-primary: #4f46e5;
  --sm-primary-dark: #3730a3;
  --sm-accent: #14b8a6;
  --sm-bg: #f4f5fb;
  --sm-sidebar-bg: #12122b;
  --sm-sidebar-bg-2: #1b1b3a;
  --sm-text-muted: #6b7280;
  --sm-border: #e5e7eb;
  --sm-radius: 14px;
  --sm-shadow: 0 4px 14px rgba(31, 41, 55, 0.06);
  --sm-shadow-lg: 0 12px 28px rgba(31, 41, 55, 0.10);
}

* { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  background: var(--sm-bg);
  color: #1f2430;
}

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #4f46e5 0%, #1b1b3a 45%, #0c0c1f 100%);
}
.login-wrapper { width: 100%; max-width: 420px; padding: 16px; }
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-icon {
  width: 64px; height: 64px; border-radius: 18px;
  background: linear-gradient(135deg, var(--sm-primary), var(--sm-accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff; margin: 0 auto 14px;
}
.login-brand h1 { font-weight: 800; margin-bottom: 2px; letter-spacing: 0.5px; }
.login-brand p { color: var(--sm-text-muted); font-size: 0.9rem; margin: 0; }

/* ---------- Layout ---------- */
.sm-wrapper { display: flex; min-height: 100vh; }

.sm-sidebar {
  width: 264px;
  min-width: 264px;
  background: linear-gradient(180deg, var(--sm-sidebar-bg) 0%, var(--sm-sidebar-bg-2) 100%);
  color: #cfd2e8;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform 0.25s ease;
}
.sm-sidebar::-webkit-scrollbar { width: 6px; }
.sm-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.sm-sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sm-sidebar-brand .icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--sm-primary), var(--sm-accent));
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff;
  flex-shrink: 0;
}
.sm-sidebar-brand h5 { color: #fff; margin: 0; font-weight: 800; font-size: 1.05rem; }
.sm-sidebar-brand small { color: #9095b8; font-size: 0.72rem; }

.sm-nav { padding: 14px 12px 30px; }
.sm-nav .nav-section-title {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px;
  color: #6b7099; padding: 14px 12px 6px;
  font-weight: 700;
}
.sm-nav a.nav-link {
  color: #b9bcdb; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px; font-size: 0.89rem; font-weight: 500;
  margin-bottom: 2px; transition: all 0.15s ease;
}
.sm-nav a.nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sm-nav a.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sm-nav a.nav-link.active {
  background: linear-gradient(135deg, var(--sm-primary), #6d28d9);
  color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}
.sm-nav .submenu { margin-left: 14px; border-left: 1px dashed rgba(255,255,255,0.15); padding-left: 10px; }
.sm-nav .submenu a.nav-link { font-size: 0.83rem; padding: 8px 12px; }

.sm-main {
  margin-left: 264px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sm-topbar {
  background: #fff;
  border-bottom: 1px solid var(--sm-border);
  padding: 14px 26px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 1020;
}
.sm-topbar .page-title { font-weight: 800; font-size: 1.15rem; margin: 0; }
.sm-topbar .breadcrumb-sm { color: var(--sm-text-muted); font-size: 0.8rem; margin: 0; }
#sidebarToggle { border: none; background: none; font-size: 1.4rem; color: #333; display: none; }

.sm-user-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--sm-bg); padding: 6px 14px 6px 6px; border-radius: 30px;
  cursor: pointer; border: 1px solid var(--sm-border);
}
.sm-user-chip .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sm-primary), var(--sm-accent));
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.85rem;
}

.sm-content { padding: 24px 26px 40px; flex: 1; }

/* ---------- Cards / widgets ---------- */
.sm-card {
  background: #fff; border-radius: var(--sm-radius);
  box-shadow: var(--sm-shadow); border: 1px solid rgba(0,0,0,0.03);
}
.sm-card .card-header {
  background: transparent; border-bottom: 1px solid var(--sm-border);
  padding: 16px 20px; font-weight: 700;
}
.sm-card .card-body { padding: 20px; }

.stat-card {
  border-radius: var(--sm-radius); padding: 20px; color: #fff;
  position: relative; overflow: hidden; box-shadow: var(--sm-shadow-lg);
}
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 14px;
}
.stat-card h3 { font-weight: 800; margin-bottom: 2px; }
.stat-card p { margin: 0; opacity: 0.9; font-size: 0.85rem; }
.stat-card.c1 { background: linear-gradient(135deg, #4f46e5, #6d28d9); }
.stat-card.c2 { background: linear-gradient(135deg, #0ea5a4, #0891b2); }
.stat-card.c3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.stat-card.c4 { background: linear-gradient(135deg, #ec4899, #8b5cf6); }

.table-modern thead { background: #f8f9fc; }
.table-modern th { font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; color: #4b5563; border-bottom: 2px solid var(--sm-border); }
.table-modern td { vertical-align: middle; font-size: 0.9rem; }
.table-modern tbody tr:hover { background: #f8f9ff; }

.avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder {
  width: 36px; height: 36px; border-radius: 50%; background: var(--sm-bg);
  display: flex; align-items: center; justify-content: center; color: var(--sm-primary); font-weight: 700; font-size: 0.8rem;
}

.btn-primary { background: var(--sm-primary); border-color: var(--sm-primary); }
.btn-primary:hover { background: var(--sm-primary-dark); border-color: var(--sm-primary-dark); }
.btn-soft-primary { background: rgba(79,70,229,0.1); color: var(--sm-primary); border: none; }
.btn-soft-primary:hover { background: var(--sm-primary); color: #fff; }
.btn-soft-danger { background: rgba(239,68,68,0.1); color: #ef4444; border: none; }
.btn-soft-danger:hover { background: #ef4444; color: #fff; }
.btn-soft-success { background: rgba(16,185,129,0.1); color: #10b981; border: none; }
.btn-soft-success:hover { background: #10b981; color: #fff; }

.form-control, .form-select { border-radius: 10px; border-color: var(--sm-border); padding: 9px 14px; }
.form-control:focus, .form-select:focus { border-color: var(--sm-primary); box-shadow: 0 0 0 0.2rem rgba(79,70,229,0.15); }
.form-label { font-weight: 600; font-size: 0.85rem; margin-bottom: 5px; }

.modal-content { border-radius: var(--sm-radius); border: none; }
.modal-header { border-bottom: 1px solid var(--sm-border); }

/* Barcode / QR scanner */
#qr-reader { border-radius: var(--sm-radius); overflow: hidden; border: 3px solid var(--sm-primary); }
.scan-result-box {
  border-radius: var(--sm-radius); padding: 24px; text-align: center;
  border: 2px dashed var(--sm-border); background: #fafbff;
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1025;
}

@media (max-width: 991.98px) {
  .sm-sidebar { transform: translateX(-100%); }
  .sm-sidebar.show { transform: translateX(0); }
  .sm-main { margin-left: 0; }
  #sidebarToggle { display: inline-block; }
  .sidebar-overlay.show { display: block; }
}
