/* ════════════════════════════════════════════════════════════
   GeoAttendance — Application Stylesheet
   Bootstrap 5.3 + Custom Components
   ════════════════════════════════════════════════════════════ */

:root {
  --sidebar-width: 240px;
  --navbar-height: 60px;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --purple: #8b5cf6;
  --bg: #f8fafc;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: rgba(255,255,255,0.75);
  --sidebar-active: rgba(255,255,255,0.12);
  --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --transition: 0.22s ease;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  background: var(--bg);
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1040;
  transition: transform var(--transition);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 1.1rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: -0.01em;
}
.sidebar-brand i { font-size: 1.25rem; color: #a5b4fc; }

.nav-section-label {
  padding: .65rem 1.25rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 6px;
  margin: 1px .5rem;
  font-weight: 500;
  font-size: .82rem;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,.4);
}
.nav-item i { font-size: .95rem; flex-shrink: 0; }

/* ── Main Wrapper ─────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* ── Top Navbar ───────────────────────────────────────────── */
.top-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  height: var(--navbar-height);
  padding: 0 1.25rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.navbar-title { font-weight: 600; font-size: .9rem; color: #334155; }
.sidebar-toggle { color: #64748b; padding: .25rem .5rem; }
.sidebar-toggle:hover { color: var(--primary); }

.server-time { font-size: .78rem; color: #94a3b8; }

.avatar-sm {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
}
.main-footer { border-top: 1px solid #e2e8f0; }

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: .2rem;
  opacity: .85;
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: .72rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }

.stat-card-primary { border-left: 4px solid var(--primary); }
.stat-card-primary .stat-icon,
.stat-card-primary .stat-value { color: var(--primary); }

.stat-card-success { border-left: 4px solid var(--success); }
.stat-card-success .stat-icon,
.stat-card-success .stat-value { color: var(--success); }

.stat-card-info { border-left: 4px solid var(--info); }
.stat-card-info .stat-icon,
.stat-card-info .stat-value { color: var(--info); }

.stat-card-warning { border-left: 4px solid var(--warning); }
.stat-card-warning .stat-icon,
.stat-card-warning .stat-value { color: var(--warning); }

.stat-card-danger { border-left: 4px solid var(--danger); }
.stat-card-danger .stat-icon,
.stat-card-danger .stat-value { color: var(--danger); }

.stat-card-purple { border-left: 4px solid var(--purple); }
.stat-card-purple .stat-icon,
.stat-card-purple .stat-value { color: var(--purple); }

/* ── Quick Action Cards ───────────────────────────────────── */
.quick-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  text-decoration: none;
  color: #475569;
  font-weight: 500;
  font-size: .82rem;
  box-shadow: var(--card-shadow);
  transition: all .2s;
  border: 2px solid transparent;
  text-align: center;
}
.quick-action-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99,102,241,.15);
}
.quick-action-card i { font-size: 1.6rem; }

/* ── Auth ─────────────────────────────────────────────────── */
.auth-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}
.auth-wrapper { padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; border-radius: 16px; }
.auth-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 1.75rem;
  color: #fff;
}

/* ── GPS Status ───────────────────────────────────────────── */
.gps-status {
  padding: .5rem .75rem;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 500;
}
.gps-loading { background: #fef3c7; color: #92400e; }
.gps-ok      { background: #dcfce7; color: #166534; }
.gps-error   { background: #fee2e2; color: #991b1b; }

/* ── Pulse dot (active status) ────────────────────────────── */
.pulse-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  flex-shrink: 0;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.4); opacity: .6; }
}

/* ── Active session info ──────────────────────────────────── */
.active-session-info {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-radius: 10px;
  padding: .75rem 1rem;
  border-left: 4px solid var(--success);
}

/* ── Checkin panel ────────────────────────────────────────── */
.checkin-panel { border-top: 3px solid var(--primary); }

/* ── Badges custom ────────────────────────────────────────── */
.bg-purple { background-color: var(--purple) !important; }
.text-purple { color: var(--purple) !important; }

/* ── Tables ───────────────────────────────────────────────── */
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.table td { vertical-align: middle; }

/* ── Flash ────────────────────────────────────────────────── */
.flash-container { max-width: 100%; }

/* ── Sidebar Overlay (mobile) ─────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
}

/* ── Spin animation ───────────────────────────────────────── */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards generic ────────────────────────────────────────── */
.card { border-radius: 12px; }
.card-header { border-radius: 12px 12px 0 0 !important; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }
  .main-wrapper { margin-left: 0 !important; }
  .sidebar-overlay.show { display: block; }
  .main-content { padding: 1rem; }
}

@media (max-width: 575.98px) {
  .stat-value { font-size: 1.3rem; }
  .main-content { padding: .75rem; }
}

/* ── Utilities ────────────────────────────────────────────── */
.fw-medium { font-weight: 500 !important; }
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Sidebar collapsed (desktop) ─────────────────────────── */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main-wrapper { margin-left: 0; }
