/* ============================================================
   Flow Systems Demo — Contact Form Styles
   ============================================================ */

:root {
  --color-primary: #00695C;
  --color-primary-dark: #004D40;
  --color-secondary: #26A69A;
  --color-accent: #4DB6AC;
  --color-bg: #0a0f0d;
  --color-bg-card: #111f1b;
  --color-text: #e8f5e9;
  --color-text-muted: #80cbc4;
  --color-border: #1b3a34;
  --color-input-bg: #0d1512;
  --color-error: #ef5350;
  --color-error-bg: rgba(239, 83, 80, 0.08);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* ---- Reset & Base ---- */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ---- Page Glow ---- */

.page-glow {
  position: fixed;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 120vw;
  height: 80vh;
  background: radial-gradient(
    ellipse 60% 50% at 50% 0%,
    rgba(0, 105, 92, 0.12) 0%,
    rgba(0, 105, 92, 0.04) 40%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* ---- Header ---- */

.site-header {
  position: relative;
  z-index: 10;
  padding: 16px 20px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 540px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  flex-shrink: 0;
}

.brand-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.brand-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  background: rgba(77, 182, 172, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

/* ---- Main ---- */

.main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 20px 40px;
  width: 100%;
}

/* ---- Hero ---- */

.hero {
  text-align: center;
  margin-bottom: 32px;
  max-width: 480px;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ---- Form Section ---- */

.form-section {
  width: 100%;
  max-width: 480px;
  animation: fadeSlideUp 0.5s ease both;
}

/* ---- Form Card ---- */

.lead-form {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 32px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(77, 182, 172, 0.04),
    0 4px 24px rgba(0, 0, 0, 0.3),
    0 0 80px -20px rgba(0, 105, 92, 0.15);
}

/* ---- Form Groups ---- */

.form-group {
  margin-bottom: 20px;
}

.form-group:last-of-type {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

/* ---- Inputs ---- */

.form-input,
.form-select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-input-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: rgba(128, 203, 196, 0.35);
}

.form-input:hover,
.form-select:hover {
  border-color: rgba(38, 166, 154, 0.4);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(38, 166, 154, 0.15);
  background: rgba(13, 21, 18, 0.8);
}

/* Invalid state */
.form-input.is-invalid,
.form-select.is-invalid {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.1);
}

.form-input.is-invalid:focus,
.form-select.is-invalid:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.15);
}

/* ---- Select Wrapper ---- */

.select-wrapper {
  position: relative;
}

.select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.form-select:focus + .select-chevron {
  color: var(--color-secondary);
}

.form-select option {
  background: var(--color-bg-card);
  color: var(--color-text);
}

/* ---- Zip Code Input ---- */

.zip-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.zip-input {
  flex: 1;
  min-width: 0;
}

.zip-add-btn {
  height: 48px;
  padding: 0 18px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-primary);
  border: 1.5px solid var(--color-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.zip-add-btn:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-accent);
}

.zip-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.zip-selected:empty {
  display: none;
}

.zip-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-accent);
  background: rgba(38, 166, 154, 0.15);
  border: 1.5px solid var(--color-secondary);
  border-radius: 20px;
}

.zip-selected-chip .zip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}

.zip-selected-chip .zip-remove:hover {
  color: var(--color-error);
}

.zip-suggestions-details {
  margin-top: 10px;
}

.zip-suggestions-toggle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 8px;
  list-style: none;
  transition: color var(--transition-fast);
}

.zip-suggestions-toggle::-webkit-details-marker {
  display: none;
}

.zip-suggestions-toggle::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 6px;
  transition: transform var(--transition-fast);
}

.zip-suggestions-details[open] > .zip-suggestions-toggle::before {
  transform: rotate(90deg);
}

.zip-suggestions-toggle:hover {
  color: var(--color-accent);
}

/* ---- Zip Code Chips ---- */

.zip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.zip-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-input-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.zip-chip .zip-label {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.6;
}

.zip-chip:hover {
  border-color: rgba(38, 166, 154, 0.4);
  color: var(--color-text);
}

.zip-chip.selected {
  background: rgba(38, 166, 154, 0.15);
  border-color: var(--color-secondary);
  color: var(--color-accent);
}

