/* ===================================================
   EduLead Pro — College Lead Management System
   Premium Design System
=================================================== */

:root {
  --brand-bg: #0f1117;
  --brand-surface: #161b27;
  --brand-border: #1e2535;
  --brand-accent: #4f8ef7;
  --brand-accent-light: #6ba3ff;
  --brand-accent-glow: rgba(79,142,247,0.15);
  --brand-text: #e8edf5;
  --brand-muted: #7a8499;
  --brand-success: #22c55e;
  --brand-warning: #f59e0b;
  --brand-danger: #ef4444;
  --brand-hot: #ff6b35;
  --page-bg: #f0f3f9;
  --card-bg: #ffffff;
  --card-shadow: 0 2px 12px rgba(0,0,0,0.06);
  --text-primary: #1a2035;
  --text-muted: #6b7280;
  --border-light: #e5e9f2;
  --sidebar-w: 256px;
  --header-h: 60px;
  --radius: 12px;
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-main);
  background: var(--page-bg);
  color: var(--text-primary);
  display: flex;
  overflow-x: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--brand-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width 0.3s ease, transform 0.3s ease;
  overflow: hidden;
  border-right: 1px solid var(--brand-border);
}
.sidebar.collapsed { width: 68px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--brand-border);
  min-height: 68px;
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand-accent) 0%, #7b5ea7 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
  flex-shrink: 0;
}
.brand-name { font-size: 16px; font-weight: 800; color: var(--brand-text); letter-spacing: -0.3px; }
.brand-tagline { font-size: 10px; font-weight: 600; color: var(--brand-accent); letter-spacing: 2px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; overflow-x: hidden; }
.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--brand-muted);
  padding: 12px 8px 6px;
  white-space: nowrap; overflow: hidden;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px; border-radius: 8px;
  color: var(--brand-muted); font-size: 14px; font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--brand-border); color: var(--brand-text); }
.nav-item.active { background: var(--brand-accent-glow); color: var(--brand-accent); }
.nav-item.active .nav-icon { color: var(--brand-accent); }
.nav-item-danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; }
.nav-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--brand-border);
}
.user-card { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-accent), #7b5ea7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--brand-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-role { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-role-superadmin { color: #f59e0b; }
.badge-role-admin { color: var(--brand-accent); }
.badge-role-counsellor { color: var(--brand-success); }
.badge-role-telecaller { color: #a78bfa; }

/* ── Main Wrap ── */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left 0.3s ease;
  width: calc(100% - var(--sidebar-w));
}
.main-wrap.sidebar-collapsed { margin-left: 68px; width: calc(100% - 68px); }

/* ── Top Header ── */
.top-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}
.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px;
  color: var(--text-muted); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.sidebar-toggle:hover { background: var(--page-bg); color: var(--text-primary); }
.header-title { font-size: 16px; font-weight: 700; color: var(--text-primary); flex: 1; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.btn-header-action {
  background: var(--brand-accent); color: #fff;
  padding: 7px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
}
.btn-header-action:hover { background: var(--brand-accent-light); }
.header-date { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

/* ── Flash Messages ── */
.flash-zone { padding: 12px 24px 0; }
.flash {
  padding: 12px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 8px;
  transition: opacity 0.4s;
}
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }

/* ── Page Content ── */
.page-content { padding: 24px; flex: 1; }

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-light);
}
.card-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.card-body { padding: 20px; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--card-shadow);
  display: flex; align-items: center; gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.09); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon-blue   { background: rgba(79,142,247,0.12); color: var(--brand-accent); }
