/**
 * UI Component Styles
 */

@import url('tokens.css');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* Layout Header & Nav */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
}

.badge-plan {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--primary-glow);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  text-transform: uppercase;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Container & Cards */
.container {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
}

/* Pipeline & Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tr:hover {
  background: var(--bg-card-hover);
}

/* Status Badges */
.badge-status {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-block;
}

.badge-status.NEW { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid #3b82f6; }
.badge-status.CONTACTED { background: rgba(139, 92, 246, 0.2); color: #c084fc; border: 1px solid #8b5cf6; }
.badge-status.VISIT_SCHEDULED { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid #f59e0b; }
.badge-status.VISIT_COMPLETED { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid #10b981; }
.badge-status.ENROLLED { background: rgba(16, 185, 129, 0.3); color: #6ee7b7; border: 2px solid #10b981; }
.badge-status.DISQUALIFIED { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid #ef4444; }
.badge-status.ARCHIVED { background: rgba(100, 116, 139, 0.2); color: #94a3b8; border: 1px solid #64748b; }

/* Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--danger-color);
  color: #fff;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
}

/* ── Utility helpers ─────────────────────────────────────────────────── */
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.flex-row { display: flex; align-items: center; gap: 0.75rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.section-title { color: var(--primary-color); margin-bottom: 1rem; }
.tab-btn { transition: var(--transition-fast); }
.tab-btn.active { background: var(--primary-color) !important; color: #fff !important; box-shadow: var(--shadow-glow); }

/* Search input inline with the leads header */
.search-input { width: 240px; }

/* User display in nav */
.nav-user-label { color: var(--text-muted); font-size: 0.9rem; }

/* ── KPI Grid ────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: rgba(15, 23, 42, 0.6);
  padding: 1.25rem 1rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary-color);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.kpi-icon  { font-size: 1.4rem; margin-bottom: 0.4rem; }
.kpi-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: .25rem; }

/* ── Chart Cards ─────────────────────────────────────────────────────── */
.chart-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.chart-title { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 1rem; }

/* ── Funnel Bar Chart ────────────────────────────────────────────────── */
.funnel-chart { display: flex; flex-direction: column; gap: .65rem; }
.funnel-row   { display: flex; align-items: center; gap: .75rem; }
.funnel-label { width: 140px; flex-shrink: 0; font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funnel-bar-track { flex: 1; background: rgba(255,255,255,0.05); border-radius: var(--radius-full); height: 22px; overflow: hidden; }
.funnel-bar {
  height: 100%;
  border-radius: var(--radius-full);
  min-width: 2px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  transition: width 0.6s cubic-bezier(.23,1,.32,1);
}
.funnel-bar-val { font-size: 0.75rem; font-weight: 700; color: rgba(255,255,255,0.9); white-space: nowrap; }
.funnel-pct { width: 48px; text-align: right; font-size: 0.8rem; font-weight: 600; flex-shrink: 0; }

/* ── Progress Bar ────────────────────────────────────────────────────── */
.progress-track { background: rgba(255,255,255,0.06); border-radius: var(--radius-full); height: 12px; overflow: hidden; }
.progress-bar   { height: 100%; border-radius: var(--radius-full); transition: width 0.6s ease; }

/* ── Health Grid & Cards ─────────────────────────────────────────────── */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.health-card { background: rgba(15,23,42,0.5); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1rem; }
.health-title { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .75rem; }
.health-row { display: flex; align-items: center; gap: .5rem; font-size: 0.9rem; margin-bottom: .35rem; }
.health-row strong { margin-left: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-green  { background: var(--success-color); }
.dot-yellow { background: var(--warning-color); }
.dot-red    { background: var(--danger-color); }

/* ── Upgrade Banner ──────────────────────────────────────────────────── */
.upgrade-banner {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid var(--warning-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.875rem;
  color: #fbbf24;
  margin-top: .5rem;
}

/* ── Loading pulse ───────────────────────────────────────────────────── */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.loading-pulse { animation: pulse 1.4s ease-in-out infinite; }

/* ── Toast Notifications ─────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--toast-accent, var(--border-color));
  border-left: 4px solid var(--toast-accent, var(--border-color));
  border-radius: var(--radius-md);
  padding: .85rem 1rem;
  min-width: 280px;
  max-width: 420px;
  box-shadow: var(--shadow-card);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(120%);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}
.toast.toast-visible  { opacity: 1; transform: translateX(0); }
.toast.toast-hiding   { opacity: 0; transform: translateX(120%); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-msg  { flex: 1; font-size: 0.875rem; line-height: 1.4; }
.toast-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text-main); }

/* ── Activity Feed ───────────────────────────────────────────────────── */
.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-item { display: flex; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--border-color); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: .35rem; }
.activity-body { flex: 1; }
.activity-action { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-bottom: .25rem; }
.activity-arrow { color: var(--text-muted); font-size: .9rem; }
.activity-notes { font-size: .85rem; color: var(--text-muted); margin: .2rem 0; font-style: italic; }
.activity-meta  { font-size: .75rem; color: var(--text-dim); display: flex; gap: 1rem; margin-top: .2rem; }

/* ── Platform Stats Grid (admin panel) ───────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.25rem; }
.stat-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 2rem; font-weight: 700; }

/* ── Inline form row ─────────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr auto;
  gap: 1rem;
  align-items: end;
}

/* ── Alert / banner boxes ────────────────────────────────────────────── */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius-md); margin-bottom: 1.5rem; font-size: .9rem; }
.alert-success { background: rgba(16,185,129,.15); border: 1px solid var(--success-color); color: #34d399; }
.alert-error   { background: rgba(239,68,68,.15); border: 1px solid var(--danger-color); color: #f87171; }
.alert-warning { background: rgba(245,158,11,.12); border: 1px solid var(--warning-color); color: #fbbf24; }

/* ── Code inline ─────────────────────────────────────────────────────── */
code { background: rgba(255,255,255,.08); padding: .1rem .4rem; border-radius: var(--radius-sm); font-family: monospace; font-size: .875em; }

/* ── Super Admin badge variant ───────────────────────────────────────── */
.badge-super-admin {
  background: rgba(239,68,68,.2); color: #f87171; border-color: #ef4444;
}

