/* ============================================================
   ATTENDANCE ERP — SHARED LIGHT THEME CSS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --primary:    #4f46e5;
  --primary-lt: #eef2ff;
  --primary-dk: #3730a3;
  --cyan:       #0891b2;
  --cyan-lt:    #ecfeff;
  --green:      #059669;
  --green-lt:   #d1fae5;
  --amber:      #d97706;
  --amber-lt:   #fef3c7;
  --red:        #dc2626;
  --red-lt:     #fee2e2;
  --half:       #7c3aed;
  --half-lt:    #ede9fe;

  --bg:         #f1f5f9;
  --white:      #ffffff;
  --border:     #e2e8f0;
  --border2:    #cbd5e1;
  --text:       #1e293b;
  --text-md:    #475569;
  --muted:      #94a3b8;
  --sidebar-w:  240px;
  --header-h:   64px;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow:     0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:  0 10px 40px rgba(0,0,0,0.12);
}

html { font-size: 14px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}
.sidebar-logo-text h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.sidebar-logo-text span {
  font-size: 0.7rem;
  color: var(--muted);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-md);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}
.nav-item:hover {
  background: var(--primary-lt);
  color: var(--primary);
}
.nav-item.active {
  background: var(--primary-lt);
  color: var(--primary);
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   TOP HEADER
   ============================================================ */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-left h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.topbar-left p { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-date {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-md);
  font-weight: 500;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  padding: 24px 28px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.purple  { background: var(--primary-lt); }
.stat-icon.green   { background: var(--green-lt);   }
.stat-icon.red     { background: var(--red-lt);     }
.stat-icon.amber   { background: var(--amber-lt);   }
.stat-icon.cyan    { background: var(--cyan-lt);    }
.stat-body h3 { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-body .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1.1; margin-top: 2px; }
.stat-body .stat-sub { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2 { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.card-body { padding: 20px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.18s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,0.35); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #047857; transform: translateY(-1px); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #b91c1c; transform: translateY(-1px); }
.btn-amber { background: var(--amber); color: #fff; }
.btn-amber:hover { background: #b45309; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border2);
  color: var(--text-md);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lt); }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-xs { padding: 3px 8px; font-size: 0.72rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th {
  background: #f8fafc;
  padding: 11px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbff; }
tfoot td {
  padding: 12px 14px;
  font-weight: 700;
  background: #f8fafc;
  border-top: 2px solid var(--border);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.badge-green  { background: var(--green-lt);   color: #065f46; }
.badge-red    { background: var(--red-lt);     color: #991b1b; }
.badge-amber  { background: var(--amber-lt);   color: #92400e; }
.badge-purple { background: var(--half-lt);    color: #5b21b6; }
.badge-blue   { background: var(--primary-lt); color: var(--primary-dk); }
.badge-gray   { background: #f1f5f9; color: var(--muted); }

/* ============================================================
   ATTENDANCE MARK BUTTONS
   ============================================================ */
.att-btn-group { display: flex; gap: 5px; }
.att-btn {
  min-width: 38px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
}
.att-btn.P { background: var(--green-lt); color: var(--green); border-color: #a7f3d0; }
.att-btn.P:hover, .att-btn.P.active { background: var(--green); color: #fff; border-color: var(--green); transform: scale(1.05); }
.att-btn.A { background: var(--red-lt); color: var(--red); border-color: #fca5a5; }
.att-btn.A:hover, .att-btn.A.active { background: var(--red); color: #fff; border-color: var(--red); transform: scale(1.05); }
.att-btn.H { background: var(--half-lt); color: var(--half); border-color: #c4b5fd; }
.att-btn.H:hover, .att-btn.H.active { background: var(--half); color: #fff; border-color: var(--half); transform: scale(1.05); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.78rem; font-weight: 600; color: var(--text-md); }
.form-control {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--white);
  transition: all 0.18s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 420px;
  max-width: 95vw;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: #f1f5f9; border: none; border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--muted); transition: all 0.15s;
}
.modal-close:hover { background: var(--red-lt); color: var(--red); }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  display: flex; align-items: center; gap: 10px;
  font-size: 0.85rem; font-weight: 500;
  min-width: 260px; max-width: 340px;
  animation: slideIn 0.3s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--amber); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(110%); opacity: 0; } }
.toast.hiding { animation: slideOut 0.3s ease forwards; }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.ml-auto { margin-left: auto; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.8rem; }
.fw-700 { font-weight: 700; }
.text-center { text-align: center; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Avatar */
.worker-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
  flex-shrink: 0;
}

/* Empty state */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-md); margin-bottom: 6px; }
.empty-state p { font-size: 0.82rem; }

/* Loading spinner */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Today highlight */
.today-pill {
  background: var(--primary-lt);
  color: var(--primary);
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}

/* Section header */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 { font-size: 1rem; font-weight: 700; }
