/* ==========================================================================
   TreePro — AI Estimate Tool
   Dark SaaS theme — mobile-first
   ========================================================================== */

/* ---------- Google Fonts: Geist ---------- */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700;800&family=Geist+Mono:wght@400;500;600&display=swap');

/* ---------- Custom properties ---------- */
:root {
  /* Backgrounds */
  --bg-body:    #0a0d0f;
  --bg-section: #0e1216;
  --bg-card:    #14191e;
  --bg-card-surface: rgba(255,255,255,0.035);

  /* Borders */
  --border:       rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);

  /* Text */
  --text-primary:   #e8edf2;
  --text-secondary: #b6bfc8;
  --text-muted:     #7c858f;

  /* Green accent */
  --green:       #22c55e;
  --green-hover: #16a34a;
  --green-soft:  rgba(34,197,94,0.12);
  --green-glow:  rgba(34,197,94,0.25);

  /* Cyan accent */
  --cyan:      #22d3ee;
  --cyan-soft: rgba(34,211,238,0.12);

  /* Red / danger */
  --red:        #dc2626;
  --red-bg:     #1a0a0a;
  --red-border: rgba(220,38,38,0.30);

  /* Amber */
  --amber: #f59e0b;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  --shadow-green: 0 0 20px rgba(34,197,94,0.20), 0 4px 16px rgba(0,0,0,.5);

  --transition: 180ms ease;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'Fira Code', monospace;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: var(--green); }
ul { list-style: none; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

.hidden { display: none !important; }

/* ---------- Header ---------- */
.site-header {
  background: var(--bg-section);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon { font-size: 1.5rem; }
.logo-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text-primary);
}

.header-tagline {
  font-size: 0.78rem;
  color: var(--green);
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: .4px;
  margin-left: auto;
  text-transform: uppercase;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 40px 0 28px;
}

.hero-title {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.hero-title span {
  color: var(--green);
  text-shadow: 0 0 30px rgba(34,197,94,0.35);
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 520px;
  margin: 0 auto 22px;
}

.trust-badges {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.trust-badges li span { margin-right: 4px; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(135deg, rgba(255,255,255,0.035) 0%, transparent 60%), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.card-section-title {
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Form elements ---------- */
.fieldset {
  border: none;
  margin-bottom: 24px;
}

.fieldset-legend {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 14px;
  width: 100%;
}

.fieldset-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  margin-top: -8px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 420px) {
  .field-row { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 5px; }

label {
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  letter-spacing: .3px;
}

.required { color: var(--red); }

input[type="text"],
input[type="tel"],
input[type="email"] {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  width: 100%;
}

input[type="text"]::placeholder,
input[type="tel"]::placeholder,
input[type="email"]::placeholder {
  color: var(--text-muted);
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--green);
  background: rgba(34,197,94,0.04);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}

input.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.15);
}

.field-error {
  font-size: 0.78rem;
  color: var(--red);
  min-height: 1.1em;
  font-family: var(--font-mono);
}

/* Photo validation error — styled alert box matching safety warnings */
#photo-error:not(:empty) {
  display: block;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 10px;
  font-size: 0.875rem;
  color: #fca5a5;
  font-family: var(--font-mono);
  line-height: 1.5;
}

/* ---------- Service selector ---------- */
.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 360px) {
  .service-grid { grid-template-columns: 1fr; }
}

.service-option { cursor: pointer; }

.service-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.service-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  user-select: none;
  text-align: center;
}

.service-option input:checked + .service-card {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 0 0 1px var(--green), inset 0 0 20px rgba(34,197,94,0.05);
}

.service-option:hover .service-card {
  border-color: rgba(34,197,94,0.5);
  background: rgba(34,197,94,0.06);
}

.service-option input:focus-visible + .service-card {
  box-shadow: 0 0 0 3px rgba(34,197,94,0.3);
}

.service-icon { font-size: 1.5rem; line-height: 1; }
.service-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); font-family: var(--font-mono); }

/* ---------- Photo upload ---------- */
.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
  background: rgba(255,255,255,0.02);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--green);
  background: var(--green-soft);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-main { font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.upload-sub { font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-mono); }

.photo-previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.preview-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg-section);
  border: 1px solid var(--border);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.75);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.preview-remove:hover { background: var(--red); border-color: var(--red); }

/* ---------- Form privacy note ---------- */
.form-privacy {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 16px;
  font-family: var(--font-mono);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  line-height: 1.2;
}

.btn:active { transform: scale(0.98); }
.btn-full { width: 100%; }

.btn-primary {
  background: var(--green);
  color: #0a0d0f;
  border-color: var(--green);
  font-weight: 700;
}

