/* ==================================================================
   LeadGen — Apple-inspired design system
   Tailwind (CDN) handles layout utilities; this file owns the
   material, typography and motion language.
   ================================================================== */

:root {
  color-scheme: light;

  /* Canvas & materials */
  --lg-canvas:        #f5f5f7;
  --lg-canvas-tint-a: rgba(0, 122, 255, 0.10);
  --lg-canvas-tint-b: rgba(175, 82, 222, 0.08);
  --lg-canvas-tint-c: rgba(48, 209, 88, 0.07);

  --lg-surface:       rgba(255, 255, 255, 0.72);
  --lg-surface-solid: #ffffff;
  --lg-surface-raise: rgba(255, 255, 255, 0.86);
  --lg-surface-sunk:  rgba(118, 118, 128, 0.08);

  --lg-border:        rgba(0, 0, 0, 0.08);
  --lg-border-strong: rgba(0, 0, 0, 0.14);
  --lg-separator:     rgba(60, 60, 67, 0.12);

  /* Type */
  --lg-label:         #1d1d1f;
  --lg-label-2:       rgba(60, 60, 67, 0.62);
  --lg-label-3:       rgba(60, 60, 67, 0.40);

  /* System colors */
  --lg-blue:   #007aff;
  --lg-green:  #34c759;
  --lg-red:    #ff3b30;
  --lg-orange: #ff9500;
  --lg-yellow: #ffcc00;
  --lg-purple: #af52de;
  --lg-gray:   #8e8e93;

  --lg-fill-blue:   rgba(0, 122, 255, 0.12);
  --lg-fill-green:  rgba(52, 199, 89, 0.14);
  --lg-fill-red:    rgba(255, 59, 48, 0.12);
  --lg-fill-orange: rgba(255, 149, 0, 0.14);
  --lg-fill-gray:   rgba(142, 142, 147, 0.14);

  /* Elevation — layered, soft, never harsh */
  --lg-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.05);
  --lg-shadow-2: 0 2px 6px rgba(0, 0, 0, 0.05), 0 12px 28px rgba(0, 0, 0, 0.08);
  --lg-shadow-3: 0 8px 24px rgba(0, 0, 0, 0.10), 0 32px 64px rgba(0, 0, 0, 0.14);

  /* Motion — iOS spring feel */
  --lg-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --lg-ease:   cubic-bezier(0.4, 0, 0.2, 1);

  --lg-radius:    16px;
  --lg-radius-sm: 12px;
  --lg-radius-lg: 22px;
}

html.dark {
  color-scheme: dark;

  --lg-canvas:        #000000;
  --lg-canvas-tint-a: rgba(10, 132, 255, 0.16);
  --lg-canvas-tint-b: rgba(191, 90, 242, 0.12);
  --lg-canvas-tint-c: rgba(48, 209, 88, 0.08);

  --lg-surface:       rgba(28, 28, 30, 0.68);
  --lg-surface-solid: #1c1c1e;
  --lg-surface-raise: rgba(44, 44, 46, 0.82);
  --lg-surface-sunk:  rgba(118, 118, 128, 0.20);

  --lg-border:        rgba(255, 255, 255, 0.12);
  --lg-border-strong: rgba(255, 255, 255, 0.20);
  --lg-separator:     rgba(84, 84, 88, 0.55);

  --lg-label:         #f5f5f7;
  --lg-label-2:       rgba(235, 235, 245, 0.60);
  --lg-label-3:       rgba(235, 235, 245, 0.35);

  --lg-blue:   #0a84ff;
  --lg-green:  #30d158;
  --lg-red:    #ff453a;
  --lg-orange: #ff9f0a;
  --lg-yellow: #ffd60a;
  --lg-purple: #bf5af2;
  --lg-gray:   #98989d;

  --lg-fill-blue:   rgba(10, 132, 255, 0.20);
  --lg-fill-green:  rgba(48, 209, 88, 0.20);
  --lg-fill-red:    rgba(255, 69, 58, 0.20);
  --lg-fill-orange: rgba(255, 159, 10, 0.20);
  --lg-fill-gray:   rgba(152, 152, 157, 0.20);

  --lg-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.40), 0 4px 12px rgba(0, 0, 0, 0.35);
  --lg-shadow-2: 0 2px 8px rgba(0, 0, 0, 0.45), 0 16px 32px rgba(0, 0, 0, 0.45);
  --lg-shadow-3: 0 8px 28px rgba(0, 0, 0, 0.55), 0 32px 72px rgba(0, 0, 0, 0.60);
}

/* ------------------------------------------------------------------
   Base
   ------------------------------------------------------------------ */

* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--lg-canvas);
  color: var(--lg-label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Soft aurora wash behind the glass, fixed so it never scrolls away. */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(46rem 46rem at 12% -6%,  var(--lg-canvas-tint-a), transparent 62%),
    radial-gradient(38rem 38rem at 92% 4%,   var(--lg-canvas-tint-b), transparent 60%),
    radial-gradient(42rem 42rem at 68% 96%,  var(--lg-canvas-tint-c), transparent 62%);
  filter: saturate(1.1);
}

[x-cloak] { display: none !important; }

::selection { background: var(--lg-fill-blue); }

/* Typography scale */
.lg-title-1 { font-size: 28px; font-weight: 700; letter-spacing: -0.022em; line-height: 1.18; }
.lg-title-2 { font-size: 21px; font-weight: 650; letter-spacing: -0.018em; line-height: 1.24; }
.lg-title-3 { font-size: 17px; font-weight: 600; letter-spacing: -0.014em; }
.lg-body    { font-size: 15px; font-weight: 400; }
.lg-callout { font-size: 13px; font-weight: 500; letter-spacing: -0.006em; }
.lg-caption { font-size: 12px; font-weight: 500; letter-spacing: 0.002em; color: var(--lg-label-2); }
.lg-mono    { font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
              font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lg-num     { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.lg-muted  { color: var(--lg-label-2); }
.lg-muted2 { color: var(--lg-label-3); }

/* ------------------------------------------------------------------
   Materials
   ------------------------------------------------------------------ */

.lg-glass {
  background: var(--lg-surface);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--lg-border);
  box-shadow: var(--lg-shadow-1);
  border-radius: var(--lg-radius);
}

.lg-glass-strong {
  background: var(--lg-surface-raise);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
  backdrop-filter: blur(40px) saturate(190%);
  border: 1px solid var(--lg-border);
  box-shadow: var(--lg-shadow-2);
  border-radius: var(--lg-radius-lg);
}

/* Browsers without backdrop-filter get an opaque surface instead of a
   washed-out translucent one. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .lg-glass, .lg-glass-strong { background: var(--lg-surface-solid); }
}

.lg-hairline { border-bottom: 1px solid var(--lg-separator); }

/* ------------------------------------------------------------------
   Controls
   ------------------------------------------------------------------ */

.lg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--lg-radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 550;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: transform 0.22s var(--lg-spring),
              background-color 0.2s var(--lg-ease),
              box-shadow 0.2s var(--lg-ease),
              opacity 0.2s var(--lg-ease);
}

.lg-btn:active   { transform: scale(0.96); }
.lg-btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

.lg-btn-primary {
  background: var(--lg-blue);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.10), 0 4px 14px rgba(0, 122, 255, 0.30);
}
.lg-btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.lg-btn-secondary {
  background: var(--lg-surface-sunk);
  color: var(--lg-label);
  border-color: var(--lg-border);
}
.lg-btn-secondary:hover:not(:disabled) { background: var(--lg-fill-gray); }

.lg-btn-danger { background: var(--lg-fill-red); color: var(--lg-red); }
.lg-btn-danger:hover:not(:disabled) { background: var(--lg-red); color: #fff; }

.lg-btn-plain {
  background: transparent;
  color: var(--lg-blue);
  padding: 7px 10px;
}
.lg-btn-plain:hover:not(:disabled) { background: var(--lg-fill-blue); }

/* Icon-only circular button (toolbar) */
.lg-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--lg-border);
  background: var(--lg-surface-sunk);
  color: var(--lg-label);
  cursor: pointer;
  transition: transform 0.22s var(--lg-spring), background-color 0.2s var(--lg-ease);
}
.lg-icon-btn:hover  { background: var(--lg-fill-gray); }
.lg-icon-btn:active { transform: scale(0.92); }

/* Text fields */
.lg-field {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--lg-radius-sm);
  border: 1px solid var(--lg-border);
  background: var(--lg-surface-sunk);
  color: var(--lg-label);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color 0.18s var(--lg-ease), box-shadow 0.18s var(--lg-ease),
              background-color 0.18s var(--lg-ease);
  appearance: none;
}
.lg-field::placeholder { color: var(--lg-label-3); }
.lg-field:focus {
  outline: none;
  border-color: var(--lg-blue);
  background: var(--lg-surface-solid);
  box-shadow: 0 0 0 3.5px var(--lg-fill-blue);
}

select.lg-field {
  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='%238e8e93' d='M6 8 0 1.6 1.5 0 6 4.7 10.5 0 12 1.6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.lg-label-text {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--lg-label-2);
}

/* Segmented control — the macOS/iOS pill with a sliding selection */
.lg-segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: 10px;
  background: var(--lg-surface-sunk);
  border: 1px solid var(--lg-border);
}

.lg-segment {
  position: relative;
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--lg-label-2);
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s var(--lg-ease), background-color 0.25s var(--lg-spring),
              box-shadow 0.25s var(--lg-spring), transform 0.2s var(--lg-spring);
}
.lg-segment:active { transform: scale(0.95); }
.lg-segment[aria-selected="true"] {
  background: var(--lg-surface-solid);
  color: var(--lg-label);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Badges / pills */
.lg-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
}
.lg-pill-green  { background: var(--lg-fill-green);  color: var(--lg-green); }
.lg-pill-orange { background: var(--lg-fill-orange); color: var(--lg-orange); }
.lg-pill-gray   { background: var(--lg-fill-gray);   color: var(--lg-gray); }
.lg-pill-blue   { background: var(--lg-fill-blue);   color: var(--lg-blue); }
.lg-pill-red    { background: var(--lg-fill-red);    color: var(--lg-red); }

/* Toggle switch */
.lg-switch {
  position: relative;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  border: 0;
  background: var(--lg-fill-gray);
  cursor: pointer;
  transition: background-color 0.3s var(--lg-spring);
  flex: none;
}
.lg-switch[aria-checked="true"] { background: var(--lg-green); }
.lg-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s var(--lg-spring);
}
.lg-switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ------------------------------------------------------------------
   Table
   ------------------------------------------------------------------ */

.lg-table { width: 100%; border-collapse: separate; border-spacing: 0; }

.lg-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 11px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lg-label-2);
  white-space: nowrap;
  background: var(--lg-surface-raise);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--lg-separator);
}

.lg-table thead th.sortable { cursor: pointer; user-select: none; }
.lg-table thead th.sortable:hover { color: var(--lg-label); }

.lg-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--lg-separator);
  vertical-align: middle;
}

.lg-table tbody tr { transition: background-color 0.15s var(--lg-ease); }
.lg-table tbody tr:hover { background: var(--lg-fill-gray); }
.lg-table tbody tr[data-selected="true"] { background: var(--lg-fill-blue); }
.lg-table tbody tr:last-child td { border-bottom: 0; }

.lg-scroll { overflow: auto; -webkit-overflow-scrolling: touch; }

.lg-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.lg-scroll::-webkit-scrollbar-track { background: transparent; }
.lg-scroll::-webkit-scrollbar-thumb {
  background: var(--lg-fill-gray);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
.lg-scroll::-webkit-scrollbar-thumb:hover { background: var(--lg-label-3); background-clip: content-box; }

/* ------------------------------------------------------------------
   Sheets, toasts, motion
   ------------------------------------------------------------------ */

.lg-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.lg-sheet {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  border-radius: var(--lg-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Grouped inset list, as in iOS Settings */
.lg-list {
  border-radius: var(--lg-radius-sm);
  overflow: hidden;
  background: var(--lg-surface-sunk);
  border: 1px solid var(--lg-border);
}
.lg-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--lg-separator);
}
.lg-list-row:last-child { border-bottom: 0; }

.lg-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  min-width: 260px;
  max-width: 380px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--lg-label);
  background: var(--lg-surface-raise);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--lg-border);
  box-shadow: var(--lg-shadow-3);
}

/* Determinate-feel progress bar for a running search */
.lg-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--lg-fill-gray);
  overflow: hidden;
}
.lg-progress > span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: var(--lg-blue);
  animation: lg-indeterminate 1.4s var(--lg-ease) infinite;
}

@keyframes lg-indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

@keyframes lg-spin { to { transform: rotate(360deg); } }
.lg-spin { animation: lg-spin 0.8s linear infinite; }

@keyframes lg-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.lg-rise { animation: lg-rise 0.45s var(--lg-spring) both; }

.lg-stagger > * { animation: lg-rise 0.5s var(--lg-spring) both; }
.lg-stagger > *:nth-child(1) { animation-delay: 0.02s; }
.lg-stagger > *:nth-child(2) { animation-delay: 0.06s; }
.lg-stagger > *:nth-child(3) { animation-delay: 0.10s; }
.lg-stagger > *:nth-child(4) { animation-delay: 0.14s; }
.lg-stagger > *:nth-child(5) { animation-delay: 0.18s; }
.lg-stagger > *:nth-child(6) { animation-delay: 0.22s; }

/* Cards lift slightly on hover, like a Finder icon under the cursor. */
.lg-lift { transition: transform 0.3s var(--lg-spring), box-shadow 0.3s var(--lg-spring); }
.lg-lift:hover { transform: translateY(-2px); box-shadow: var(--lg-shadow-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */

@media (max-width: 768px) {
  .lg-title-1 { font-size: 24px; }
  .lg-table thead th,
  .lg-table tbody td { padding: 10px 11px; }
  .lg-sheet { max-height: 92vh; }
}

@media print {
  body::before, .lg-no-print { display: none !important; }
  .lg-glass, .lg-glass-strong { box-shadow: none; background: #fff; }
}
