/* =========================================
   SNAP Impact Estimator — Web App Styles
   Brand: joelmcclurg.ai design tokens
   ========================================= */

:root {
  --bg: #FAFAFA;
  --bg-card: #F3F4F6;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --blue: #2563EB;
  --blue-light: #EFF6FF;
  --blue-hover: #1D4ED8;
  --orange: #E87B35;
  --orange-light: #FFF7ED;
  --white: #FFFFFF;
  --border: #E5E7EB;
  --green: #059669;
  --green-light: #ECFDF5;
  --yellow: #D97706;
  --yellow-light: #FFFBEB;
  --red: #DC2626;
  --red-light: #FEF2F2;
  --font-body: 'DM Sans', sans-serif;
  --font-display: 'Fraunces', serif;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 2rem;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.app-header .subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.app-header .header-description {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 0.75rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.disclaimer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0;
}
.disclaimer-sources {
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

/* Form Elements */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.form-group label .required {
  font-weight: 600;
  color: var(--red);
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group .hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Buttons */
.btn-primary {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--blue-hover);
}

.btn-primary:disabled {
  background: var(--border);
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  margin-left: 0.5rem;
}

.btn-secondary:hover {
  background: var(--blue-light);
}

/* Error Messages */
.error-msg {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--red-light);
  color: var(--red);
  border-radius: 8px;
  font-size: 0.9rem;
}

/* Tip Box */
.tip-box {
  background: var(--blue-light);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: var(--text);
}

.tip-box a {
  color: var(--blue);
  font-weight: 500;
}

/* Source Badges (reused in banners) */

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-direct {
  background: var(--blue-light);
  color: var(--blue);
}

.badge-estimated {
  background: var(--green-light);
  color: var(--green);
}

.badge-recommended {
  background: #F3E8FF;
  color: #7C3AED;
}

.badge-web-search {
  background: var(--yellow-light);
  color: var(--yellow);
}

.badge-projected {
  background: var(--orange-light);
  color: var(--orange);
}

/* Report Banners */
.report-data-banner {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  padding: 0.85rem 1.1rem;
}

.banner-summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.banner-source {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

.banner-refine-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.banner-refine-btn:hover {
  background: var(--blue-light);
  border-color: var(--blue);
}

.refine-panel {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.refine-fields {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.refine-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.refine-field input[type="number"],
.refine-field input[type="text"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: var(--font-body);
  color: var(--text);
}

.refine-field input[type="number"] {
  width: 140px;
}

.refine-field input[type="text"] {
  width: 100%;
}

.refine-field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.refine-field-grow {
  flex: 1;
  min-width: 160px;
}

.refine-field-btn {
  flex-shrink: 0;
}

.refine-field-btn .btn-primary {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.county-upgrade-banner {
  background: var(--blue-light);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-top: none;
  padding: 0.7rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.county-upgrade-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.25rem;
  color: #999;
  line-height: 1;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.county-upgrade-dismiss:hover {
  color: var(--text);
}

.county-upgrade-banner a {
  color: var(--blue);
  font-weight: 500;
  text-decoration: none;
}

.county-upgrade-banner a:hover {
  text-decoration: underline;
}

.inferred-note-banner {
  background: #fff8e1;
  border: 1px solid rgba(249, 168, 37, 0.3);
  border-top: none;
  padding: 0.6rem 1.1rem;
  font-size: 0.83rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inferred-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.25rem;
  color: #999;
  line-height: 1;
}

.inferred-dismiss:hover {
  color: var(--text);
}

.report-iframe {
  display: block;
  border-radius: 0 0 11px 11px;
}

/* Loading */
.loading-container {
  text-align: center;
  padding: 2rem 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-container p {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

.loading-sub {
  font-size: 0.83rem !important;
  color: var(--text-muted) !important;
  font-weight: 400 !important;
  margin-top: 0.3rem;
}

/* Report */
#report-section {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% + 200px);
  position: relative;
  left: -100px;
}

@media (max-width: 1280px) {
  #report-section {
    width: 100%;
    left: 0;
  }
}

.report-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.report-actions .btn-secondary {
  margin-left: 0;
}

.report-frame {
  background: var(--white);
}

/* Footer */
.app-footer {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.app-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-footer a {
  color: var(--blue);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

.footer-note {
  margin-top: 1rem;
  font-size: 0.75rem !important;
  font-style: italic;
}

/* Responsive */
@media (max-width: 600px) {
  .app-container {
    padding: 1.25rem 1rem;
  }

  .app-header h1 {
    font-size: 1.4rem;
  }

  .card {
    padding: 1.25rem;
  }

  .refine-fields {
    flex-direction: column;
  }
  .refine-field input[type="number"] {
    width: 100%;
  }
  .banner-refine-btn {
    margin-left: 0;
    margin-top: 0.35rem;
  }
}