.btn-primary:hover {
  background: var(--green-hover);
  border-color: var(--green-hover);
  box-shadow: var(--shadow-green);
}

.btn-primary:disabled {
  background: rgba(255,255,255,0.08);
  border-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

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

/* ---------- Loading ---------- */
.loading-card {
  text-align: center;
  padding: 48px 24px;
}

.loading-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.spinner {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(34,197,94,0.15);
  border-top-color: var(--green);
  animation: spin 1s linear infinite;
  box-shadow: 0 0 20px rgba(34,197,94,0.15);
}

.spinner-tree {
  font-size: 1.8rem;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .65; transform: scale(0.9); }
}

.loading-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.loading-step {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  min-height: 1.4em;
  transition: opacity .3s;
}

.loading-steps {
  display: flex;
  gap: 8px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  transition: background .3s, box-shadow .3s;
}

.step-dot.active {
  background: var(--green);
  box-shadow: 0 0 8px rgba(34,197,94,0.5);
}

/* ---------- Results ---------- */
.results-header {
  text-align: center;
  padding: 24px 0 4px;
}

.results-check { font-size: 2.4rem; display: block; margin-bottom: 8px; }
.results-header h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; color: var(--text-primary); }
.results-sub { color: var(--text-muted); font-size: 0.88rem; font-family: var(--font-mono); margin-bottom: 20px; }

/* Assessment grid */
.assessment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.assessment-item {
  background: rgba(255,255,255,0.03);
  padding: 12px 14px;
}

.assessment-item dt {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 3px;
}

.assessment-item dd {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Condition color coding */
.condition-healthy  { color: var(--green); }
.condition-fair     { color: var(--amber); }
.condition-poor     { color: #f97316; }
.condition-hazardous { color: var(--red); }

/* Complexity color coding */
.complexity-low      { color: var(--green); }
.complexity-medium   { color: var(--amber); }
.complexity-high     { color: #f97316; }
.complexity-very-high { color: var(--red); }

/* Tags */
.tag-list-wrap { margin-bottom: 14px; }
.tag-list-label {
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list li {
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34,197,94,0.2);
}

/* Safety alert */
.safety-alert {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 4px;
}

.safety-title {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--red);
  margin-bottom: 6px;
}

.safety-list { padding-left: 0; }
.safety-list li {
  font-size: 0.875rem;
  color: #fca5a5;
  padding: 2px 0 2px 18px;
  position: relative;
}

.safety-list li::before {
  content: '•';
  position: absolute;
  left: 6px;
  color: var(--red);
}

/* Estimate table */
.estimate-card { padding-top: 20px; }

.service-badge {
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.7rem;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .4px;
  border: 1px solid rgba(34,197,94,0.2);
}

.line-items {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.line-items th, .line-items td {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.line-items thead th {
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  padding-bottom: 10px;
}

.line-items tbody td { color: var(--text-secondary); }
.line-items tbody th { color: var(--text-primary); font-weight: 500; }

.col-price { text-align: right; white-space: nowrap; }

.total-row th, .total-row td {
  padding-top: 14px;
  border-bottom: none;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(34,197,94,0.06);
  padding-left: 8px;
  padding-right: 8px;
}

.total-row th {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.total-row td {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.total-range {
  color: var(--green);
  font-size: 1.15rem;
  text-shadow: 0 0 20px rgba(34,197,94,0.3);
}

.estimate-notes {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 14px;
  line-height: 1.5;
}

.disclaimer {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  font-family: var(--font-mono);
}

/* CTA card */
.cta-card {
  text-align: center;
  background: linear-gradient(135deg, rgba(34,197,94,0.08) 0%, rgba(34,197,94,0.03) 100%), var(--bg-card);
  border-color: rgba(34,197,94,0.2);
}

.cta-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; color: var(--text-primary); }
.cta-body { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.5; }

.cta-card .btn-primary {
  font-size: 1.05rem;
  box-shadow: var(--shadow-green);
}

.cta-or {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  margin: 12px 0;
}

/* Error card */
.error-card {
  text-align: center;
  border: 1px solid rgba(220,38,38,0.3);
  background: var(--red-bg);
}

.error-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 8px;
}

.error-msg {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  text-align: center;
  padding: 20px 0;
  margin-top: 40px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.footer-fine {
  color: rgba(255,255,255,0.2);
  margin-top: 6px;
  font-size: 0.72rem;
}

/* ---------- Utility ---------- */
#footer-year { font-variant-numeric: tabular-nums; }

/* Focus-visible polish for keyboard nav */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}
