/* ============================================================
   ATTENDANCE MANAGEMENT SYSTEM — Modern UI
   ============================================================ */

:root {
  --sidebar-w: 252px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active-bg: rgba(99,102,241,0.18);
  --sidebar-active-text: #a5b4fc;
  --sidebar-border: rgba(255,255,255,0.07);

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-subtle: rgba(79,70,229,0.09);

  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  --green:  #10b981; --green-bg:  rgba(16,185,129,0.10);
  --yellow: #f59e0b; --yellow-bg: rgba(245,158,11,0.12);
  --red:    #ef4444; --red-bg:    rgba(239,68,68,0.10);
  --blue:   #3b82f6; --blue-bg:   rgba(59,130,246,0.10);
  --indigo: #6366f1; --indigo-bg: rgba(99,102,241,0.10);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);

  --ease: 0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-x: hidden;
}

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed; top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform var(--ease);
  overflow: hidden auto;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
}
.sidebar-icon {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.95rem; flex-shrink: 0;
}
.brand-name { font-size: 0.9rem; font-weight: 700; color: #f1f5f9; line-height: 1.25; }
.brand-sub  { font-size: 0.68rem; color: var(--sidebar-text); opacity: 0.7; }

.sidebar-nav { padding: 10px 8px; flex: 1; }
.nav-group-label {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: rgba(255,255,255,0.25);
  padding: 14px 10px 5px;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.84rem; font-weight: 500;
  margin-bottom: 1px;
  transition: background var(--ease), color var(--ease);
  position: relative;
}
.sidebar-nav .nav-link:hover  { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar-nav .nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}
.sidebar-nav .nav-link.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--indigo); border-radius: 0 2px 2px 0;
}
.sidebar-nav .nav-link i { font-size: 1rem; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 10px 8px 12px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
}
.user-avatar {
  width: 30px; height: 30px;
  background: var(--primary); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 0.8rem; font-weight: 600; color: #e2e8f0; line-height: 1.2; }
.user-role { font-size: 0.68rem; color: var(--sidebar-text); }
.sidebar-logout {
  margin-left: auto;
  color: rgba(255,255,255,0.3);
  font-size: 0.95rem;
  transition: color var(--ease);
  padding: 4px;
  text-decoration: none;
}
.sidebar-logout:hover { color: rgba(255,255,255,0.75); }

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

/* ── Topbar ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 58px;
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-toggle {
  display: none;
  background: none; border: none;
  color: var(--text-2); font-size: 1.1rem;
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.topbar-toggle:hover { background: var(--primary-subtle); color: var(--primary); }
.topbar-title { font-size: 0.95rem; font-weight: 600; flex: 1; }
.topbar-meta  { font-size: 0.78rem; color: var(--text-3); margin-right: 4px; }
.btn-topbar {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  text-decoration: none; cursor: pointer;
  transition: all var(--ease);
}
.btn-topbar:hover { border-color: #94a3b8; color: var(--text); background: var(--bg); }
.btn-topbar.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }

/* ── Page ── */
.page { padding: 22px 24px; flex: 1; }
.page-header { margin-bottom: 20px; }
.page-header h1 {
  font-size: 1.3rem; font-weight: 700;
  color: var(--text); margin: 0 0 3px;
  letter-spacing: -0.02em;
}
.page-header p { color: var(--text-2); font-size: 0.84rem; margin: 0; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
}
.card-body { padding: 20px; }
.card-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header-bar .card-title { font-weight: 600; font-size: 0.9rem; margin: 0; }

/* ── Stat Cards ── */
.stat-card {
  border-radius: var(--radius-lg) !important;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow) !important; }
