/* CGHA – California Green Home Access
   Mobile-first, clean, trustworthy design */

:root {
  --navy: #1a3a5c;
  --navy-dark: #122a42;
  --green: #2d8a4e;
  --green-light: #3cb371;
  --green-bg: #e8f5ec;
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #64748b;
  --gray-800: #1e293b;
  --red: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(26, 58, 92, 0.08);
  --shadow-lg: 0 8px 32px rgba(26, 58, 92, 0.12);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

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

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--green);
  text-decoration: none;
}

a:active {
  opacity: 0.8;
}

img {
  max-width: 100%;
  height: auto;
}

.hidden {
  display: none !important;
}

/* App shell */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--white);
  position: relative;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.header-phone {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  padding: 8px 12px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
}

.header-phone:active {
  background: var(--gray-200);
}

/* Progress */
.progress-container {
  padding: 12px 16px 0;
  background: var(--white);
}

.progress-track {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--green));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 6px;
  text-align: center;
}

/* Screens */
.screen {
  display: none;
  flex: 1;
  padding: 24px 20px;
  animation: fadeIn 0.35s ease;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Landing / Hero */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 20px 0 32px;
}

.hero-badge {
  display: inline-block;
  align-self: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-bg);
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.hero-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.25;
  margin-bottom: 14px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 32px;
  padding: 0 8px;
}

.trust-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 20px 0;
  border-top: 1px solid var(--gray-200);
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--gray-600);
  background: var(--gray-50);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.trust-icon {
  color: var(--green);
  font-weight: 700;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--navy) 0%, var(--green) 100%);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-primary:active:not(:disabled) {
  box-shadow: var(--shadow-lg);
}

.btn-lg {
  padding: 18px 28px;
  font-size: 15px;
  width: 100%;
}

.btn-block {
  width: 100%;
  padding: 16px 24px;
  margin-top: 20px;
}

/* Steps / Questionnaire */
.step-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 8px;
}

.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  font-family: var(--font);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--gray-800);
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45, 138, 78, 0.15);
}

.input-lg {
  font-size: 24px;
  text-align: center;
  letter-spacing: 4px;
  padding: 18px;
}

.input.error {
  border-color: var(--red);
}

.field-error {
  font-size: 13px;
  color: var(--red);
  margin-top: 6px;
}

/* Option buttons */
.option-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  text-align: left;
  color: var(--gray-800);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.option-btn:active {
  transform: scale(0.99);
}

.option-btn.selected {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--navy);
}

/* Upgrade grid */
.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.option-grid .option-btn {
  text-align: center;
  font-size: 13px;
  padding: 14px 10px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-grid .option-btn.selected {
  box-shadow: 0 0 0 2px var(--green);
}

/* Form row */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Verification screen */
.verification {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 0;
}

.verification-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 28px;
}

.spinner-ring {
  width: 80px;
  height: 80px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.4s ease;
}

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

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.verification-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}

.verification-message {
  font-size: 15px;
  color: var(--gray-600);
  min-height: 24px;
  transition: opacity 0.3s ease;
}

.verification-progress {
  width: 100%;
  max-width: 280px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin-top: 32px;
  overflow: hidden;
}

.verification-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--navy), var(--green));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Approval screen */
.approval-badge {
  text-align: center;
  margin-bottom: 16px;
}

.approval-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 14px;
  text-align: center;
}

.approval-text {
  font-size: 15px;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 20px;
  text-align: center;
}

.status-badge {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-bg);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 28px;
  border: 1px solid rgba(45, 138, 78, 0.2);
}

.contact-form {
  margin-top: 8px;
}

.consent-text {
  font-size: 11px;
  color: var(--gray-600);
  line-height: 1.6;
  margin-top: 16px;
  text-align: center;
}

.consent-text a {
  color: var(--navy);
  text-decoration: underline;
}

/* Confirmation screen */
.confirmation-icon {
  text-align: center;
  margin-bottom: 20px;
}

.confirmation-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  margin-bottom: 14px;
}

.confirmation-text {
  font-size: 15px;
  color: var(--gray-600);
  line-height: 1.6;
  text-align: center;
  margin-bottom: 28px;
}

.confirmation-details {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-200);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 13px;
  color: var(--gray-600);
}

.detail-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.status-approved {
  color: var(--green);
}

.confirmation-phone {
  text-align: center;
  font-size: 15px;
  color: var(--gray-600);
}

.confirmation-phone a {
  font-weight: 700;
  color: var(--navy);
  font-size: 18px;
}

/* Footer */
.footer {
  padding: 16px 20px calc(16px + var(--safe-bottom));
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.footer-links {
  margin-top: 4px;
}

.footer-links a {
  color: var(--gray-600);
}

/* Tablet / Desktop enhancement */
@media (min-width: 481px) {
  .app {
    box-shadow: var(--shadow-lg);
    margin-top: 20px;
    margin-bottom: 20px;
    min-height: calc(100vh - 40px);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .hero-title {
    font-size: 30px;
  }

  .step-title {
    font-size: 24px;
  }
}

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