/* ==========================================================================
   TheNumberLoan — master stylesheet
   Professional fintech UI. Mobile-first.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #1a56db;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --secondary: #1e293b;
  --white: #ffffff;
  --bg-light: #f8fafc;
  --bg-page: #ffffff;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #0ea5e9;
  --info-light: #e0f2fe;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --text-dark: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --navbar-h: 64px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  color: var(--text-dark);
  background: #ffffff;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1,h2,h3,h4,h5,h6 { color: var(--secondary); margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }

/* Full-width content area — fills the screen with comfortable side padding. */
.container { width: 100%; max-width: none; margin: 0; padding: 0 30px; }
@media (max-width: 768px) { .container { padding: 0 20px; } }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}

/* ---------- Top navbar (horizontal, fixed) ---------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--navbar-h);
  background: var(--white); border-bottom: 1px solid var(--border); z-index: 1000;
  display: flex; align-items: center; padding: 0 30px; gap: 1rem;
}
@media (max-width: 768px) { .navbar { padding: 0 20px; } }
.navbar-brand {
  font-weight: 800; font-size: 1.4rem; letter-spacing: -0.02em; color: var(--primary);
  white-space: nowrap; display: flex; align-items: center; gap: .5rem;
}
.navbar-brand:hover { text-decoration: none; }
.navbar-nav {
  display: flex; gap: .25rem; align-items: center; flex: 1;
  justify-content: center; list-style: none; margin: 0; padding: 0;
}
.navbar-nav a {
  color: var(--text-muted); padding: .5rem .85rem; border-radius: var(--radius);
  font-size: .92rem; font-weight: 500; border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.navbar-nav a:hover { color: var(--primary); background: var(--bg-light); text-decoration: none; }
.navbar-nav a.active { color: var(--primary); border-bottom-color: var(--primary); border-radius: 0; }
.navbar-right { display: flex; align-items: center; gap: 1rem; margin-left: auto; }

.nav-icon-btn {
  position: relative; background: none; border: 0; cursor: pointer;
  color: var(--text-muted); font-size: 1.25rem; padding: .35rem; line-height: 1;
}
.nav-badge {
  position: absolute; top: -2px; right: -4px; background: var(--danger);
  color: #fff; font-size: .65rem; border-radius: 999px; padding: 1px 5px; font-weight: 600;
}

.navbar-toggle { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--secondary); }

/* ---------- Avatar + dropdown ---------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light);
  color: var(--primary); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .85rem; text-transform: uppercase;
}
.dropdown { position: relative; }
.dropdown-toggle { display: flex; align-items: center; gap: .5rem; background: none; border: 0; cursor: pointer; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; min-width: 200px;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: .4rem; display: none; z-index: 1100;
}
.dropdown-menu.open { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: block; width: 100%; text-align: left; padding: .55rem .75rem; border-radius: 6px;
  color: var(--text-dark); font-size: .9rem; background: none; border: 0; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-light); text-decoration: none; }
.dropdown-divider { height: 1px; background: var(--border); margin: .35rem 0; }

/* ---------- Page layout ---------- */
.page { padding-top: calc(var(--navbar-h) + 1.25rem); padding-bottom: 3rem; }

/* ---------- Breadcrumbs ---------- */
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text-light); margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb-sep { color: var(--text-light); }
.breadcrumb-current { color: var(--text-dark); font-weight: 500; }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 1.25rem; }
.card + .card { margin-top: 1.25rem; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; width: 100%; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg); padding: 24px;
  display: flex; align-items: center; gap: 1rem; transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.06); transform: translateY(-1px); }
.stat-card .stat-icon { font-size: 40px; line-height: 1; flex-shrink: 0; }
.stat-card .stat-body { min-width: 0; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--secondary); line-height: 1.1; }
.stat-card .stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin-top: .25rem; }
.stat-primary { border-left-color: var(--primary); }
.stat-success { border-left-color: var(--success); }
.stat-warning { border-left-color: var(--warning); }
.stat-danger { border-left-color: var(--danger); }
.stat-info { border-left-color: var(--info); }
.stat-purple { border-left-color: var(--purple); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: var(--bg-light); color: var(--text-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .3px; }
.table tbody tr:nth-child(even) { background: #fcfdfe; }
.table tbody tr:hover { background: var(--primary-light); }
.table td.actions { white-space: nowrap; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 500; color: var(--text-dark); margin-bottom: .4rem; }
.form-control, select.form-control, textarea.form-control {
  width: 100%; padding: .6rem .75rem; font-size: .95rem; font-family: inherit;
  color: var(--text-dark); background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-hint { font-size: .78rem; color: var(--text-light); margin-top: .3rem; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: .3rem; }
.required:after { content: " *"; color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.1rem; font-size: .92rem; font-weight: 600; font-family: inherit;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  transition: background .15s, opacity .15s; text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; opacity: .92; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-light { background: var(--bg-light); color: var(--text-dark); border-color: var(--border); }
.btn-sm { padding: .4rem .7rem; font-size: .82rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; font-weight: 600; }
.btn-block { width: 100%; }

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-block; padding: .25rem .6rem; font-size: .75rem; font-weight: 600;
  border-radius: 999px; line-height: 1.4;
}
.badge-success { background: var(--success-light); color: #047857; }
.badge-warning { background: var(--warning-light); color: #b45309; }
.badge-danger { background: var(--danger-light); color: #b91c1c; }
.badge-info { background: var(--info-light); color: #0369a1; }
.badge-muted { background: #e2e8f0; color: #475569; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* ---------- Alerts ---------- */
.alert { padding: .85rem 1rem; border-radius: var(--radius); border-left: 4px solid; margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: var(--success-light); border-color: var(--success); color: #065f46; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #92400e; }
.alert-danger { background: var(--danger-light); border-color: var(--danger); color: #991b1b; }
.alert-info { background: var(--info-light); border-color: var(--info); color: #075985; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none;
  align-items: center; justify-content: center; z-index: 1200; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-width: 520px; width: 100%; max-height: 90vh; overflow: auto;
}
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.25rem; }
.pagination a, .pagination span {
  padding: .45rem .75rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .85rem; color: var(--text-dark); background: #fff;
}
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination a:hover { background: var(--bg-light); text-decoration: none; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.tabs a, .tabs button {
  padding: .65rem 1rem; font-size: .9rem; font-weight: 500; color: var(--text-muted);
  border: 0; background: none; border-bottom: 2px solid transparent; cursor: pointer;
}
.tabs a.active, .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Search bar ---------- */
.search-bar { position: relative; flex: 0 1 320px; }
.search-bar input {
  width: 100%; padding: .5rem .75rem .5rem 2.1rem; border: 1px solid var(--border);
  border-radius: 999px; font-size: .9rem; background: var(--bg-light);
}
.search-bar input:focus { outline: none; border-color: var(--primary); background: #fff; }
.search-bar .search-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text-light); }

/* ---------- File upload (drag & drop) ---------- */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 2rem;
  text-align: center; color: var(--text-muted); cursor: pointer; transition: border-color .15s, background .15s;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-area .upload-icon { font-size: 2rem; margin-bottom: .5rem; }

/* ---------- Spinner ---------- */
.spinner {
  width: 22px; height: 22px; border: 3px solid var(--primary-light);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.65); display: none;
  align-items: center; justify-content: center; z-index: 1500;
}
.loading-overlay.open { display: flex; }
.loading-overlay .spinner { width: 42px; height: 42px; border-width: 5px; }

/* ---------- Toast ---------- */
.toast-container { position: fixed; top: calc(var(--navbar-h) + 12px); right: 16px; z-index: 1600; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  min-width: 260px; max-width: 360px; padding: .8rem 1rem; border-radius: var(--radius);
  color: #fff; box-shadow: var(--shadow-lg); font-size: .9rem; display: flex; align-items: center; gap: .5rem;
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state-icon { font-size: 2.6rem; margin-bottom: .75rem; opacity: .6; }
.empty-state-title { font-size: 1.05rem; font-weight: 600; color: var(--text-dark); margin-bottom: .3rem; }
.empty-state-msg { font-size: .9rem; }

/* ---------- OTP / MPIN inputs ---------- */
.code-input { display: flex; gap: .6rem; justify-content: center; margin: 1.25rem 0; }
.code-input input {
  width: 48px; height: 56px; text-align: center; font-size: 1.4rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--secondary);
}
.code-input input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.code-input.mpin input { -webkit-text-security: disc; text-security: disc; }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f1f5f9 100%); padding: 1.5rem;
}
.auth-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-width: 420px; width: 100%; padding: 2.25rem; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand .logo { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.auth-brand .sub { font-size: .78rem; letter-spacing: 2px; text-transform: uppercase; color: var(--text-light); }
.auth-step { display: none; }
.auth-step.active { display: block; }
.resend-timer { font-size: .82rem; color: var(--text-light); text-align: center; margin-top: .75rem; }

/* ---------- Timeline (lead stages) ---------- */
.timeline { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.timeline-step {
  flex: 1; min-width: 90px; text-align: center; padding: .6rem .4rem; border-radius: var(--radius);
  background: var(--bg-light); border: 1px solid var(--border); font-size: .75rem; color: var(--text-muted); position: relative;
}
.timeline-step.done { background: var(--success-light); border-color: var(--success); color: #047857; }
.timeline-step.current { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .navbar-toggle { display: block; }
  .navbar-nav {
    position: fixed; top: var(--navbar-h); left: 0; right: 0; background: #fff;
    flex-direction: column; align-items: stretch; padding: .5rem; gap: 0;
    box-shadow: var(--shadow-lg); display: none;
  }
  .navbar-nav.open { display: flex; }
  .navbar-nav a { border-bottom: 0; border-left: 3px solid transparent; }
  .navbar-nav a.active { border-left-color: var(--primary); border-bottom: 0; background: var(--primary-light); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}
