/* =============================================
   SOLEAD — SaaS B2B Lead Acceleration
   Main Stylesheet
   ============================================= */

:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #EEF2FF;
  --secondary: #7C3AED;
  --accent: #06B6D4;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --dark: #0F172A;
  --sidebar-bg: #1E293B;
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: white;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; color: white;
  flex-shrink: 0;
}
.logo-text strong { display: block; font-size: .95rem; line-height: 1.1; }
.logo-text small  { font-size: .68rem; color: rgba(255,255,255,.5); font-weight: 400; }
.sidebar-toggle { background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer; font-size: 1rem; padding: .25rem; }

.sidebar-credits {
  margin: 1rem;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius-sm);
  padding: .875rem;
}
.credits-info { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.credits-info i { color: var(--warning); font-size: 1.1rem; }
.credits-amount { font-weight: 700; font-size: .95rem; color: white; }
.credits-plan { font-size: .7rem; color: rgba(255,255,255,.5); }
.credits-bar { height: 4px; background: rgba(255,255,255,.1); border-radius: 99px; overflow: hidden; }
.credits-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width .5s ease; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem 0; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent; }
.nav-section-label {
  font-size: .65rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.35);
  padding: 1rem 1rem .4rem;
}
.nav-item {
  display: flex; align-items: center; gap: .875rem;
  padding: .65rem 1rem;
  color: rgba(255,255,255,.65);
  text-decoration: none; font-size: .875rem; font-weight: 500;
  margin: .1rem .5rem; border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.nav-item i { width: 20px; text-align: center; font-size: .9rem; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.nav-item.active { background: var(--primary); color: white; }

.sidebar-footer { padding: .875rem 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.user-menu { display: flex; align-items: center; gap: .75rem; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; color: white; flex-shrink: 0;
}
.user-name { font-size: .8rem; font-weight: 600; color: white; line-height: 1.2; }
.user-email { font-size: .68rem; color: rgba(255,255,255,.5); }
.user-info { flex: 1; min-width: 0; overflow: hidden; }
.user-logout { color: rgba(255,255,255,.4); font-size: .9rem; padding: .25rem; border-radius: 4px; transition: color var(--transition); }
.user-logout:hover { color: var(--danger); }

/* ── Main ── */
.main-content { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left var(--transition); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; background: var(--card-bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.page-title { font-size: 1.15rem; font-weight: 700; color: var(--dark); }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.sidebar-toggle-mobile { display: none; background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--text-muted); }
.topbar-notifications { width: 36px; height: 36px; background: var(--bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); transition: background var(--transition); }
.topbar-notifications:hover { background: var(--border); }
.page-content { padding: 1.5rem; flex: 1; }

/* ── Cards ── */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.card-title { font-size: 1rem; font-weight: 700; color: var(--dark); }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 1.25rem;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .5rem;
  position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--stat-color, var(--primary)); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; background: var(--stat-bg, var(--primary-light)); color: var(--stat-color, var(--primary)); margin-bottom: .25rem; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.stat-trend { font-size: .75rem; display: flex; align-items: center; gap: .25rem; font-weight: 600; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .625rem 1.25rem; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 600; border: none; cursor: pointer; text-decoration: none; transition: all var(--transition); white-space: nowrap; }
.btn-sm { padding: .4rem .875rem; font-size: .8rem; }
.btn-lg { padding: .875rem 1.75rem; font-size: 1rem; }
.btn-icon { padding: .5rem; width: 36px; height: 36px; justify-content: center; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: .25rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.3); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .6rem; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.badge-info   { background: #E0F2FE; color: #0284C7; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #D1FAE5; color: #059669; }
.badge-warning { background: #FEF3C7; color: #D97706; }
.badge-danger  { background: #FEE2E2; color: #DC2626; }
.badge-secondary { background: #F1F5F9; color: #64748B; }
.badge-purple  { background: #EDE9FE; color: #7C3AED; }

/* ── Tables ── */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th { padding: .875rem 1rem; text-align: left; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: var(--bg); }
tbody td { padding: .875rem 1rem; vertical-align: middle; color: var(--text); }
tbody tr:last-child { border-bottom: none; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.form-label .required { color: var(--danger); margin-left: .2rem; }
.form-control { width: 100%; padding: .65rem .875rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .875rem; font-family: inherit; color: var(--text); background: white; transition: border-color var(--transition), box-shadow var(--transition); outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-control::placeholder { color: #94A3B8; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .35rem; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.input-group { position: relative; }
.input-group .form-control { padding-left: 2.5rem; }
.input-group-icon { position: absolute; left: .875rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .875rem; pointer-events: none; }

/* ── Alerts ── */
.alert { display: flex; align-items: center; gap: .75rem; padding: .875rem 1.25rem; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; position: relative; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info    { background: #E0F2FE; color: #0C4A6E; border: 1px solid #BAE6FD; }
.alert-close   { background: none; border: none; cursor: pointer; margin-left: auto; font-size: 1.2rem; line-height: 1; opacity: .6; }
.alert-close:hover { opacity: 1; }
.alert-dismissible { margin-bottom: 1rem; }

/* ── CopyPack ── */
.copypack-section { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 1rem; position: relative; }
.copypack-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .5rem; }
.copypack-content { font-size: .875rem; line-height: 1.7; color: var(--text); white-space: pre-wrap; }
.copypack-copy-btn { position: absolute; top: .75rem; right: .75rem; background: white; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .3rem .6rem; font-size: .72rem; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; gap: .25rem; transition: all var(--transition); }
.copypack-copy-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Tabs ── */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn { padding: .65rem 1.25rem; border: none; background: none; font-size: .875rem; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; pointer-events: none; transition: opacity var(--transition); }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; transform: scale(.95); transition: transform var(--transition); }
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: flex-end; }

/* ── Progress ── */
.progress { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: var(--primary); transition: width .5s ease; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state h3 { font-size: 1.1rem; color: var(--dark); margin-bottom: .5rem; }
.empty-state p { font-size: .875rem; max-width: 400px; margin: 0 auto 1.5rem; }

/* ── Lead Card ── */
.lead-card { display: flex; align-items: center; gap: .75rem; }
.lead-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: white; flex-shrink: 0; }
.lead-name { font-weight: 600; font-size: .9rem; color: var(--dark); }
.lead-meta { font-size: .75rem; color: var(--text-muted); }

/* ── Chart ── */
.chart-container { position: relative; height: 240px; display: flex; align-items: flex-end; gap: .5rem; padding: .5rem 0; }
.chart-bar { flex: 1; background: var(--primary-light); border-radius: 4px 4px 0 0; min-height: 4px; transition: height .5s ease; cursor: pointer; position: relative; }
.chart-bar:hover { background: var(--primary); }
.chart-bar span { position: absolute; bottom: -1.4rem; left: 50%; transform: translateX(-50%); font-size: .65rem; color: var(--text-muted); white-space: nowrap; }

/* ── QR ── */
.qr-preview { width: 160px; height: 160px; background: white; border: 2px solid var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 5rem; color: var(--text-muted); }

/* ── Auth ── */
.auth-wrapper { min-height: 100vh; display: flex; background: var(--dark); }
.auth-sidebar { width: 440px; background: linear-gradient(160deg, #1E293B 0%, #0F172A 100%); padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; flex-shrink: 0; }
.auth-main { flex: 1; background: white; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-form-box { width: 100%; max-width: 420px; }
.auth-form-box h2 { font-size: 1.75rem; font-weight: 800; color: var(--dark); margin-bottom: .5rem; }
.auth-form-box p { color: var(--text-muted); margin-bottom: 2rem; }
.auth-feature { display: flex; gap: .875rem; margin-bottom: 1.5rem; }
.auth-feature-icon { width: 40px; height: 40px; flex-shrink: 0; background: rgba(79,70,229,.15); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: .9rem; }
.auth-feature h4 { font-size: .875rem; font-weight: 700; color: white; margin-bottom: .15rem; }
.auth-feature p  { font-size: .78rem; color: rgba(255,255,255,.5); margin-bottom: 0; }

/* ── Filters ── */
.filters-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filters-bar .form-control { max-width: 220px; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: .25rem; }
.page-btn { width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: white; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--text-muted); text-decoration: none; transition: all var(--transition); }
.page-btn:hover, .page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ── Tooltip ── */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--dark); color: white; font-size: .72rem; padding: .3rem .6rem; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--transition); z-index: 99; }
[data-tooltip]:hover::after { opacity: 1; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ── Utility ── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; } .mt-4 { margin-top: 1rem; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; } .mt-auto { margin-top: auto; }
.text-muted { color: var(--text-muted); } .text-sm { font-size: .8rem; } .text-xs { font-size: .72rem; }
.font-bold { font-weight: 700; } .font-600 { font-weight: 600; }
.text-dark { color: var(--dark); } .text-right { text-align: right; } .text-center { text-align: center; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .logo-text, .sidebar .nav-item span, .sidebar .nav-section-label,
  .sidebar .user-info, .sidebar .sidebar-credits { display: none; }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .nav-item { justify-content: center; gap: 0; padding: .75rem; }
  .nav-item i { width: auto; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .logo-text, .sidebar .nav-item span, .sidebar .nav-section-label,
  .sidebar .user-info, .sidebar .sidebar-credits { display: block; }
  .nav-item { justify-content: flex-start; gap: .875rem; }
  .main-content { margin-left: 0; }
  .sidebar-toggle-mobile { display: block; }
  .auth-wrapper { flex-direction: column; }
  .auth-sidebar { width: 100%; padding: 2rem; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 1rem; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }
