/* ============================================================
   Zarvionix Employment Promoter ERP — shared stylesheet
   Design tokens: navy #082B66, royal #0B3D91, sky #0EA5FF,
   gold #F2B600. Loaded by layouts/main.php on every page.
   ============================================================ */

:root {
  --navy: #082B66;
  --royal: #0B3D91;
  --sky: #0EA5FF;
  --gold: #F2B600;
  --ink: #33415c;
  --muted: #6b7a90;
  --line: #e5e9f2;
  --line-soft: #eef1f6;
  --page-bg: #f4f6fb;
}

html, body { overflow-x: clip; }
body {
  background: var(--page-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
}

/* ---------- Brand utilities ---------- */
.text-navy { color: var(--navy); }
.text-royal { color: var(--royal); }
.text-sky { color: var(--sky); }
.text-gold { color: var(--gold); }
.bg-navy { background-color: var(--navy) !important; }
.bg-royal { background-color: var(--royal) !important; }
.bg-sky { background-color: var(--sky) !important; }
.bg-gold { background-color: var(--gold) !important; }

/* ---------- Buttons ---------- */
.btn-navy {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.btn-navy:hover,
.btn-navy:focus {
  background: var(--royal);
  border-color: var(--royal);
  color: #fff;
}
.btn-outline-navy {
  color: var(--navy);
  border-color: var(--navy);
  background: transparent;
}
.btn-outline-navy:hover,
.btn-outline-navy:focus {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.btn-outline-primary {
  --bs-btn-color: var(--royal);
  --bs-btn-border-color: var(--royal);
  --bs-btn-hover-bg: var(--royal);
  --bs-btn-hover-border-color: var(--royal);
  --bs-btn-active-bg: var(--royal);
  --bs-btn-active-border-color: var(--royal);
  --bs-btn-disabled-color: var(--royal);
  --bs-btn-disabled-border-color: var(--royal);
}
.bg-primary { background-color: var(--royal) !important; }
.text-primary { color: var(--royal) !important; }
.link-primary { color: var(--royal) !important; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(8, 43, 102, .04);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 600;
  color: var(--navy);
}

/* ---------- Sidebar (navy) ---------- */
.sidebar {
  width: 260px;
  background: var(--navy);
  color: #fff;
  border-right: 1px solid var(--navy);
}
@media (min-width: 992px) {
  .sidebar {
    flex: 0 0 260px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}
.brand-tile {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
}
.brand-tile img {
  height: 56px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  width: 48px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  font-size: 1.4rem;
  flex: 0 0 auto;
}
.brand-name { font-weight: 800; letter-spacing: .02em; font-size: 1.02rem; line-height: 1.15; }
.brand-sub { font-size: .68rem; letter-spacing: .18em; color: #bcd0f2; font-weight: 600; }
.sidebar .nav-link {
  color: #d6e2f7;
  padding: .65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 44px;
  border-left: 3px solid transparent;
}
.sidebar .nav-link i { width: 1.25rem; text-align: center; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sidebar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border-left-color: var(--gold);
  font-weight: 600;
}
.sidebar-footer { color: #9db4dd !important; border-top: 1px solid rgba(255, 255, 255, .12); }

/* ---------- Topbar ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1020;
}
.page-context { font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.user-menu-btn { min-height: 44px; display: flex; align-items: center; gap: .5rem; }
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
}
.user-meta { flex-direction: column; align-items: flex-start; line-height: 1.1; }
.user-name { font-weight: 600; font-size: .9rem; color: var(--ink); }
.user-role { font-size: .72rem; color: var(--muted); text-transform: capitalize; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  min-height: 44px;
  font-size: 16px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--royal);
  box-shadow: 0 0 0 .25rem rgba(11, 61, 145, .15);
}
.btn { min-height: 44px; }
.btn-sm { min-height: 36px; }
input[type="date"], input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="password"], textarea, select { font-size: 16px; }
.date-preview { font-size: .8rem; color: var(--muted); margin-left: .35rem; }

/* ---------- Tables ---------- */
.table thead th { color: var(--navy); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.table td { vertical-align: middle; }

/* ---------- KPI / dashboard ---------- */
.kpi-card .card-body { padding: 1rem 1.15rem; }
.kpi-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kpi-value { font-size: 1.9rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.kpi-sub { font-size: .82rem; color: var(--muted); }
.chart-wrap { position: relative; height: 220px; }
.live-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #198754; margin-right: .35rem;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.activity-icon {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  background: #eef3fb; color: var(--royal);
  display: inline-flex; align-items: center; justify-content: center; font-size: .85rem;
}

/* ---------- Mobile tab bar ---------- */
.mobile-tabbar { display: none; }
@media (max-width: 991.98px) {
  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1030;
    background: #fff;
    border-top: 1px solid var(--line);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
  }
  .mobile-tabbar a {
    flex: 1 1 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .1rem;
    color: var(--muted);
    text-decoration: none;
    font-size: .68rem;
    min-height: 44px;
  }
  .mobile-tabbar a i { font-size: 1.15rem; }
  .mobile-tabbar a.active { color: var(--royal); }
  .mobile-tabbar a.new { color: var(--navy); }
  .mobile-tabbar .tabbar-plus {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--navy); color: #fff;
    display: flex; align-items: center; justify-content: center;
    margin-top: -1.4rem;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(8, 43, 102, .3);
  }
  .mobile-tabbar .tabbar-plus i { font-size: 1rem; }
  body { padding-bottom: 64px; }
}

/* ---------- Stacked tables on small screens ---------- */
@media (max-width: 767px) {
  .table-responsive table,
  .table-responsive thead,
  .table-responsive tbody,
  .table-responsive tr,
  .table-responsive td { display: block; width: 100%; }
  .table-responsive thead { display: none; }
  .table-responsive tbody tr {
    border: 1px solid var(--line);
    border-radius: .5rem;
    margin-bottom: .75rem;
    padding: .5rem .75rem;
    background: #fff;
  }
  .table-responsive td {
    border: none;
    padding: .3rem 0;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    text-align: right;
  }
  .table-responsive td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--navy);
    text-align: left;
  }
  .table-responsive td:first-child { text-align: right; }
}
