/* EAMS Global Styles */
:root {
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --primary: #4361ee;
  --primary-light: #eef0fd;
  --sidebar-bg: #1a1c2e;
  --sidebar-text: #9ba3c9;
  --sidebar-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.08);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Kantumruy Pro', sans-serif;
  font-size: 14px;
  background: #f4f6fb;
  color: #2d2f3e;
  margin: 0;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  overflow-y: auto;
  z-index: 1000;
  transition: width 0.25s ease;
  display: flex;
  flex-direction: column;
  padding: 0 0 20px;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-brand span { display: none; }
.sidebar.collapsed .sidebar-link { justify-content: center; }

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  min-height: var(--topbar-height);
}
.sidebar-divider { border-color: rgba(255,255,255,0.08); margin: 0 16px 8px; }
.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(155,163,201,0.6);
  text-transform: uppercase;
  padding: 8px 20px 4px;
  margin: 0;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: 8px;
  margin: 1px 10px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.sidebar-link i { font-size: 16px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--primary); color: #fff; }

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e9ecf3;
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 999;
  transition: left 0.25s ease;
}
.topbar.expanded { left: 64px; }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left 0.25s ease;
}
.main-content.expanded { margin-left: 64px; }

/* ── Cards ── */
.card {
  border: 1px solid #e9ecf3;
  border-radius: 12px;
  box-shadow: none;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid #e9ecf3;
  padding: 14px 20px;
  font-weight: 500;
}

/* ── Stat Cards ── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e9ecf3;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue  { background: #eef0fd; color: var(--primary); }
.stat-icon.green { background: #e8f8f0; color: #1db954; }
.stat-icon.red   { background: #fdecea; color: #e74c3c; }
.stat-icon.amber { background: #fef8e7; color: #f39c12; }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1; }
.stat-label { font-size: 12px; color: #8892a4; margin-top: 4px; }

/* ── Avatar ── */
.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.avatar-md {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 16px;
}

/* ── Badges ── */
.badge-present  { background: #d4edda; color: #155724; }
.badge-late     { background: #fff3cd; color: #856404; }
.badge-absent   { background: #f8d7da; color: #721c24; }
.badge-leave    { background: #d1ecf1; color: #0c5460; }
.badge-pending  { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }

/* ── Table ── */
.table th { font-weight: 500; color: #8892a4; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid #e9ecf3; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8f9ff; }

/* ── Buttons ── */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #3451d1; border-color: #3451d1; }

/* ── QR Display ── */
.qr-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.qr-timer {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.qr-status-bar {
  width: 240px;
  height: 6px;
  background: #e9ecf3;
  border-radius: 3px;
  overflow: hidden;
}
.qr-status-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 1s linear;
}
.qr-status-fill.warning { background: #f39c12; }
.qr-status-fill.danger  { background: #e74c3c; }

/* ── Login page ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1c2e 0%, #2d3158 100%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ── Check-in page ── */
.checkin-card {
  max-width: 480px;
  margin: 0 auto;
}
.gps-indicator {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #adb5bd;
  display: inline-block;
  margin-right: 6px;
}
.gps-indicator.active  { background: #1db954; animation: pulse 1.5s infinite; }
.gps-indicator.error   { background: #e74c3c; }

@keyframes pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── Utilities ── */
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.text-muted-sm { color: #8892a4; font-size: 12px; }
.hover-bg:hover { background: #f8f9ff; }
.xsmall { font-size: 11px; }
.cursor-pointer { cursor: pointer; }
.page-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.page-sub   { font-size: 13px; color: #8892a4; margin-bottom: 20px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .topbar { left: 0 !important; }
  .main-content { margin-left: 0 !important; padding: 16px; }
}
