/* ============================================================
   WFH Tracking System - ສຄຄຊ - Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Lao:wght@300;400;500;600;700&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

:root {
  --primary:    #1a3a5c;
  --primary-lt: #2563a8;
  --accent:     #e8a020;
  --accent-lt:  #f5c842;
  --success:    #16a34a;
  --danger:     #dc2626;
  --warning:    #d97706;
  --bg:         #f0f4f8;
  --card:       #ffffff;
  --border:     #d1dce8;
  --text:       #1e293b;
  --text-muted: #64748b;
  --sidebar-w:  260px;
  --header-h:   64px;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(26,58,92,.10);
  --shadow-lg:  0 8px 32px rgba(26,58,92,.14);
}

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

body {
  font-family: 'Noto Sans Lao', 'IBM Plex Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Login Page ─────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f2645 0%, #1a3a5c 50%, #1e4d7a 100%);
  padding: 20px;
}

.login-box {
  background: white;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--primary-lt));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 36px;
}

.login-box h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.login-box .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* ── Form Elements ──────────────────────────────────── */
.form-group { margin-bottom: 18px; text-align: left; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #f8fafc;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary-lt);
  box-shadow: 0 0 0 3px rgba(37,99,168,.12);
  background: #fff;
}

select.form-control { cursor: pointer; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .18s;
  white-space: nowrap;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-lt); }
.btn-accent    { background: var(--accent); color: #fff; }
.btn-accent:hover  { background: var(--accent-lt); color: #1a1a1a; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover  { filter: brightness(1.1); }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm        { padding: 6px 13px; font-size: 13px; }
.btn-block     { width: 100%; justify-content: center; padding: 13px; font-size: 16px; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s;
}

.sidebar-brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand h2 { font-size: 15px; font-weight: 700; line-height: 1.3; }
.sidebar-brand p  { font-size: 11px; opacity: .6; margin-top: 3px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: .45;
  margin-top: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .17s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; border-left-color: var(--accent); }
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 13px;
}
.sidebar-footer .user-name { font-weight: 600; }
.sidebar-footer .user-role { font-size: 11px; opacity: .6; }

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

.topbar {
  height: var(--header-h);
  background: #fff;
  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: 0 1px 4px rgba(0,0,0,.06);
}

.topbar-title { font-size: 18px; font-weight: 700; color: var(--primary); }
.topbar-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-body { padding: 28px; flex: 1; }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}
.card-header h3 { font-size: 16px; font-weight: 700; color: var(--primary); }
.card-body { padding: 24px; }

/* ── Stats Grid ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 18px;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; }
.stat-icon.green  { background: #dcfce7; }
.stat-icon.amber  { background: #fef3c7; }
.stat-icon.red    { background: #fee2e2; }
.stat-info .val   { font-size: 28px; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-info .lbl   { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Table ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: #f1f5f9; font-weight: 700; color: var(--primary); font-size: 13px; white-space: nowrap; }
tr:hover td { background: #f8fafc; }
td.center, th.center { text-align: center; }
td.num { text-align: right; font-weight: 600; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ── Attendance Button States ───────────────────────── */
.att-btn-wrap { display: flex; gap: 8px; flex-wrap: wrap; }

.att-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.att-btn.office     { background: #dbeafe; color: #1d4ed8; }
.att-btn.office:hover { background: #bfdbfe; }
.att-btn.office.active { background: #1d4ed8; color: #fff; cursor: default; }

.att-btn.meeting    { background: #fef3c7; color: #b45309; }
.att-btn.meeting:hover { background: #fde68a; }
.att-btn.meeting.active { background: #d97706; color: #fff; cursor: default; }

.att-btn.checkout   { background: #dcfce7; color: #15803d; }
.att-btn.checkout:hover { background: #bbf7d0; }
.att-btn.checkout.active { background: #16a34a; color: #fff; cursor: default; }
.att-btn:disabled   { opacity: .45; cursor: not-allowed; }

/* ── Filter Bar ─────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 18px 24px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ── Alert ──────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 18px;
  border-left: 4px solid;
}
.alert-danger  { background: #fee2e2; color: #b91c1c; border-color: var(--danger); }
.alert-success { background: #dcfce7; color: #15803d; border-color: var(--success); }
.alert-info    { background: #dbeafe; color: #1d4ed8; border-color: var(--primary-lt); }

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-box {
  background: white;
  border-radius: 14px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Misc ───────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-accent  { color: var(--accent); }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
