/* Copyright (c) 2026 Luis Hernandez. All Rights Reserved. */
/* Proprietary and confidential. Unauthorized use prohibited. */

/* ============================================================
   CSS custom properties — host site can override these
   ============================================================ */
:root {
  --re-primary:        #1F5C99;
  --re-primary-dark:   #174577;
  --re-accent:         #2E75B6;
  --re-accent-light:   #EAF2FB;
  --re-success:        #1A7F4E;
  --re-success-light:  #E6F6EE;
  --re-error:          #C0392B;
  --re-error-light:    #FDEDEC;
  --re-text:           #1A1A2E;
  --re-text-muted:     #6B7280;
  --re-border:         #D1D5DB;
  --re-bg:             #FFFFFF;
  --re-bg-alt:         #F8FAFC;
  --re-radius:         10px;
  --re-shadow:         0 4px 24px rgba(31,92,153,0.10);
  --re-font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================================
   Widget wrapper — scoped to .re-widget
   ============================================================ */
.re-widget * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.re-widget {
  font-family: var(--re-font);
  color: var(--re-text);
  background: var(--re-bg);
  border-radius: var(--re-radius);
  box-shadow: var(--re-shadow);
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

/* ============================================================
   Header
   ============================================================ */
.re-header {
  background: var(--re-primary);
  color: #fff;
  padding: 20px 24px 16px;
  text-align: center;
}

.re-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.re-header p {
  font-size: 0.88rem;
  opacity: 0.88;
}

/* ============================================================
   Progress bar
   ============================================================ */
.re-progress {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  background: var(--re-bg-alt);
  border-bottom: 1px solid var(--re-border);
  gap: 8px;
}

.re-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--re-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--re-text-muted);
  flex-shrink: 0;
  transition: all 0.25s;
}

.re-step-dot.re-active {
  background: var(--re-primary);
  border-color: var(--re-primary);
  color: #fff;
}

.re-step-dot.re-done {
  background: var(--re-success);
  border-color: var(--re-success);
  color: #fff;
}

.re-step-line {
  flex: 1;
  height: 2px;
  background: var(--re-border);
  border-radius: 1px;
  transition: background 0.25s;
}

.re-step-line.re-done {
  background: var(--re-success);
}

.re-step-label {
  font-size: 0.72rem;
  color: var(--re-text-muted);
  text-align: center;
  margin-top: 4px;
  white-space: nowrap;
}

.re-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 24px 10px;
  background: var(--re-bg-alt);
  border-bottom: 1px solid var(--re-border);
}

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

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

.re-progress-text {
  font-size: 0.78rem;
  color: var(--re-text-muted);
}

/* ============================================================
   Panels / Steps
   ============================================================ */
.re-panel {
  display: none;
  padding: 24px;
  animation: re-fadeIn 0.25s ease;
}

.re-panel.re-active {
  display: block;
}

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

.re-panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--re-primary);
}

.re-panel-subtitle {
  font-size: 0.88rem;
  color: var(--re-text-muted);
  margin-bottom: 18px;
}

/* ============================================================
   Map panel
   ============================================================ */
.re-address-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.re-address-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--re-border);
  border-radius: var(--re-radius);
  font-size: 0.95rem;
  font-family: var(--re-font);
  color: var(--re-text);
  outline: none;
  transition: border-color 0.2s;
}

.re-address-input:focus {
  border-color: var(--re-accent);
}

#re-map {
  width: 100%;
  min-height: 400px;
  border-radius: var(--re-radius);
  overflow: hidden;
  border: 1.5px solid var(--re-border);
  margin-bottom: 12px;
}

.re-map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.re-sqft-display {
  background: var(--re-accent-light);
  border: 1.5px solid var(--re-accent);
  border-radius: var(--re-radius);
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--re-primary);
  font-weight: 600;
}

.re-map-hint {
  font-size: 0.82rem;
  color: var(--re-text-muted);
  margin-bottom: 14px;
  background: var(--re-bg-alt);
  border-radius: 6px;
  padding: 8px 12px;
  border-left: 3px solid var(--re-accent);
}

/* ============================================================
   Buttons
   ============================================================ */
.re-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: var(--re-radius);
  font-family: var(--re-font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.18s;
  text-decoration: none;
}

.re-btn-primary {
  background: var(--re-primary);
  color: #fff;
}

.re-btn-primary:hover {
  background: var(--re-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31,92,153,0.25);
}

.re-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.re-btn-outline {
  background: transparent;
  color: var(--re-primary);
  border: 1.5px solid var(--re-primary);
}

.re-btn-outline:hover {
  background: var(--re-accent-light);
}

