/* =========================================================
   Leads.Chanelify — App CSS
   Based on Mailer.Chanelify UI, adapted for Lead Generation
   ========================================================= */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --bg-primary:    #0d0a1a;
  --bg-secondary:  #130e24;
  --card-bg:       #1a1230;
  --border:        rgba(255,255,255,.08);
  --text-primary:  #f1f5f9;
  --text-muted:    rgba(241,245,249,.5);
  --purple:        #7c3aed;
  --purple-light:  rgba(124,58,237,.15);
  --purple-hover:  #6d28d9;
  --sidebar-w:     240px;
  --topbar-h:      60px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; min-height: 100vh; }

/* ── Layout ────────────────────────────────────────────── */
.app-wrapper    { display: flex; min-height: 100vh; }
.main-content   { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.page-body      { padding: 1.5rem; flex: 1; }

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh;
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 200; overflow-y: auto;
}
.sidebar-logo {
  display: flex; align-items: center; gap: .625rem;
  padding: 1.125rem 1.25rem; border-bottom: 1px solid var(--border);
}
.sidebar-logo-icon { font-size: 1.25rem; }
.sidebar-logo-text { font-weight: 700; font-size: .9375rem; color: var(--text-primary); }
.sidebar-nav        { flex: 1; padding: .75rem 0; }
.sidebar-nav-section{ padding: .375rem 1.25rem; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-top: .5rem; }
.sidebar-nav-item {
  display: flex; align-items: center; gap: .625rem;
  padding: .5rem 1.25rem; text-decoration: none; font-size: .875rem;
  color: var(--text-muted); border-radius: 0; transition: all .15s;
}
.sidebar-nav-item:hover { color: var(--text-primary); background: var(--purple-light); }
.sidebar-nav-item.active { color: var(--purple); background: var(--purple-light); font-weight: 600; border-left: 3px solid var(--purple); }
.sidebar-nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-user {
  display: flex; align-items: center; gap: .625rem;
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
}
.sidebar-user-info   { flex: 1; overflow: hidden; }
.sidebar-user-name   { font-size: .8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email  { font-size: .6875rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-overlay     { display: none; }

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.topbar-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: .25rem; }
.topbar-brand  { font-size: .9375rem; font-weight: 600; color: var(--text-primary); flex: 1; }
.topbar-actions{ display: flex; align-items: center; gap: .75rem; }

/* ── Page Header ───────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem;
}
.page-title    { font-size: 1.375rem; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: .875rem; color: var(--text-muted); margin-top: .125rem; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1.25rem; border-bottom: 1px solid var(--border);
}
.card-title  { font-size: .9375rem; font-weight: 600; }
.card-body   { padding: 1.25rem; }

/* ── Stats Grid ────────────────────────────────────────── */
.stats-grid { display: grid; gap: 1rem; }
.stat-card  {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.125rem 1.25rem; display: flex; flex-direction: column; gap: .375rem;
}
.stat-value { font-size: 1.625rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-icon  { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.125rem; margin-bottom: .25rem; }

/* ── Table ─────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  padding: .625rem 1rem; text-align: left; font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td   { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: rgba(255,255,255,.025); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .375rem;
  padding: .5rem 1rem; border-radius: 8px; font-size: .875rem; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none; transition: all .15s; white-space: nowrap;
}
.btn-primary  { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-hover); }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--purple); color: var(--purple); }
.btn-danger   { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.3); color: #ef4444; }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-warning  { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3); color: #f59e0b; }
.btn-sm  { padding: .3125rem .75rem; font-size: .8125rem; border-radius: 6px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .5rem; border-radius: 20px;
  font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.badge-purple   { background: rgba(124,58,237,.2); color: #a78bfa; }
.badge-success  { background: rgba(16,185,129,.2); color: #34d399; }
.badge-danger   { background: rgba(239,68,68,.2); color: #f87171; }
.badge-warning  { background: rgba(245,158,11,.2); color: #fbbf24; }
.badge-secondary{ background: rgba(255,255,255,.08); color: var(--text-muted); }

/* ── Forms ─────────────────────────────────────────────── */
.form-group  { margin-bottom: 1rem; }
.form-label  { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .375rem; color: var(--text-primary); }
.form-control {
  display: block; width: 100%; padding: .5625rem .875rem;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); font-size: .875rem;
  transition: border-color .15s; font-family: inherit;
}
.form-control:focus  { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,.15); }
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { opacity: .6; cursor: not-allowed; }
select.form-control  { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.25rem; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Alerts ────────────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: .625rem;
  padding: .75rem 1rem; border-radius: 8px; font-size: .875rem; border: 1px solid transparent;
}
.alert-success { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: #34d399; }
.alert-danger  { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #f87171; }
.alert-close   { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; font-size: 1.1rem; padding: 0; line-height: 1; }

/* ── Avatar ────────────────────────────────────────────── */
.avatar    { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; }
.avatar-sm { width: 32px; height: 32px; font-size: .8125rem; }

/* ── Empty State ───────────────────────────────────────── */
.empty-state { text-align: center; color: var(--text-muted); }
.empty-state h3 { font-size: 1.125rem; color: var(--text-primary); margin-bottom: .5rem; }
.empty-state p  { margin-bottom: 1rem; }

/* ── Pagination ────────────────────────────────────────── */
.pagination     { display: flex; gap: .25rem; list-style: none; justify-content: center; }
.page-item      { }
.page-link      {
  display: flex; align-items: center; justify-content: center; min-width: 32px; height: 32px;
  padding: 0 .5rem; border-radius: 6px; font-size: .8125rem;
  border: 1px solid var(--border); color: var(--text-muted); text-decoration: none; transition: all .15s;
}
.page-link:hover { border-color: var(--purple); color: var(--purple); }
.page-item.active .page-link { background: var(--purple); border-color: var(--purple); color: #fff; }

/* ── Spinner ───────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--purple); border-radius: 50; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth ──────────────────────────────────────────────── */
.auth-body       { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-primary); padding: 1rem; }
.auth-container  { width: 100%; max-width: 420px; }
.auth-card       { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; }
.auth-logo       { text-align: center; margin-bottom: 1.5rem; }
.auth-title      { font-size: 1.375rem; font-weight: 700; margin: .5rem 0 .25rem; }
.auth-subtitle   { color: var(--text-muted); font-size: .875rem; }
.auth-form       { margin-top: 1.25rem; }

/* ── Animations ────────────────────────────────────────── */
.animate-slide-in { animation: slideIn .2s ease; }
@keyframes slideIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Utilities ─────────────────────────────────────────── */
code { background: rgba(255,255,255,.06); padding: .15rem .4rem; border-radius: 4px; font-size: .8rem; font-family: monospace; }
hr   { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar        { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open   { transform: translateX(0); }
  .sidebar-overlay{ display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 199; }
  .main-content   { margin-left: 0; }
  .topbar-toggle  { display: flex; }
  .stats-grid     { grid-template-columns: 1fr 1fr !important; }
  .page-header    { flex-direction: column; }
  .table          { display: block; overflow-x: auto; }
}
