/* =====================================================================
   Nugraj HR & Admin — HRMS Pro
   Premium glassmorphism theme · light + dark mode
   Display: Plus Jakarta Sans · Body: Inter
   Signature: indigo→violet gradient rail + frosted glass cards
   ===================================================================== */

:root {
  --brand-1: #4f46e5;      /* indigo  */
  --brand-2: #7c3aed;      /* violet  */
  --brand-3: #2563eb;      /* blue    */
  --grad-brand: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #2563eb 100%);
  --grad-blue:  linear-gradient(135deg, #2563eb 0%, #38bdf8 100%);
  --grad-purple:linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  --grad-green: linear-gradient(135deg, #059669 0%, #34d399 100%);
  --grad-amber: linear-gradient(135deg, #d97706 0%, #fbbf24 100%);

  --bg:        #eef1f8;
  --bg-2:      #e4e8f5;
  --surface:   rgba(255,255,255,0.72);
  --surface-solid: #ffffff;
  --border:    rgba(255,255,255,0.65);
  --border-2:  rgba(15,23,42,0.08);
  --text:      #1e293b;
  --text-muted:#64748b;
  --shadow:    0 10px 30px -12px rgba(30,41,59,0.28);
  --shadow-sm: 0 4px 14px -6px rgba(30,41,59,0.22);
  --radius:    18px;
  --radius-sm: 12px;
  --sidebar-w: 264px;
}

[data-theme="dark"] {
  --bg:        #0b1020;
  --bg-2:      #0f1630;
  --surface:   rgba(23,31,54,0.72);
  --surface-solid: #171f36;
  --border:    rgba(255,255,255,0.08);
  --border-2:  rgba(255,255,255,0.06);
  --text:      #e2e8f0;
  --text-muted:#94a3b8;
  --shadow:    0 14px 34px -14px rgba(0,0,0,0.6);
  --shadow-sm: 0 6px 18px -8px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 8% -5%, rgba(124,58,237,0.16), transparent 55%),
    radial-gradient(1000px 500px at 100% 0%, rgba(37,99,235,0.16), transparent 55%),
    radial-gradient(900px 500px at 50% 110%, rgba(79,70,229,0.10), transparent 55%);
  color: var(--text);
  min-height: 100vh;
  transition: background-color .3s ease, color .3s ease;
}

h1,h2,h3,h4,h5,h6,.h-font,.navbar-brand {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  letter-spacing: -0.01em;
}

a { text-decoration: none; }

/* ---------------- Glass card ---------------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.card.glass { color: var(--text); }

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

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  padding: 20px 14px;
  background: var(--grad-brand);
  color: #fff;
  overflow-y: auto;
  transition: transform .28s ease;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 8px; }

.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px;
}
.sidebar .brand .logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255,255,255,.16);
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  border: 1px solid rgba(255,255,255,.25);
}
.sidebar .brand b { font-family: 'Plus Jakarta Sans'; font-size: 17px; line-height: 1.1; }
.sidebar .brand small { opacity: .8; font-size: 10.5px; }

.nav-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  opacity: .6; margin: 16px 12px 6px; font-weight: 700;
}
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; color: rgba(255,255,255,.86);
  font-size: 14px; font-weight: 500; margin-bottom: 2px;
  transition: background .18s ease, transform .18s ease;
}
.side-link svg { width: 18px; height: 18px; flex: 0 0 18px; }
.side-link:hover { background: rgba(255,255,255,.12); color: #fff; transform: translateX(2px); }
.side-link.active { background: rgba(255,255,255,.20); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }

.main {
  flex: 1 1 auto;
  margin-left: var(--sidebar-w);
  min-width: 0;
  padding: 18px 22px 40px;
}

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; margin-bottom: 22px;
}
.topbar .page-title { font-size: 20px; font-weight: 700; margin: 0; }
.topbar .page-sub { font-size: 12.5px; color: var(--text-muted); margin: 0; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }

.avatar {
  width: 42px; height: 42px; border-radius: 12px; object-fit: cover;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: var(--grad-purple); font-size: 15px;
}
.avatar.lg { width: 84px; height: 84px; border-radius: 20px; font-size: 30px; }
.avatar.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }

/* ---------------- Stat cards ---------------- */
.stat-card { padding: 20px; position: relative; overflow: hidden; }
.stat-card .stat-ico {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  color: #fff; margin-bottom: 14px;
}
.stat-card .stat-ico svg { width: 22px; height: 22px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; font-family: 'Plus Jakarta Sans'; line-height: 1; }
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; margin-top: 6px; }
.bg-grad-blue   { background: var(--grad-blue); }
.bg-grad-purple { background: var(--grad-purple); }
.bg-grad-green  { background: var(--grad-green); }
.bg-grad-amber  { background: var(--grad-amber); }
.bg-grad-brand  { background: var(--grad-brand); }

/* ---------------- Soft badges ---------------- */
.badge { font-weight: 600; padding: .4em .7em; border-radius: 8px; }
.text-bg-success-soft   { background: rgba(5,150,105,.14);  color: #059669; }
.text-bg-danger-soft    { background: rgba(220,38,38,.14);  color: #dc2626; }
.text-bg-warning-soft   { background: rgba(217,119,6,.16);  color: #b45309; }
.text-bg-info-soft      { background: rgba(37,99,235,.14);  color: #2563eb; }
.text-bg-secondary-soft { background: rgba(100,116,139,.16);color: #64748b; }
[data-theme="dark"] .text-bg-warning-soft { color: #fbbf24; }

/* ---------------- Buttons ---------------- */
.btn { border-radius: 12px; font-weight: 600; }
.btn-brand {
  background: var(--grad-brand); border: none; color: #fff;
  box-shadow: 0 8px 20px -8px rgba(79,70,229,.7);
}
.btn-brand:hover { color: #fff; filter: brightness(1.05); transform: translateY(-1px); }
.btn-glass {
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
}
.btn-glass:hover { background: var(--surface-solid); color: var(--text); }

/* ---------------- Tables ---------------- */
.table-wrap { padding: 6px; }
.table { color: var(--text); margin: 0; }
.table > :not(caption) > * > * { background: transparent; color: var(--text); border-color: var(--border-2); }
.table thead th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 700; border-bottom: 1px solid var(--border-2);
}
.table tbody tr { transition: background .15s ease; }
.table-hover tbody tr:hover > * { background: rgba(124,58,237,.06); }

/* ---------------- Forms ---------------- */
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--text); }
.form-control, .form-select {
  border-radius: 12px; border: 1px solid var(--border-2);
  background: var(--surface-solid); color: var(--text); padding: .6rem .85rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-1); box-shadow: 0 0 0 4px rgba(79,70,229,.15);
  background: var(--surface-solid); color: var(--text);
}
.form-control::placeholder { color: var(--text-muted); opacity: .8; }

/* ---------------- Login ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 430px; padding: 38px 34px; }
.login-logo {
  width: 60px; height: 60px; border-radius: 18px; background: var(--grad-brand);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 24px;
  margin: 0 auto 18px; box-shadow: 0 12px 26px -10px rgba(79,70,229,.7);
}
.role-toggle { display: flex; gap: 8px; background: var(--bg-2); padding: 5px; border-radius: 14px; margin-bottom: 20px; }
.role-toggle button {
  flex: 1; border: none; background: transparent; padding: 9px; border-radius: 10px;
  font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all .18s ease;
}
.role-toggle button.active { background: var(--surface-solid); color: var(--brand-1); box-shadow: var(--shadow-sm); }

/* ---------------- Progress ---------------- */
.progress { height: 8px; border-radius: 20px; background: var(--border-2); }
.progress-bar { border-radius: 20px; background: var(--grad-brand); }

/* ---------------- Misc ---------------- */
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.section-sub { font-size: 12.5px; color: var(--text-muted); }
.divider { height: 1px; background: var(--border-2); margin: 16px 0; }
.text-muted-2 { color: var(--text-muted) !important; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border-2);
}

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 12px; }

/* Loading overlay */
#page-loader {
  position: fixed; inset: 0; background: var(--bg); z-index: 3000;
  display: grid; place-items: center; transition: opacity .4s ease;
}
.spinner-ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(124,58,237,.2); border-top-color: var(--brand-2);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Count-up entrance */
.animate-in { animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Toast */
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 4000; display: flex; flex-direction: column; gap: 10px; }
.toast-item {
  min-width: 260px; padding: 14px 16px; border-radius: 14px; color: #fff;
  box-shadow: var(--shadow); font-weight: 500; animation: slideIn .3s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast-item.success { background: linear-gradient(135deg,#059669,#10b981); }
.toast-item.danger  { background: linear-gradient(135deg,#dc2626,#ef4444); }
.toast-item.info    { background: linear-gradient(135deg,#2563eb,#3b82f6); }
.toast-item.warning { background: linear-gradient(135deg,#d97706,#f59e0b); }
@keyframes slideIn { from { transform: translateX(120%); } to { transform: none; } }

/* Sidebar mobile */
.sidebar-backdrop { display: none; }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .sidebar-backdrop.show {
    display: block; position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 1035;
  }
  .menu-toggle { display: grid !important; }
}
.menu-toggle { display: none; }

/* Webcam / face capture */
.cam-box {
  border-radius: var(--radius); overflow: hidden; background: #000;
  position: relative; aspect-ratio: 4/3;
}
.cam-box video, .cam-box canvas { width: 100%; height: 100%; object-fit: cover; }
.cam-frame {
  position: absolute; inset: 12%; border: 3px dashed rgba(255,255,255,.7);
  border-radius: 50%; pointer-events: none;
}

/* Map */
#gmap, .map-box { width: 100%; height: 300px; border-radius: var(--radius); }

.table-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
