/* ============================
   KairoTech Portal — Global CSS
   Professional. Trustworthy. Mobile-First.
   ============================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Poppins:wght@500;600;700;800&display=swap");

/* ── CSS Variables ── */
:root {
  --gold: #f59e0b;
  --gold-dark: #d97706;
  --gold-soft: rgba(245, 158, 11, 0.1);
  --gold-border: rgba(245, 158, 11, 0.28);

  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --navy-600: #475569;

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --footer-h: 46px;

  --nav-text: #94a3b8;
  --surface: #f8fafc;
  --border: #e2e8f0;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.06);

  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  font-family: "Inter", sans-serif;
  background: var(--surface);
  color: var(--navy-800);
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Poppins", sans-serif;
  color: var(--navy-900);
}
a {
  text-decoration: none;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--navy-900);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
}

/* Brand */
.sidebar-brand {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  flex-shrink: 0;
}
.sidebar-logo {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2.5px solid var(--gold);
  background: var(--gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  overflow: hidden;
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.08);
  flex-shrink: 0;
}
/* !! Critical fix: constrain any uploaded logo image to the badge !! */
.sidebar-logo img {
  width: 58px !important;
  height: 58px !important;
  max-width: 58px !important;
  max-height: 58px !important;
  object-fit: contain;
  display: block;
}
.sidebar-brand-name {
  color: #f1f5f9;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.sidebar-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  padding: 3px 12px;
  border-radius: 20px;
}

/* Nav */
.sidebar nav {
  flex: 1;
  padding: 10px 0 8px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.sidebar nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.38);
  padding: 16px 22px 6px;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--nav-text);
  padding: 11px 22px;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}
.sidebar a i {
  font-size: 15px;
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar a:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
  border-left-color: rgba(245, 158, 11, 0.4);
}
.sidebar a.active {
  color: #fff;
  background: linear-gradient(
    90deg,
    rgba(245, 158, 11, 0.14) 0%,
    rgba(245, 158, 11, 0.04) 100%
  );
  border-left-color: var(--gold);
  font-weight: 600;
}
.sidebar a.active i,
.sidebar a:hover i {
  color: var(--gold);
}

/* User strip */
.user-strip {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--navy-900);
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 10px 20px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f87171;
  padding: 9px 0;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  border-left: none;
}
.sidebar-footer a:hover {
  color: #fca5a5;
  background: none;
  border-left: none;
}

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 1000;
  transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  font-size: 22px;
  cursor: pointer;
  color: var(--navy-800);
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1;
  transition: var(--transition);
}
.hamburger:hover {
  background: var(--surface);
}

/* ── Main Content ── */
.content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 28px 28px 70px; /* bottom pad for fixed footer */
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.portal-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--footer-h);
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 0 28px;
  font-size: 11.5px;
  color: var(--navy-600);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 99;
  transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.portal-footer .footer-brand {
  font-weight: 600;
  color: var(--navy-700);
}
.portal-footer .footer-trust {
  display: flex;
  gap: 16px;
  align-items: center;
}
.portal-footer .footer-trust span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.portal-footer .footer-trust i {
  color: #22c55e;
  font-size: 12px;
}

/* ── Cards ── */
.card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  background: #fff;
  transition:
    box-shadow 0.22s ease,
    transform 0.22s ease;
}
.card:hover {
  box-shadow: var(--shadow-md) !important;
}
.card-body {
  padding: 22px;
}

/* ── Buttons ── */
.btn {
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 18px;
  transition: var(--transition);
  letter-spacing: 0.1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--navy-900);
  border: none;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.28);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-dark) 0%, #b45309 100%);
  color: var(--navy-900);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.36);
}
.btn-gold:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  border-color: transparent !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.28) !important;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.36) !important;
}

.btn-outline-secondary {
  border-color: var(--border) !important;
  color: var(--navy-600) !important;
  background: #fff !important;
}
.btn-outline-secondary:hover {
  background: var(--surface) !important;
  border-color: var(--navy-600) !important;
  color: var(--navy-800) !important;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12.5px;
  border-radius: 8px;
}
.btn-lg {
  padding: 13px 28px;
  font-size: 15px;
  border-radius: 11px;
}

/* ── Forms ── */
.form-control,
.form-select {
  border-radius: 9px !important;
  border-color: var(--border) !important;
  padding: 10px 14px !important;
  font-size: 13.5px !important;
  color: var(--navy-800) !important;
  background: #fff !important;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14) !important;
  outline: none !important;
}
.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy-700);
  margin-bottom: 6px;
}
.input-group-text {
  border-radius: 9px 0 0 9px !important;
  border-color: var(--border) !important;
  background: #f8fafc !important;
  color: var(--navy-600) !important;
}
.input-group .form-control {
  border-radius: 0 9px 9px 0 !important;
}
.input-group .form-control:first-child {
  border-radius: 9px 0 0 9px !important;
}
.input-group .btn:last-child {
  border-radius: 0 9px 9px 0 !important;
}

