:root {
  /* Sophisticated Blue/Slate Palette */
  --primary: #2563eb;       /* Royal Blue */
  --primary-dark: #1e40af;  /* Deep Blue */
  --primary-light: #dbeafe; /* Pale Blue */

  --secondary: #0f172a;     /* Slate 900 - Deep Navy */
  --secondary-light: #475569; /* Slate 600 */

  --accent: #0891b2;        /* Cyan - Trust/Professional */
  --accent-light: #06b6d4;  /* Lighter Cyan */
  --success: #059669;       /* Emerald Green */
  --warning: #f59e0b;       /* Amber */

  --bg: #f8fafc;            /* Slate 50 - Clean Background */
  --bg-subtle: #f1f5f9;     /* Slate 100 */
  --card: #ffffff;          /* White */
  --text: #1e293b;          /* Slate 800 */
  --text-light: #64748b;    /* Slate 500 */
  --border: #e2e8f0;        /* Slate 200 */
  --border-strong: #cbd5e1; /* Slate 300 */

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.05);

  --font-main: 'Manrope', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Sticky footer layout */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.2;
}

p { margin: 0 0 1rem 0; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  height: 44px;
  width: auto;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 6px rgba(37, 99, 235, 0.25));
}
.brand-logo:hover {
  transform: scale(1.15) rotate(-6deg);
  filter: drop-shadow(0 8px 12px rgba(37, 99, 235, 0.35));
}
.brand-title {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--secondary);
  letter-spacing: -0.02em;
}
.nav-links a {
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.95rem;
}
.nav-links a:hover { color: var(--primary); }

/* Hero Section */
.hero {
  padding: 80px 0 60px;
  background: radial-gradient(circle at top right, #dbeafe 0%, transparent 50%),
              radial-gradient(circle at bottom left, #f0f9ff 0%, transparent 50%);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}
.hero-content h1 {
  font-size: 3.5rem;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  color: var(--secondary);
  line-height: 1.1;
}
.hero-content h1 span {
  background: linear-gradient(135deg, var(--primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.25rem;
  color: var(--text-light);
  margin-bottom: 32px;
  max-width: 540px;
  line-height: 1.6;
}

/* Search Card */
.search-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.search-card label {
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
  color: var(--secondary);
  font-size: 0.95rem;
}
.search-card textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 1.1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 140px;
}
.search-card textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}
.search-card textarea::placeholder { color: #94a3b8; }

.inline-fields {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}
.field-group { flex: 1; }
.field-group input, .field-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
}
.radio-group {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--secondary-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  gap: 8px;
  text-decoration: none;
}
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.btn.ghost {
  background: transparent;
  border: 2px solid var(--border-strong);
  color: var(--secondary);
}
.btn.ghost:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}
.btn.full { width: 100%; margin-top: 24px; }

/* Back Button - adds spacing from header */
.back-btn {
  margin-top: 16px;
  margin-bottom: 20px;
  padding: 10px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}
.back-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* Results Section */
.results-section { padding: 40px 0 80px; }
.results-header { margin-bottom: 24px; }

/* Section with back button - proper spacing from header */
#results-and-form {
  padding-top: 40px;
  padding-bottom: 60px;
}

/* Footer Styling */
.site-footer {
  background: linear-gradient(135deg, var(--bg-subtle) 0%, #e2e8f0 100%);
  color: var(--text);
  padding: 48px 0 32px;
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-brand .brand-title {
  color: var(--secondary);
  font-size: 1.1rem;
}
.footer-links {
  display: flex;
  gap: 24px;
  font-size: 0.9rem;
}
.footer-links a {
  color: var(--text-light);
  transition: color 0.2s;
}
.footer-links a:hover {
  color: var(--primary);
}
.footer-copy {
  width: 100%;
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Best Match Card */
.best-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2px;
  background-image: linear-gradient(135deg, var(--primary), var(--accent-light));
  box-shadow: var(--shadow-xl);
  margin-bottom: 32px;
  position: relative;
}
.best-card-inner {
  background: linear-gradient(to bottom, #ffffff, #f8fafc);
  border-radius: calc(var(--radius-lg) - 2px);
  padding: 28px;
}
.best-badge {
  position: absolute;
  top: -12px;
  left: 24px;
  background: linear-gradient(135deg, var(--secondary), #1e3a8a);
  color: #fbbf24;
  padding: 8px 18px;
  border-radius: 99px;
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 6px;
}
.best-card h3 {
  font-size: 1.85rem;
  margin: 12px 0 12px;
  color: var(--secondary);
}
.best-card p {
  font-size: 1.05rem;
  color: var(--text-light);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Other Matches */
.company-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  transition: all 0.25s ease;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
}
.company-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

/* Company Logo/Favicon */
.company-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  overflow: hidden;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}
.company-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.company-card-content {
  min-width: 0; /* Allows text truncation */
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 16px;
}
.card-top h4 {
  font-size: 1.3rem;
  color: var(--secondary);
  margin: 0;
  line-height: 1.3;
}
.rating {
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 0.95rem;
}
.star { color: #f59e0b; }

.card-description {
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

/* Specialty Pills */
.specialties-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.specialty-pill {
  display: inline-block;
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--bg-subtle), var(--primary-light));
  color: var(--primary-dark);
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--primary-light);
  transition: all 0.2s ease;
}

.specialty-pill:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  border-color: var(--primary);
}

/* Location Display */
.card-location {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}


/* Lead Form */
.lead-panel {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 32px;
  border: 1px solid var(--border);
}
.lead-progress {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}
.step-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}
.step-dot.active { background: var(--primary); transform: scale(1.2); }
.step-dot.completed { background: var(--success); }

.form-step h3 { margin-bottom: 24px; font-size: 1.5rem; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--secondary); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--primary); outline: none; }

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.text-muted { color: var(--text-light); }

/* Loading */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--muted);
}
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-content h1 { font-size: 2.5rem; }
  .search-card { padding: 24px; }
}