.re-btn-ghost {
  background: transparent;
  color: var(--re-text-muted);
  border: 1.5px solid var(--re-border);
  font-size: 0.85rem;
}

.re-btn-ghost:hover {
  background: var(--re-bg-alt);
}

.re-btn-lg {
  padding: 15px 30px;
  font-size: 1.05rem;
  width: 100%;
}

.re-btn-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  gap: 10px;
}

/* ============================================================
   Questionnaire — option cards
   ============================================================ */
.re-options {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.re-options.re-2col { grid-template-columns: repeat(2, 1fr); }
.re-options.re-3col { grid-template-columns: repeat(3, 1fr); }
.re-options.re-4col { grid-template-columns: repeat(2, 1fr); }

.re-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 2px solid var(--re-border);
  border-radius: var(--re-radius);
  cursor: pointer;
  background: var(--re-bg);
  transition: all 0.18s;
  text-align: center;
}

.re-option-card:hover {
  border-color: var(--re-accent);
  background: var(--re-accent-light);
}

.re-option-card.re-selected {
  border-color: var(--re-primary);
  background: var(--re-accent-light);
  box-shadow: 0 0 0 3px rgba(31,92,153,0.12);
}

.re-option-icon {
  font-size: 2rem;
  line-height: 1;
}

.re-option-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--re-text);
}

.re-option-desc {
  font-size: 0.76rem;
  color: var(--re-text-muted);
}

/* ============================================================
   Estimate display
   ============================================================ */
.re-estimate-card {
  background: var(--re-success-light);
  border: 2px solid var(--re-success);
  border-radius: var(--re-radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 18px;
}

.re-estimate-label {
  font-size: 0.9rem;
  color: var(--re-success);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.re-estimate-range {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--re-success);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.re-estimate-summary {
  font-size: 0.84rem;
  color: var(--re-text-muted);
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--re-bg);
  border-radius: 6px;
}

.re-disclaimer {
  font-size: 0.82rem;
  color: var(--re-text-muted);
  background: var(--re-bg-alt);
  border-radius: 6px;
  padding: 12px 14px;
  border-left: 3px solid var(--re-border);
  margin-bottom: 18px;
}

/* ============================================================
   Contact form
   ============================================================ */
.re-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.re-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.re-form-group.re-full {
  grid-column: 1 / -1;
}

.re-label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--re-text);
}

.re-label .re-required {
  color: var(--re-error);
  margin-left: 2px;
}

.re-input,
.re-select,
.re-textarea {
  padding: 10px 13px;
  border: 1.5px solid var(--re-border);
  border-radius: 7px;
  font-family: var(--re-font);
  font-size: 0.92rem;
  color: var(--re-text);
  background: var(--re-bg);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.re-input:focus,
.re-select:focus,
.re-textarea:focus {
  border-color: var(--re-accent);
}

.re-input.re-error-field,
.re-select.re-error-field,
.re-textarea.re-error-field {
  border-color: var(--re-error);
}

.re-textarea {
  resize: vertical;
  min-height: 80px;
}

.re-field-error {
  font-size: 0.78rem;
  color: var(--re-error);
  margin-top: 2px;
}

/* ============================================================
   Alerts / messages
   ============================================================ */
.re-alert {
  padding: 12px 16px;
  border-radius: 7px;
  font-size: 0.88rem;
  margin-bottom: 14px;
  display: none;
}

.re-alert.re-show { display: block; }

.re-alert-error {
  background: var(--re-error-light);
  color: var(--re-error);
  border: 1px solid rgba(192,57,43,0.3);
}

.re-alert-info {
  background: var(--re-accent-light);
  color: var(--re-primary);
  border: 1px solid rgba(46,117,182,0.3);
}

/* ============================================================
   Spinner
   ============================================================ */
.re-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: re-spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* ============================================================
   Confirmation screen
   ============================================================ */
.re-confirm {
  text-align: center;
  padding: 40px 24px;
}

.re-confirm-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.re-confirm-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--re-success);
  margin-bottom: 10px;
}

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

/* ============================================================
   Responsive — mobile
   ============================================================ */
@media (max-width: 540px) {
  .re-panel { padding: 16px; }
  .re-header { padding: 16px 16px 12px; }
  .re-header h1 { font-size: 1.1rem; }
  .re-options.re-3col { grid-template-columns: repeat(2, 1fr); }
  .re-options.re-4col { grid-template-columns: repeat(2, 1fr); }
  .re-form-grid { grid-template-columns: 1fr; }
  .re-estimate-range { font-size: 1.8rem; }
  .re-btn-row { flex-direction: column-reverse; }
  .re-btn-row .re-btn { width: 100%; }
  #re-map { min-height: 300px; }
}