.zip-chip.selected .zip-label {
  opacity: 0.8;
}

/* ---- Range Slider ---- */

.range-display {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-accent);
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.range-slider {
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
}

.range-track {
  position: absolute;
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  pointer-events: none;
}

.range-fill {
  position: absolute;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 2px;
  pointer-events: none;
}

.range-input {
  position: absolute;
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
  outline: none;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-secondary);
  border: 2px solid var(--color-bg-card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), 0 0 8px rgba(38, 166, 154, 0.3);
  cursor: pointer;
  pointer-events: auto;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 16px rgba(38, 166, 154, 0.4);
}

.range-input::-webkit-slider-thumb:active {
  transform: scale(1.05);
}

.range-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-secondary);
  border: 2px solid var(--color-bg-card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), 0 0 8px rgba(38, 166, 154, 0.3);
  cursor: pointer;
  pointer-events: auto;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: rgba(128, 203, 196, 0.35);
  margin-top: 2px;
}

/* ---- Form Row (side by side) ---- */

.form-row {
  display: flex;
  gap: 14px;
}

.form-group--half {
  flex: 1;
}

/* ---- Validation Errors ---- */

.form-error {
  display: block;
  min-height: 0;
  font-size: 0.78rem;
  color: var(--color-error);
  margin-top: 4px;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.form-error:empty {
  margin-top: 0;
}

.form-error-global {
  font-size: 0.85rem;
  color: var(--color-error);
  background: var(--color-error-bg);
  border-radius: var(--radius-sm);
  padding: 0;
  margin-bottom: 0;
  max-height: 0;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.form-error-global.is-visible {
  padding: 12px 14px;
  margin-bottom: 16px;
  max-height: 80px;
}

/* ---- Submit Button ---- */

.submit-btn {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-normal),
    opacity var(--transition-fast);
  box-shadow:
    0 2px 8px rgba(0, 105, 92, 0.25),
    0 0 20px -4px rgba(38, 166, 154, 0.2);
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 16px rgba(0, 105, 92, 0.35),
    0 0 30px -4px rgba(38, 166, 154, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.submit-btn-spinner {
  display: none;
  animation: spin 0.8s linear infinite;
}

.submit-btn.is-loading .submit-btn-text {
  display: none;
}

.submit-btn.is-loading .submit-btn-spinner {
  display: block;
}

/* ---- Confirmation ---- */

.confirmation-section {
  width: 100%;
  max-width: 480px;
  animation: fadeSlideUp 0.5s ease both;
}

.confirmation-section[hidden] {
  display: none;
}

.confirmation-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 28px;
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(77, 182, 172, 0.04),
    0 4px 24px rgba(0, 0, 0, 0.3),
    0 0 80px -20px rgba(0, 105, 92, 0.15);
}

.confirmation-icon-wrap {
  margin-bottom: 24px;
}

.confirmation-icon {
  animation: scaleIn 0.4s ease both;
  animation-delay: 0.2s;
}

.confirmation-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--color-text);
}

.confirmation-body {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 360px;
  margin: 0 auto;
}

.confirmation-body strong {
  color: var(--color-accent);
  font-weight: 600;
}

.reset-btn {
  margin-top: 28px;
  padding: 10px 20px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.reset-btn:hover {
  border-color: var(--color-secondary);
  color: var(--color-text);
}

.reset-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---- Footer ---- */

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  font-size: 0.75rem;
  color: rgba(128, 203, 196, 0.3);
}

.site-footer strong {
  font-weight: 500;
  color: rgba(128, 203, 196, 0.45);
}

/* ---- Animations ---- */

@keyframes fadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

@media (min-width: 640px) {
  .hero-title {
    font-size: 2.25rem;
  }

  .hero-subtitle {
    font-size: 1.05rem;
  }

  .lead-form {
    padding: 36px 32px 40px;
  }

  .confirmation-card {
    padding: 56px 36px;
  }
}

@media (max-width: 359px) {
  .lead-form {
    padding: 20px 16px 24px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .hero-title {
    font-size: 1.5rem;
  }
}

/* ---- Reduced Motion ---- */

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