/* =====================================================
   LeadGen App — Brass Onion Studios — Main Stylesheet
   ===================================================== */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-fire: #ea580c;
  --color-neutral: #6b7280;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
}

/* ----- Navbar ----- */
.navbar {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
}
.brand-icon { font-size: 20px; }
.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
  flex: 1;
}
.nav-links a {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  background: #eff6ff;
  color: var(--color-primary);
}
.nav-user { display: flex; align-items: center; gap: 12px; }
.user-label { font-size: 13px; color: var(--color-text-muted); }

/* ----- Main content ----- */
.main-content { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ----- Flash messages ----- */
.flash-container { margin-bottom: 16px; }
.flash-message {
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg); }
.btn-danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ----- Badges ----- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-neutral { background: #f1f5f9; color: #475569; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-fire    { background: #ffedd5; color: #9a3412; }
.badge-lg { padding: 4px 12px; font-size: 13px; }

/* ----- Cards ----- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: #f8fafc;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }

/* ----- Page header ----- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { color: var(--color-text-muted); margin-top: 2px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section { margin-bottom: 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 16px; font-weight: 600; }
.section-actions { display: flex; gap: 8px; }
.badge-row { display: flex; gap: 8px; margin-top: 8px; }

/* ----- Stats ----- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stats-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--color-primary); }
.stat-label { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-inline { font-size: 14px; color: var(--color-text-muted); margin-top: 4px; }

/* ----- Grid layouts ----- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ----- Tables ----- */
.table-container { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.data-table tr.row-hot td { background: #fff7ed; }
.data-table tr.row-hot:hover td { background: #ffedd5; }
.td-name { font-weight: 500; }
.action-buttons { display: flex; gap: 4px; }

/* ----- Tags ----- */
.tag {
  display: inline-block;
  background: #eff6ff;
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-right: 2px;
}
.tag-more { font-size: 12px; color: var(--color-text-muted); }
.tag-readonly { font-size: 11px; background: #f1f5f9; color: #64748b; padding: 1px 6px; border-radius: 4px; font-weight: 400; }
.tag-editable { font-size: 11px; background: #dcfce7; color: #15803d; padding: 1px 6px; border-radius: 4px; font-weight: 400; }

/* ----- Forms ----- */
.form { padding: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control-sm { padding: 5px 10px; font-size: 13px; }
.form-row { display: flex; gap: 16px; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; display: block; }
.flex-1 { flex: 1; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.required { color: var(--color-danger); }
.inline-form { display: inline; }

/* ----- Checkbox groups ----- */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.checkboxes-row { gap: 16px; }

/* ----- Score inputs ----- */
.scoring-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 16px 20px; }
.scoring-item label { font-size: 13px; font-weight: 500; }
.score-input { max-width: 80px; }

/* ----- Step indicator ----- */
.step-indicator { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.step { padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 500; background: #f1f5f9; color: var(--color-text-muted); }
.step.active { background: var(--color-primary); color: white; }
.step.done { background: #dcfce7; color: #15803d; }
.step-sep { color: var(--color-text-muted); }

/* ----- Review grid ----- */
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.review-item { display: flex; flex-direction: column; padding: 12px 20px; border-bottom: 1px solid #f1f5f9; }
.review-item.full-width { grid-column: 1 / -1; }
.review-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-muted); margin-bottom: 2px; }
.review-value { font-size: 14px; }

/* ----- Detail list ----- */
.detail-list { padding: 8px 0; }
.detail-item { display: flex; padding: 10px 20px; border-bottom: 1px solid #f9fafb; }
.detail-label { font-size: 13px; font-weight: 500; color: var(--color-text-muted); min-width: 180px; flex-shrink: 0; }
.detail-value { font-size: 14px; }

/* ----- Score breakdown ----- */
.score-breakdown { padding: 12px 20px; }
.score-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f9fafb; }
.score-row:last-child { border-bottom: none; }
.score-pts { font-weight: 600; color: var(--color-primary); }

/* ----- Score badges ----- */
.score-badge { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: 12px; font-weight: 700; }
.score-badge-lg { font-size: 18px; font-weight: 700; }
.score-high { background: #dcfce7; color: #15803d; }
.score-mid  { background: #fef3c7; color: #92400e; }
.score-low  { background: #fee2e2; color: #991b1b; }

/* ----- Contacts ----- */
.contacts-grid { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 20px; }
.contact-card { background: #f8fafc; border: 1px solid var(--color-border); border-radius: 6px; padding: 12px 16px; min-width: 200px; }
.contact-name { font-weight: 600; font-size: 14px; }
.contact-role { font-size: 13px; color: var(--color-text-muted); margin-bottom: 6px; }
.contact-link { font-size: 12px; }

/* ----- Progress ----- */
.progress-card { border-color: #fbbf24; }
.progress-bar-container { background: #f1f5f9; border-radius: 4px; height: 8px; margin: 12px 20px; }
.progress-bar { background: var(--color-primary); height: 100%; border-radius: 4px; transition: width 0.3s; }
.progress-text { font-size: 13px; color: var(--color-text-muted); padding: 0 20px 16px; }

/* ----- Results ready ----- */
.results-ready-card { border-color: #86efac; }
.results-ready-card .card-header { background: #f0fdf4; }
.results-ready-card .btn { margin: 0 20px 16px; }

/* ----- Run card ----- */
.run-card { display: flex; align-items: center; justify-content: space-between; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; }
.run-actions { display: flex; align-items: center; gap: 8px; }

/* ----- Inquiry cards ----- */
.inquiry-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.inquiry-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.inquiry-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.inquiry-card-title { font-weight: 600; font-size: 14px; }
.inquiry-card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--color-text-muted); margin-bottom: 12px; }
.inquiry-card-actions { display: flex; gap: 6px; }

/* ----- Filter bar ----- */
.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ----- Pagination ----- */
.pagination { display: flex; align-items: center; gap: 12px; margin-top: 16px; justify-content: center; }
.page-info { font-size: 13px; color: var(--color-text-muted); }

/* ----- Empty state ----- */
.empty-state { text-align: center; padding: 48px 24px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.empty-icon { font-size: 40px; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: var(--color-text-muted); margin-bottom: 20px; }

/* ----- Alerts ----- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-error   { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-success { background: #dcfce7; border: 1px solid #86efac; color: #15803d; }
.alert-warning { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; }
.alert-info    { background: #dbeafe; border: 1px solid #93c5fd; color: #1e40af; }

/* ----- Links ----- */
.link-primary { color: var(--color-primary); text-decoration: none; font-weight: 500; }
.link-primary:hover { text-decoration: underline; }
.link-external { color: var(--color-primary); text-decoration: none; font-size: 13px; }
.link-external:hover { text-decoration: underline; }
.link { color: var(--color-primary); text-decoration: none; }
.text-muted { color: var(--color-text-muted); }

/* ----- Login page ----- */
.login-body { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-container { width: 100%; max-width: 400px; padding: 24px; }
.login-card { background: var(--color-surface); border-radius: 12px; box-shadow: var(--shadow-md); overflow: hidden; }
.login-header { text-align: center; padding: 32px 32px 24px; }
.login-icon { font-size: 48px; color: var(--color-primary); margin-bottom: 12px; }
.login-header h1 { font-size: 22px; font-weight: 700; }
.login-subtitle { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }
.login-form { padding: 0 32px 32px; }

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .scoring-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .navbar { padding: 0 16px; }
  .main-content { padding: 16px; }
  .form-row { flex-direction: column; gap: 0; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .step-indicator { flex-wrap: wrap; }
}