.stat-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.stat-icon.indigo { background: var(--indigo-bg); color: var(--indigo); }
.stat-icon.green  { background: var(--green-bg);  color: var(--green);  }
.stat-icon.yellow { background: var(--yellow-bg); color: var(--yellow); }
.stat-icon.blue   { background: var(--blue-bg);   color: var(--blue);   }
.stat-icon.red    { background: var(--red-bg);     color: var(--red);    }
.stat-val { font-size: 1.7rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.stat-lbl { font-size: 0.75rem; color: var(--text-2); font-weight: 500; margin-top: 2px; }

/* ── Status Pills ── */
.status-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.status-pill {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 110px;
  padding: 14px 16px;
  border-radius: 10px;
}
.status-pill.present { background: var(--green-bg); }
.status-pill.late    { background: var(--yellow-bg); }
.status-pill.absent  { background: var(--red-bg); }
.sp-icon  { font-size: 1.15rem; }
.sp-count { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.sp-label { font-size: 0.72rem; font-weight: 600; opacity: 0.8; }
.status-pill.present .sp-icon, .status-pill.present .sp-label { color: var(--green); }
.status-pill.present .sp-count { color: #065f46; }
.status-pill.late .sp-icon, .status-pill.late .sp-label { color: var(--yellow); }
.status-pill.late .sp-count { color: #92400e; }
.status-pill.absent .sp-icon, .status-pill.absent .sp-label { color: var(--red); }
.status-pill.absent .sp-count { color: #991b1b; }

/* ── Table ── */
.table { font-size: 0.84rem; margin-bottom: 0; }
.table thead th {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3);
  background: #f8fafc;
  border-bottom: 1px solid var(--border) !important;
  padding: 10px 14px;
  white-space: nowrap;
}
.table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: var(--text);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover td { background: #f8fafc; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 0.7rem; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  letter-spacing: 0.01em;
}
.badge-present  { background: var(--green-bg);  color: #065f46; }
.badge-late     { background: var(--yellow-bg); color: #92400e; }
.badge-absent   { background: var(--red-bg);    color: #991b1b; }
.badge-active   { background: var(--green-bg);  color: #065f46; }
.badge-inactive { background: #f1f5f9;           color: #64748b; }
.badge-in       { background: var(--green-bg);  color: #065f46; }
.badge-out      { background: #f1f5f9;           color: #64748b; }
.badge-primary  { background: var(--indigo-bg); color: var(--primary); }

/* ── Forms ── */
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem; padding: 8px 11px;
  color: var(--text);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.10);
  outline: none;
}
.form-text { font-size: 0.73rem; color: var(--text-3); margin-top: 3px; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ── Buttons ── */
.btn {
  border-radius: var(--radius-sm);
  font-size: 0.84rem; font-weight: 500;
  padding: 8px 16px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all var(--ease); cursor: pointer;
}
.btn-sm  { padding: 5px 11px; font-size: 0.78rem; }
.btn-lg  { padding: 11px 22px; font-size: 0.9rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-dark { background: var(--text); border-color: var(--text); color: #fff; }
.btn-dark:hover { background: #1e293b; border-color: #1e293b; color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }
.btn-outline-dark  { border: 1px solid #cbd5e1; color: var(--text-2); background: transparent; }
.btn-outline-dark:hover  { background: var(--text); border-color: var(--text); color: #fff; }
.btn-outline-primary { border: 1px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-outline-secondary { border: 1px solid var(--border); color: var(--text-2); background: transparent; }
.btn-outline-secondary:hover { background: var(--bg); border-color: #94a3b8; color: var(--text); }
.btn-outline-danger { border: 1px solid #fca5a5; color: var(--red); background: transparent; }
.btn-outline-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ── Filter tabs ── */
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  padding: 5px 14px; border-radius: 6px;
  font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  text-decoration: none; cursor: pointer;
  transition: all var(--ease);
}
.filter-tab:hover { border-color: #94a3b8; color: var(--text); }
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-tab.present.active { background: var(--green);  border-color: var(--green); }
.filter-tab.late.active    { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.filter-tab.absent.active  { background: var(--red);    border-color: var(--red); }

/* ── Pagination ── */
.pager-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  gap: 10px; flex-wrap: wrap;
}
.pager-info { font-size: 0.78rem; color: var(--text-2); }
.pagination { margin: 0; gap: 3px; flex-wrap: wrap; }
.pagination .page-item .page-link {
  border: 1px solid var(--border);
  color: var(--text-2); font-size: 0.78rem;
  padding: 5px 10px; border-radius: 6px !important;
  background: var(--surface); line-height: 1.4;
  transition: all var(--ease);
}
.pagination .page-item .page-link:hover {
  background: var(--primary-subtle); border-color: var(--primary); color: var(--primary);
}
.pagination .page-item.active .page-link {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}
.pagination .page-item.disabled .page-link { opacity: 0.4; cursor: not-allowed; }

/* ── Alerts ── */
.alert {
  border: 0 !important; border-radius: var(--radius) !important;
  font-size: 0.84rem; padding: 11px 16px;
}
.alert-success { background: var(--green-bg);  color: #065f46; border-left: 3px solid var(--green) !important; }
.alert-danger  { background: var(--red-bg);    color: #991b1b; border-left: 3px solid var(--red) !important; }
.alert-info    { background: var(--blue-bg);   color: #1e40af; border-left: 3px solid var(--blue) !important; }
.alert-warning { background: var(--yellow-bg); color: #92400e; border-left: 3px solid var(--yellow) !important; }

/* ── Search bar ── */
.search-wrap { position: relative; }
.search-wrap .search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3); pointer-events: none; font-size: 0.85rem;
}
.search-wrap input { padding-left: 32px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: 8px; opacity: 0.4; }
.empty-state p { font-size: 0.84rem; margin: 0; }

/* ── Info box ── */
.info-box {
  background: var(--blue-bg);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 11px 15px; font-size: 0.8rem; color: #1e40af;
}

/* ── Login ── */
body.login-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #0f172a 100%);
}
.login-card {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px;
  overflow: hidden;
}
.login-head {
  background: var(--primary);
  padding: 26px 28px 22px;
  text-align: center;
}
.login-logo {
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px; font-size: 1.4rem; color: #fff;
}
.login-head h1 { font-size: 1.1rem; font-weight: 700; color: #fff; margin: 0 0 3px; }
.login-head p  { font-size: 0.78rem; color: rgba(255,255,255,0.7); margin: 0; }
.login-body { padding: 26px 28px; }

/* ── Misc ── */
.divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.text-xs { font-size: 0.72rem !important; }
.text-sm { font-size: 0.8rem !important; }
.fw-600  { font-weight: 600 !important; }
code {
  font-size: 0.78rem; color: #7c3aed;
  background: #f5f3ff; padding: 2px 6px; border-radius: 4px;
}

/* Bootstrap overrides */
.bg-success-subtle { background: var(--green-bg)  !important; }
.bg-warning-subtle { background: var(--yellow-bg) !important; }
.bg-danger-subtle  { background: var(--red-bg)    !important; }
.bg-info-subtle    { background: var(--blue-bg)   !important; }

/* ── Responsive ── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
  }
  .main { margin-left: 0; }
  .topbar-toggle { display: block; }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999; display: none;
  }
  .sidebar-overlay.show { display: block; }
}
@media (max-width: 576px) {
  .page { padding: 14px 16px; }
  .topbar { padding: 0 14px; }
  .status-row { flex-direction: column; }
}

