/* Vista Engineers & Consultants — Attendance Management System */

/* ── CSS Variables ─────────────────────────────── */
:root {
  --vista-primary:   #1e3a5f;
  --vista-primary-d: #162c48;
  --vista-accent:    #2d6be4;
  --vista-success:   #1a8a4a;
  --vista-warning:   #c78100;
  --vista-danger:    #c0392b;
  --vista-bg:        #f0f2f5;
  --vista-card-bg:   #ffffff;
  --sidebar-width:   250px;
  --navbar-h:        56px;
}

/* ── Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--vista-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #2d3748;
  min-height: 100vh;
}

/* ── Offline Banner ────────────────────────────── */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #c0392b; color: #fff;
  text-align: center; padding: 6px 12px;
  font-size: .85rem; font-weight: 600;
}

/* ── Navbar ─────────────────────────────────────── */
.vista-navbar {
  background: var(--vista-primary);
  height: var(--navbar-h);
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1040;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.brand-vista { color: #ffffff; font-size: 1.2rem; letter-spacing: .05em; }
.brand-sub   { color: rgba(255,255,255,.75); font-size: .85rem; }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  color: #fff; font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}

.notif-badge {
  position: absolute; top: 0; right: 0;
  background: #e53e3e; color: #fff;
  font-size: .65rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--vista-primary);
  padding: 0 2px;
}

.notif-dropdown { border-radius: 10px; border: 1px solid #e2e8f0; }
.notif-dropdown .dropdown-header {
  background: #f8fafc; font-size: .85rem;
  border-bottom: 1px solid #e2e8f0; padding: 10px 14px;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--navbar-h); left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--vista-primary);
  z-index: 1030;
  display: flex; flex-direction: column;
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-brand { border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  color: #fff; font-size: 1.1rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 1rem; }
.sidebar-nav .nav-section-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  color: rgba(255,255,255,.45); text-transform: uppercase;
  padding: 1rem 1rem .25rem;
}
.sidebar-nav .nav-link {
  color: rgba(255,255,255,.8);
  border-radius: 8px; margin-bottom: 2px;
  padding: .55rem .75rem; font-size: .88rem;
  transition: background .15s;
}
.sidebar-nav .nav-link:hover  { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.sidebar-footer { padding: .75rem 1rem; border-top: 1px solid rgba(255,255,255,.1); }

/* Mobile sidebar hidden */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 1029;
  }
  .sidebar-overlay.open { display: block; }
}

/* ── Main Layout ─────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  padding-top: var(--navbar-h);
  min-height: 100vh;
}
@media (max-width: 991.98px) {
  .main-wrapper { margin-left: 0; }
}

/* Employee has no sidebar */
.employee-wrapper {
  padding-top: var(--navbar-h);
  padding-bottom: 80px; /* bottom nav */
  min-height: 100vh;
}

.page-content { padding: 1.5rem; }

/* ── Cards ────────────────────────────────────────── */
.card {
  background: var(--vista-card-bg);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  padding: .85rem 1.25rem;
}

/* Stat Cards */
.stat-card {
  border-radius: 12px; border: 1px solid #e2e8f0;
  background: var(--vista-card-bg);
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: #718096; font-weight: 500; }

/* ── Checkin Button ───────────────────────────────── */
.checkin-btn-wrap { text-align: center; padding: 2rem 1rem; }
.checkin-btn {
  width: 180px; height: 180px;
  border-radius: 50%;
  border: none;
  font-size: 1.25rem; font-weight: 700;
  letter-spacing: .05em;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 6px 24px rgba(0,0,0,.2);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  margin: 0 auto;
}
.checkin-btn:active { transform: scale(.96); }
.checkin-btn.btn-checkin  { background: linear-gradient(135deg, #1a8a4a, #22a05e); color: #fff; }
.checkin-btn.btn-checkout { background: linear-gradient(135deg, #c0392b, #e53e3e); color: #fff; }
.checkin-btn.btn-disabled { background: #cbd5e0; color: #718096; cursor: not-allowed; }
.checkin-btn i { font-size: 2.5rem; }

/* ── Bottom Nav (Employee) ────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--vista-card-bg);
  border-top: 1px solid #e2e8f0;
  display: flex;
  z-index: 1030;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; text-decoration: none;
  color: #718096; font-size: .7rem; font-weight: 500;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item i { font-size: 1.35rem; }
.bottom-nav-item.active { color: var(--vista-primary); }
.bottom-nav-item:hover  { color: var(--vista-accent); }

/* ── Tables ───────────────────────────────────────── */
.table thead th {
  background: #f8fafc; font-size: .82rem;
  font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: #4a5568;
  border-bottom: 2px solid #e2e8f0;
}
.table td { vertical-align: middle; font-size: .88rem; }
.table-hover tbody tr:hover { background: #f7faff; }

/* ── Badges ───────────────────────────────────────── */
.badge { font-size: .75rem; font-weight: 600; }

/* ── Forms ────────────────────────────────────────── */
.form-label { font-size: .85rem; font-weight: 600; color: #4a5568; }
.form-control, .form-select {
  border: 1.5px solid #cbd5e0;
  border-radius: 8px;
  padding: .5rem .75rem;
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--vista-accent);
  box-shadow: 0 0 0 3px rgba(45,107,228,.15);
  outline: none;
}

/* ── Buttons ──────────────────────────────────────── */
.btn-primary {
  background: var(--vista-primary); border-color: var(--vista-primary);
}
.btn-primary:hover { background: var(--vista-primary-d); border-color: var(--vista-primary-d); }
.btn { border-radius: 8px; font-size: .88rem; font-weight: 500; }

/* ── Login Page ───────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--vista-primary) 0%, #2d6be4 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.login-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%; max-width: 420px;
  padding: 2.5rem;
}
.login-logo {
  width: 64px; height: 64px;
  background: var(--vista-primary);
  border-radius: 16px;
  color: #fff; font-size: 1.8rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
}

/* ── GPS Status ───────────────────────────────────── */
.gps-status {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem;
  border-radius: 10px;
  font-size: .88rem;
}
.gps-status.acquiring { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.gps-status.acquired  { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.gps-status.error     { background: #fff5f5; color: #9b2c2c; border: 1px solid #feb2b2; }
.gps-pulse { animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Status Dashboard Card ─────────────────────────── */
.status-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: .75rem; padding: 1rem;
}
.status-info-item label {
  display: block; font-size: .75rem; font-weight: 600;
  color: #718096; text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: .15rem;
}
.status-info-item span { font-size: .95rem; font-weight: 600; color: #2d3748; }

/* ── Map ──────────────────────────────────────────── */
#location-map { height: 400px; border-radius: 10px; }
#admin-map    { height: 500px; border-radius: 10px; }

/* ── Scrollable table wrapper ─────────────────────── */
.table-scroll { overflow-x: auto; }
@media (max-width: 767.98px) {
  .table-responsive-cards .card-rows { display: flex; flex-direction: column; gap: .5rem; }
}

/* ── Page header ──────────────────────────────────── */
.page-header {
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: .75rem;
  margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }

/* ── Utils ────────────────────────────────────────── */
.text-vista { color: var(--vista-primary); }
.bg-vista   { background: var(--vista-primary); }
.rounded-xl { border-radius: 12px; }
.shadow-sm-card { box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.fw-semibold { font-weight: 600; }
