/* ============================================================
   ProspectPilot Dashboard — Premium Dark Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,opsz,wght@0,6..30,300;0,6..30,400;0,6..30,500;0,6..30,600;0,6..30,700;0,6..30,800;1,6..30,400&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:       #07091a;
  --bg-surface:    #0e1228;
  --bg-card:       rgba(18, 24, 48, 0.85);
  --bg-row-alt:    rgba(22, 30, 58, 0.6);
  --border:        rgba(255,255,255,0.07);
  --border-md:     rgba(255,255,255,0.12);
  --primary:       #6366f1;
  --primary-light: #818cf8;
  --primary-glow:  rgba(99,102,241,0.25);
  --accent-green:  #10b981;
  --accent-violet: #8b5cf6;
  --accent-amber:  #f59e0b;
  --accent-rose:   #f43f5e;
  --accent-sky:    #38bdf8;
  --accent-teal:   #14b8a6;
  --text-primary:  #f1f5f9;
  --text-muted:    #94a3b8;
  --text-dim:      #475569;
  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     18px;
  --radius-xl:     24px;
  --shadow-card:   0 4px 24px rgba(0,0,0,0.35);
  --transition:    all 0.28s cubic-bezier(0.16,1,0.3,1);
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(ellipse 80% 60% at 70% -20%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at -10% 90%,  rgba(139,92,246,0.08) 0%, transparent 60%);
  background-attachment: fixed;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout Wrapper ───────────────────────────────────────── */
#maincontent {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#content {
  flex: 1;
  padding: 28px 36px 40px;
  max-width: 1700px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Top Header ───────────────────────────────────────────── */
.dashboard-header-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-branding {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-wrap {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent-violet));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px var(--primary-glow);
  flex-shrink: 0;
}

.dashboard-branding h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}

.dashboard-branding h1 span {
  background: linear-gradient(to right, var(--primary-light), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dashboard-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.dashboard-actions-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-buttons {
  display: flex;
  gap: 10px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
  letter-spacing: 0.01em;
}

#download-csv {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 3px 10px rgba(16,185,129,0.22);
}
#download-csv:hover {
  box-shadow: 0 5px 18px rgba(16,185,129,0.38);
  transform: translateY(-1px);
}

#download-xlsx {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 3px 10px rgba(99,102,241,0.22);
}
#download-xlsx:hover {
  box-shadow: 0 5px 18px rgba(99,102,241,0.38);
  transform: translateY(-1px);
}

#download-csv:active, #download-xlsx:active {
  transform: translateY(1px);
  box-shadow: none;
}

#accountinfo {
  display: flex;
  align-items: center;
  gap: 10px;
}

#accountinfo span:first-child {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
}