/* ── Tables ── */
.table {
  font-size: 13.5px;
  color: var(--navy-800);
}
.table thead th {
  background: #f8fafc !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--navy-600);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  white-space: nowrap;
}
.table tbody td {
  vertical-align: middle;
  padding: 13px 16px;
  border-color: var(--border);
}
.table-hover tbody tr:hover {
  background: var(--surface);
}
.table-responsive {
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  overflow-x: auto;
}

/* ── Badges ── */
.badge {
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  letter-spacing: 0.4px;
}
.badge.bg-success {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #15803d !important;
}
.badge.bg-danger {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #b91c1c !important;
}
.badge.bg-warning {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #92400e !important;
}
.badge.bg-secondary {
  background: rgba(100, 116, 139, 0.12) !important;
  color: var(--navy-600) !important;
}
.badge.bg-primary {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #1d4ed8 !important;
}

/* ── Alerts ── */
.alert {
  border-radius: var(--radius);
  font-size: 13.5px;
  border: none;
  padding: 12px 16px;
}
.alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
  border-left: 3px solid #22c55e;
}
.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
  border-left: 3px solid #ef4444;
}
.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border-left: 3px solid var(--gold);
}

/* ── Modals ── */
.modal-content {
  border: none !important;
  border-radius: var(--radius-xl) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18) !important;
}
.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
}
.modal-body {
  padding: 22px 24px;
}
.modal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
}

/* ── Progress ── */
.progress {
  background: var(--border);
  border-radius: 50px;
  overflow: hidden;
}
.progress-bar {
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  border-radius: 50px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Stat icon box ── */
.dash-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-completed-bg {
  background: rgba(139, 92, 246, 0.1);
}
.dash-completed-icon {
  color: #7c3aed;
}
.font-poppins {
  font-family: "Poppins", sans-serif !important;
}

/* ── Admin badge (topbar) ── */
.admin-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(
    135deg,
    var(--gold-soft),
    rgba(245, 158, 11, 0.05)
  );
  color: var(--gold-dark);
  border: 1px solid var(--gold-border);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* ── Page-title header (inside content) ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-header h5 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy-900);
}
.page-header small {
  color: var(--navy-600);
  font-size: 12.5px;
}

/* ── Overlay ── */
#overlay {
  background: rgba(0, 0, 0, 0.45);
  z-index: 1040;
  backdrop-filter: blur(2px);
}

/* ── Toast ── */
.kt-toast {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 10000;
  background: var(--navy-900);
  color: #f1f5f9;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  border-left: 3px solid var(--gold);
}

/* ── Misc utilities ── */
.badge-xs {
  font-size: 10px !important;
  padding: 3px 8px;
}
.modal-doc-view {
  max-width: 360px;
  margin: 1.75rem auto;
}
.doc-preview-box {
  height: 110px;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--border);
}
.doc-preview-img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.doc-preview-img:hover {
  transform: scale(1.05);
}

/* ── Responsive — Tablets (≤ 1024px) ── */
@media (max-width: 1024px) {
  .content {
    padding: 22px 22px 70px;
  }
  .topbar {
    padding: 0 20px;
  }
}

/* ── Responsive — Small laptops (≤ 1280px) ── */
@media (max-width: 1280px) {
  :root {
    --sidebar-w: 220px;
  }
  .content {
    padding: 20px 20px 70px;
  }
  .table thead th {
    font-size: 10.5px;
    padding: 10px 10px;
  }
  .table tbody td {
    padding: 10px 10px;
    font-size: 12.5px;
  }
}

/* ── Responsive — Mobile (≤ 768px) ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.2);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .topbar {
    left: 0 !important;
    padding: 0 16px;
    transition: none;
  }
  .content {
    margin-left: 0 !important;
    padding: 16px 16px 70px;
  }
  .portal-footer {
    left: 0 !important;
    transition: none;
    padding: 0 16px;
    font-size: 11px;
  }
  .hamburger {
    display: flex;
  }
  .admin-badge span {
    display: none;
  }

  /* Stack dashboard stat cards */
  .col-6 {
    padding: 4px;
  }
  .dash-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  /* Better table scrolling on mobile */
  .table-responsive {
    font-size: 12.5px;
  }
  .table thead th {
    font-size: 10px;
    padding: 10px 12px;
  }
  .table tbody td {
    padding: 10px 12px;
  }

  /* Modals */
  .modal-dialog {
    margin: 12px;
  }
}

/* ── Responsive — Small phones (≤ 480px) ── */
@media (max-width: 480px) {
  .card-body {
    padding: 14px;
  }
  .portal-footer .footer-trust {
    display: flex;
    font-size: 10px;
    gap: 10px;
  }
  .page-header {
    flex-direction: column;
    gap: 8px;
  }
  .page-header .btn {
    width: 100%;
    justify-content: center;
  }
  .topbar {
    padding: 0 12px;
  }
  .content {
    padding: 12px 12px 70px;
  }
}
