/* ============================================================
   Umrah & Travel CRM — Premium Design System
   ============================================================ */
:root {
  --brand-900: #0b1f3a;
  --brand-800: #10294c;
  --brand-700: #16345f;
  --brand-primary: #1e5eff;
  --brand-primary-dark: #1447c9;
  --brand-gold: #c9a227;
  --surface: #f4f6fb;
  --card-radius: 16px;
  --sidebar-width: 264px;
  --topbar-height: 68px;
  --shadow-sm: 0 2px 8px rgba(16, 41, 76, .06);
  --shadow-md: 0 8px 24px rgba(16, 41, 76, .10);
  --shadow-lg: 0 20px 50px rgba(16, 41, 76, .16);
}

* { -webkit-tap-highlight-color: transparent; }

html { font-size: 15px; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: #24324a;
  overflow-x: hidden;
}

/* ---------- Sidebar ---------- */
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--brand-900) 0%, var(--brand-800) 60%, var(--brand-700) 100%);
  color: #cfe0ff;
  z-index: 1045;
  display: flex;
  flex-direction: column;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.app-sidebar::-webkit-scrollbar { width: 5px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-primary), #6ea8ff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.15rem;
  box-shadow: 0 6px 18px rgba(30,94,255,.4);
  flex-shrink: 0;
}
.sidebar-brand h5 { color: #fff; font-weight: 700; margin: 0; font-size: 1.05rem; letter-spacing: .2px; }
.sidebar-brand small { color: #8fa8d4; font-size: .7rem; text-transform: uppercase; letter-spacing: 1.2px; }

.sidebar-nav { padding: 14px 12px; flex: 1; }
.sidebar-nav .nav-label {
  font-size: .66rem; text-transform: uppercase; letter-spacing: 1.4px;
  color: #6d87b5; padding: 14px 12px 6px; font-weight: 600;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  color: #b9cdf2; padding: 10px 14px; border-radius: 10px;
  font-size: .92rem; font-weight: 500;
  margin-bottom: 2px;
  transition: background .18s, color .18s;
}
.sidebar-nav .nav-link i { width: 20px; text-align: center; font-size: .95rem; opacity: .85; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, var(--brand-primary), rgba(30,94,255,.75));
  color: #fff;
  box-shadow: 0 6px 16px rgba(30,94,255,.35);
}
.sidebar-nav .nav-link .nav-badge {
  margin-left: auto;
  background: #ff5b5b; color: #fff;
  font-size: .68rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .74rem; color: #6d87b5;
}

/* ---------- Topbar ---------- */
.app-topbar {
  position: fixed;
  top: 0; right: 0; left: var(--sidebar-width);
  height: var(--topbar-height);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e6ebf4;
  display: flex; align-items: center;
  padding: 0 24px;
  z-index: 1040;
  transition: left .28s cubic-bezier(.4,0,.2,1);
}
.topbar-toggle {
  border: 0; background: #eef2fa; color: var(--brand-800);
  width: 40px; height: 40px; border-radius: 10px;
  display: none; align-items: center; justify-content: center;
  font-size: 1rem;
}
.page-heading h4 { margin: 0; font-weight: 700; color: var(--brand-900); font-size: 1.15rem; }
.page-heading .breadcrumb { margin: 0; font-size: .74rem; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-bell {
  position: relative;
  width: 42px; height: 42px; border-radius: 12px;
  background: #eef2fa; color: var(--brand-800);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background .18s;
}
.topbar-bell:hover { background: #e0e8f7; color: var(--brand-primary); }
.topbar-bell .bell-count {
  position: absolute; top: -5px; right: -5px;
  background: #ff5b5b; color: #fff;
  font-size: .62rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
}
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  padding: 6px 10px; border-radius: 12px;
  transition: background .18s;
}
.topbar-user:hover { background: #eef2fa; }
.topbar-user .avatar {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-primary), #6ea8ff);
  color: #fff; font-weight: 700; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
}
.topbar-user .u-name { font-size: .86rem; font-weight: 600; color: var(--brand-900); line-height: 1.1; }
.topbar-user .u-role { font-size: .68rem; color: #7d8ba3; text-transform: uppercase; letter-spacing: .8px; }

/* ---------- Main content ---------- */
.app-main {
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 24px) 24px 40px;
  min-height: 100vh;
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}

/* ---------- Cards ---------- */
.card { border: 0; border-radius: var(--card-radius); box-shadow: var(--shadow-sm); }
.card-header {
  background: #fff; border-bottom: 1px solid #eef1f7;
  border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
  padding: 16px 20px;
  font-weight: 600;
}

/* Stat cards */
.stat-card {
  border-radius: var(--card-radius);
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 16px;
  transition: transform .2s, box-shadow .2s;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.55rem; font-weight: 800; color: var(--brand-900); line-height: 1.1; }
.stat-card .stat-label { font-size: .76rem; color: #7d8ba3; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.stat-card::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 100px; height: 100px; border-radius: 50%;
  background: currentColor; opacity: .04;
}
.si-blue   { background: #e7efff; color: var(--brand-primary); }
.si-green  { background: #e3f7ec; color: #159a5b; }
.si-orange { background: #fff2e2; color: #e08700; }
.si-red    { background: #ffe9e9; color: #e04343; }
.si-purple { background: #f1e9ff; color: #7b3ff2; }
.si-teal   { background: #e0f6f6; color: #0d9494; }
.si-gold   { background: #faf3dc; color: #b08d1e; }
.si-dark   { background: #e8ebf2; color: #33415c; }

/* ---------- Tables ---------- */
.table-premium { margin: 0; }
.table-premium thead th {
  background: #f8fafd;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .8px;
  color: #64748f; font-weight: 700;
  border-bottom: 1px solid #e6ebf4;
  padding: 12px 16px;
  white-space: nowrap;
}
.table-premium tbody td { padding: 12px 16px; vertical-align: middle; border-color: #f0f3f9; font-size: .88rem; }
.table-premium tbody tr { transition: background .15s; }
.table-premium tbody tr:hover { background: #f8faff; }

.badge-status { font-weight: 600; font-size: .7rem; padding: .38em .7em; border-radius: 7px; letter-spacing: .3px; }

/* Action icon buttons */
.btn-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: .8rem;
  border: 0;
  transition: transform .15s, filter .15s;
}
.btn-icon:hover { transform: translateY(-1px); filter: brightness(.94); }
.bi-view   { background: #e7efff; color: var(--brand-primary); }
.bi-edit   { background: #fff2e2; color: #e08700; }
.bi-delete { background: #ffe9e9; color: #e04343; }
.bi-wa     { background: #e3f7ec; color: #159a5b; }
.bi-call   { background: #f1e9ff; color: #7b3ff2; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: 10px;
  border-color: #dde4f0;
  padding: .55rem .85rem;
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 .2rem rgba(30,94,255,.12);
}
.form-label { font-weight: 600; font-size: .82rem; color: #46536b; margin-bottom: .35rem; }
.required-star { color: #e04343; }

.btn { border-radius: 10px; font-weight: 600; font-size: .88rem; }
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); }
.btn-primary:hover { background: var(--brand-primary-dark); border-color: var(--brand-primary-dark); }

/* ---------- Filters bar ---------- */
.filter-bar { background: #fff; border-radius: var(--card-radius); box-shadow: var(--shadow-sm); padding: 16px 20px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: #e6ebf4; }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -28px; top: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .55rem; color: var(--brand-primary);
}
.timeline-content { background: #f8fafd; border-radius: 12px; padding: 12px 16px; }

/* ---------- Journey period tabs ---------- */
.period-pill {
  border: 1px solid #dde4f0; background: #fff;
  border-radius: 30px; padding: 7px 18px;
  font-size: .84rem; font-weight: 600; color: #46536b;
  transition: all .18s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px;
}
.period-pill:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.period-pill.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; box-shadow: 0 5px 14px rgba(30,94,255,.3); }
.period-pill .count-chip { background: rgba(0,0,0,.1); border-radius: 12px; padding: 0 8px; font-size: .72rem; }
.period-pill.active .count-chip { background: rgba(255,255,255,.25); }

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-700) 55%, #1e5eff33 100%),
              radial-gradient(1000px 500px at 110% -10%, rgba(30,94,255,.35), transparent);
  background-color: var(--brand-900);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 430px;
  background: #fff; border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 40px 38px;
}

/* ---------- Pagination ---------- */
.pagination .page-link { border-radius: 9px !important; margin: 0 3px; border: 1px solid #e6ebf4; color: #46536b; font-size: .85rem; font-weight: 600; }
.pagination .page-item.active .page-link { background: var(--brand-primary); border-color: var(--brand-primary); }

/* ---------- Modal ---------- */
.modal-content { border: 0; border-radius: 18px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid #eef1f7; padding: 18px 24px; }
.modal-title { font-weight: 700; font-size: 1.02rem; }

/* Duplicate warning modal */
.dup-warning-icon {
  width: 68px; height: 68px; margin: 0 auto 14px;
  border-radius: 50%; background: #fff2e2; color: #e08700;
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
}

/* ---------- Toast ---------- */
.toast-container { z-index: 2000; }
.toast { border: 0; border-radius: 12px; box-shadow: var(--shadow-md); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 50px 20px; color: #8b98af; }
.empty-state i { font-size: 2.6rem; opacity: .35; margin-bottom: 14px; display: block; }

/* ---------- Sidebar overlay for mobile ---------- */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(11,31,58,.5);
  backdrop-filter: blur(2px);
  z-index: 1044; display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) {
  html { font-size: 14.5px; }
}
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.show { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-overlay.show { display: block; }
  .app-topbar { left: 0; }
  .app-main { margin-left: 0; padding: calc(var(--topbar-height) + 18px) 14px 30px; }
  .topbar-toggle { display: flex; }
  .topbar-user .u-meta { display: none; }
  .page-heading .breadcrumb { display: none; }
}
@media (max-width: 575.98px) {
  html { font-size: 14px; }
  .app-topbar { padding: 0 14px; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-card .stat-icon { width: 44px; height: 44px; font-size: 1.05rem; }
  .stat-card .stat-value { font-size: 1.3rem; }
  .login-card { padding: 30px 22px; }
  .card-header { padding: 14px 16px; }
}

/* ---------- Print ---------- */
@media print {
  .app-sidebar, .app-topbar, .no-print, .btn, .pagination, .filter-bar { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ---------- Utilities ---------- */
.cursor-pointer { cursor: pointer; }
.fw-semibold { font-weight: 600 !important; }
.text-brand { color: var(--brand-primary) !important; }
.min-w-0 { min-width: 0; }
.fade-in { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