/* ── Stats Cards Row ──────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--stat-accent, var(--primary));
  opacity: 0.8;
}

.stat-card:hover {
  border-color: var(--border-md);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.stat-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--stat-icon-bg, rgba(99,102,241,0.12));
  flex-shrink: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

/* Accent variations */
.stat-card.c-green  { --stat-accent: #10b981; --stat-icon-bg: rgba(16,185,129,0.12); }
.stat-card.c-violet { --stat-accent: #8b5cf6; --stat-icon-bg: rgba(139,92,246,0.12); }
.stat-card.c-sky    { --stat-accent: #38bdf8; --stat-icon-bg: rgba(56,189,248,0.12); }
.stat-card.c-amber  { --stat-accent: #f59e0b; --stat-icon-bg: rgba(245,158,11,0.12); }
.stat-card.c-rose   { --stat-accent: #f43f5e; --stat-icon-bg: rgba(244,63,94,0.12); }
.stat-card.c-teal   { --stat-accent: #14b8a6; --stat-icon-bg: rgba(20,184,166,0.12); }

/* ── Toolbar (Search + Filter + Count) ───────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 15px;
  pointer-events: none;
}

#table-search {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  background: rgba(15,21,40,0.7);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

#table-search::placeholder { color: var(--text-dim); }
#table-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

#status-filter {
  height: 40px;
  padding: 0 14px;
  background: rgba(15,21,40,0.7);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  min-width: 160px;
}
#status-filter:focus { border-color: var(--primary); }
#status-filter option { background: #0e1228; }

.record-count {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.record-count strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* ── Data Status Bar ──────────────────────────────────────── */
#datastatus {
  font-size: 13px;
  font-weight: 500;
  color: #f87171;
  min-height: 1px;
}

/* ── Tabulator Table Overrides ────────────────────────────── */
.tabulator {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  overflow: hidden !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28) !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-size: 13px !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

.tabulator-header {
  background: rgba(22,30,55,0.95) !important;
  border-bottom: 1px solid var(--border-md) !important;
}

.tabulator-col {
  background: transparent !important;
  border-right: 1px solid var(--border) !important;
  padding: 0 !important;
}

.tabulator-col-title {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--text-muted) !important;
  padding: 14px 16px !important;
}

.tabulator-row {
  background: transparent !important;
  border-bottom: 1px solid var(--border) !important;
  transition: background 0.15s ease !important;
}

.tabulator-row:nth-child(even) {
  background: rgba(22,30,55,0.4) !important;
}

.tabulator-row:hover {
  background: rgba(99,102,241,0.12) !important;
}

.tabulator-row.tabulator-selected {
  background: rgba(99,102,241,0.22) !important;
}

.tabulator-cell {
  color: var(--text-primary) !important;
  border-right: 1px solid var(--border) !important;
  padding: 11px 16px !important;
  font-size: 13px !important;
}

.tabulator-cell:first-child {
  color: var(--text-muted) !important;
  font-weight: 600 !important;
  font-size: 12px !important;
}

.tabulator-placeholder {
  background: transparent !important;
  color: var(--text-dim) !important;
}

.tabulator-footer {
  background: rgba(14,18,40,0.9) !important;
  border-top: 1px solid var(--border) !important;
  padding: 10px 16px !important;
}

.tabulator-paginator {
  color: var(--text-muted) !important;
  font-size: 13px !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}

.tabulator-page {
  background: rgba(99,102,241,0.08) !important;
  border: 1px solid var(--border-md) !important;
  border-radius: 6px !important;
  color: var(--text-primary) !important;
  padding: 4px 10px !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  transition: var(--transition) !important;
}

.tabulator-page:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.tabulator-page.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  font-weight: 700 !important;
}

/* Unlicensed blur */
body.unlicensed .tabulator-row:nth-child(n+21) {
  filter: blur(5px);
  opacity: 0.35;
  pointer-events: none !important;
  user-select: none !important;
}

/* ── License Modal ────────────────────────────────────────── */
.license-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,9,26,0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

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

.license-modal-card {
  background: linear-gradient(155deg, rgba(18,24,52,0.97), rgba(8,12,28,0.98));
  border: 1px solid var(--border-md);
  border-radius: var(--radius-xl);
  width: 92%;
  max-width: 500px;
  padding: 44px 40px;
  box-shadow:
    0 24px 60px rgba(0,0,0,0.5),
    0 0 0 1px rgba(99,102,241,0.08),
    inset 0 1px 0 rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-family: inherit;
  transform: translateY(24px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
}

.license-modal-overlay.active .license-modal-card {
  transform: translateY(0) scale(1);
}

.license-modal-header {
  text-align: center;
  margin-bottom: 30px;
}

.modal-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent-violet));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 6px 20px var(--primary-glow);
}

.license-modal-header h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 10px;
  background: linear-gradient(to right, var(--primary-light), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.license-modal-header p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.65;
}

.license-input-wrapper {
  margin-bottom: 18px;
}

.license-input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(10,14,35,0.7);
  border: 1.5px solid var(--border-md);
  border-radius: var(--radius);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  letter-spacing: 0.08em;
}

.license-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.license-input::placeholder { color: var(--text-dim); letter-spacing: 0; }

.license-btn-submit {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #4f46e5, #6366f1, #818cf8);
  background-size: 200% 200%;
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(79,70,229,0.35);
  letter-spacing: 0.02em;
}

.license-btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79,70,229,0.45);
}
.license-btn-submit:active { transform: translateY(0); }
.license-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.license-btn-dismiss {
  width: 100%;
  padding: 13px;
  background: transparent;
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  margin-top: 10px;
  transition: var(--transition);
}

.license-btn-dismiss:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.18);
}

.license-status-msg {
  margin-top: 14px;
  font-size: 13px;
  text-align: center;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: none;
}

.license-status-msg.error {
  display: block;
  background: rgba(244,63,94,0.08);
  color: #fb7185;
  border: 1px solid rgba(244,63,94,0.2);
}

.license-status-msg.success {
  display: block;
  background: rgba(16,185,129,0.08);
  color: #4ade80;
  border: 1px solid rgba(16,185,129,0.2);
}

.license-footer-links {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
}

.license-footer-links a {
  color: var(--primary-light);
  font-weight: 600;
  transition: color 0.2s;
}
.license-footer-links a:hover { color: #c4b5fd; }

/* ── License Badge ────────────────────────────────────────── */
.license-indicator-badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.02em;
}

.license-indicator-badge.active {
  background: rgba(16,185,129,0.1);
  color: #4ade80;
  border: 1px solid rgba(16,185,129,0.25);
}

.license-indicator-badge.inactive {
  background: rgba(244,63,94,0.1);
  color: #fb7185;
  border: 1px solid rgba(244,63,94,0.25);
  cursor: pointer;
  transition: var(--transition);
}

.license-indicator-badge.inactive:hover {
  background: rgba(244,63,94,0.18);
}