.stat-icon-green  { background: rgba(34,197,94,0.12); color: var(--brand-success); }
.stat-icon-orange { background: rgba(245,158,11,0.12); color: var(--brand-warning); }
.stat-icon-red    { background: rgba(255,107,53,0.12); color: var(--brand-hot); }
.stat-icon-purple { background: rgba(167,139,250,0.12); color: #a78bfa; }
.stat-icon-teal   { background: rgba(20,184,166,0.12); color: #14b8a6; }

.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Badges / Pills ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
}
.badge-new         { background: #dbeafe; color: #1d4ed8; }
.badge-contacted   { background: #fef3c7; color: #92400e; }
.badge-interested  { background: #d1fae5; color: #065f46; }
.badge-not-interested { background: #fee2e2; color: #991b1b; }
.badge-applied     { background: #ede9fe; color: #5b21b6; }
.badge-enrolled    { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.badge-dropped     { background: #f3f4f6; color: #4b5563; }
.badge-junk        { background: #f3f4f6; color: #9ca3af; }

.priority-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
}
.priority-low    { color: #6b7280; }
.priority-medium { color: #f59e0b; }
.priority-high   { color: #ef4444; }
.priority-hot    { color: #ff6b35; }
.priority-hot::before { content: '🔥'; font-size: 12px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: #f8fafc;
  padding: 12px 14px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid #f0f3f9; transition: background 0.15s; }
tbody tr:hover { background: #f8fafd; }
tbody td { padding: 12px 14px; vertical-align: middle; }
.lead-name { font-weight: 600; color: var(--text-primary); }
.lead-code { font-family: var(--font-mono); font-size: 12px; color: var(--brand-accent); }
.lead-phone { font-family: var(--font-mono); font-size: 13px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 9px;
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  font-family: var(--font-main);
}
.btn-primary   { background: var(--brand-accent); color: #fff; }
.btn-primary:hover { background: var(--brand-accent-light); }
.btn-success   { background: var(--brand-success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger    { background: var(--brand-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline   { background: transparent; color: var(--text-muted); border: 1px solid var(--border-light); }
.btn-outline:hover { background: var(--page-bg); color: var(--text-primary); }
.btn-sm        { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-icon      { width: 32px; height: 32px; padding: 0; border-radius: 8px; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-label .req { color: var(--brand-danger); margin-left: 3px; }
.form-control, .form-select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  font-size: 14px; font-family: var(--font-main);
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px var(--brand-accent-glow);
}
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-end;
}
.filter-bar .form-control,
.filter-bar .form-select { font-size: 13px; padding: 7px 10px; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Pagination ── */
.pagination {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-light);
}
.page-btn {
  min-width: 34px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px; background: #fff;
  font-size: 13px; font-weight: 500;
  cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  text-decoration: none;
}
.page-btn:hover, .page-btn.active { background: var(--brand-accent); color: #fff; border-color: var(--brand-accent); }
.page-info { font-size: 13px; color: var(--text-muted); margin-left: auto; }

/* ── Dashboard Charts Grid ── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.charts-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Activity Feed ── */
.activity-item {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f3f9;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-accent-glow); color: var(--brand-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0; margin-top: 2px;
}
.activity-text { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.activity-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Lead Detail ── */
.lead-header {
  background: linear-gradient(135deg, var(--brand-bg) 0%, #1a2035 100%);
  border-radius: var(--radius);
  padding: 28px;
  color: #fff;
  margin-bottom: 20px;
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 16px;
}
.lead-header-name { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.lead-header-code { font-family: var(--font-mono); color: var(--brand-accent); font-size: 14px; margin-top: 4px; }
.lead-header-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.lead-meta-item { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #b0bec5; }
.lead-meta-item i { color: var(--brand-accent); }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0;
}
.info-item { padding: 14px 20px; border-bottom: 1px solid var(--border-light); }
.info-item:nth-child(odd) { border-right: 1px solid var(--border-light); }
.info-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 5px; }
.info-value { font-size: 14px; font-weight: 600; color: var(--text-primary); }

/* ── Followup Timeline ── */
.timeline { position: relative; }
.timeline::before {
  content: ''; position: absolute;
  left: 16px; top: 0; bottom: 0;
  width: 2px; background: var(--border-light);
}
.timeline-item { display: flex; gap: 16px; padding: 14px 0; position: relative; }
.timeline-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0; z-index: 1;
  border: 2px solid var(--card-bg);
}
.timeline-call    { background: #dbeafe; color: #2563eb; }
.timeline-email   { background: #fef3c7; color: #d97706; }
.timeline-walkin  { background: #d1fae5; color: #059669; }
.timeline-whatsapp{ background: #dcfce7; color: #16a34a; }
.timeline-other   { background: #f3f4f6; color: #6b7280; }
.timeline-body { flex: 1; }
.timeline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.timeline-type { font-size: 13px; font-weight: 700; }
.timeline-date { font-size: 12px; color: var(--text-muted); }
.timeline-outcome { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.timeline-notes { font-size: 13px; color: var(--text-primary); margin-top: 5px; background: #f8fafc; padding: 8px 12px; border-radius: 8px; }
.timeline-by { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f1117 0%, #161b27 50%, #1a2035 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 40%, rgba(79,142,247,0.08) 0%, transparent 60%),
              radial-gradient(circle at 70% 70%, rgba(123,94,167,0.08) 0%, transparent 60%);
}
.login-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 40px;
  width: 420px;
  position: relative;
  backdrop-filter: blur(20px);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand .brand-icon {
  width: 56px; height: 56px; font-size: 24px;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--brand-accent), #7b5ea7);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 8px 24px rgba(79,142,247,0.3);
}
.login-brand h1 { color: #fff; font-size: 22px; font-weight: 800; }
.login-brand p  { color: var(--brand-muted); font-size: 13px; margin-top: 4px; }
.login-card .form-label { color: #c5cede; }
.login-card .form-control {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: #fff;
}
.login-card .form-control::placeholder { color: #5a6580; }
.login-card .form-control:focus { border-color: var(--brand-accent); background: rgba(79,142,247,0.06); }
.login-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--brand-accent), #7b5ea7);
  color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: var(--font-main);
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(79,142,247,0.3);
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(79,142,247,0.4); }
.login-hint { color: #5a6580; font-size: 12px; margin-top: 20px; text-align: center; }
.login-flash { padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 13px; }
.login-flash-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.25); color: #fca5a5; }

/* ── Utility ── */
.flex { display: flex; }
.flex-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.fw-bold { font-weight: 700; }
.w-100 { width: 100%; }
.text-right { text-align: right; }
.mt-3 { margin-top: 12px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrap { margin-left: 0; width: 100%; }
  .charts-grid { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}