/* ===== ECI Quote App — Clean Minimal ===== */

:root {
  --black: #111;
  --white: #fff;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #868e96;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --red: #dc2626;
  --red-light: #fef2f2;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

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

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-900);
  min-height: 100vh;
  line-height: 1.5;
}

/* --- Layout --- */
.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sticky-top {
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
}

.call-bar {
  background: var(--blue);
  padding: 8px 20px;
  text-align: center;
}
.call-bar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.call-bar-link:hover {
  opacity: 0.9;
}
.call-bar-link svg {
  flex-shrink: 0;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
  height: 28px;
  width: auto;
  filter: invert(1);
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: 0.02em;
}

.logo span {
  font-weight: 400;
  color: var(--gray-600);
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 60px;
}

.container {
  width: 100%;
  max-width: 560px;
}

/* --- Hero --- */
.hero {
  text-align: center;
  margin-bottom: 32px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-light);
  border-radius: 100px;
  padding: 5px 14px;
  margin-bottom: 16px;
}

.hero-tag .dot {
  width: 6px;
  height: 6px;
  background: var(--blue);
  border-radius: 50%;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 8px;
}

.hero h1 em {
  font-style: normal;
  color: var(--blue);
}

.hero p {
  font-size: 0.95rem;
  color: var(--gray-600);
}

/* --- Stepper --- */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}

.step-item {
  display: flex;
  align-items: center;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid var(--gray-300);
  color: var(--gray-500);
  background: var(--white);
  transition: all 0.2s ease;
}

.step-circle .check-icon {
  display: none;
}

.step-item.active .step-circle {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}

.step-item.completed .step-circle {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}

.step-item.completed .step-circle .step-num {
  display: none;
}

.step-item.completed .step-circle .check-icon {
  display: block;
}

.step-line {
  width: 40px;
  height: 2px;
  background: var(--gray-300);
  transition: background 0.2s ease;
}

.step-line.filled {
  background: var(--blue);
}

.step-label {
  display: none;
}

/* --- Form Panels --- */
.form-panel {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

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

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 4px;
}

.panel-subtitle {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-bottom: 24px;
}

/* --- Selection Cards --- */
.select-grid {
  display: grid;
  gap: 8px;
}

.select-grid.brands {
  grid-template-columns: 1fr;
}

.select-grid.models {
  grid-template-columns: 1fr 1fr;
}

.select-grid.references {
  grid-template-columns: 1fr;
}

.select-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.select-card:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.select-card.selected {
  border-color: var(--blue);
  background: var(--blue-light);
}

.select-card .card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.select-card.selected .card-icon {
  background: var(--blue-light);
}

.select-card .card-info {
  flex: 1;
}

.select-card .card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--black);
}

.select-card .card-meta {
  font-size: 0.78rem;
  color: var(--gray-600);
}

.select-card .card-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.select-card.selected .card-check {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}

/* --- Form Fields --- */
.form-group {
  margin-bottom: 16px;
}

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

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-900);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input::placeholder {
  color: var(--gray-500);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--blue);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23868e96' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* --- Selected Reference Info --- */
.ref-info-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 4px;
}

.ref-info-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--black);
  margin-bottom: 2px;
}

.ref-info-meta {
  font-size: 0.78rem;
  color: var(--gray-600);
}

/* --- Condition Cards --- */
.condition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.condition-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.condition-card:hover {
  border-color: var(--gray-400);
}

.condition-card.selected {
  border-color: var(--blue);
  background: var(--blue-light);
}

.condition-card .cond-label {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.condition-card .cond-desc {
  font-size: 0.75rem;
  color: var(--gray-600);
}

/* --- Toggle Switches --- */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.toggle-row .toggle-label {
  font-weight: 500;
  font-size: 0.9rem;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  display: none;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 100px;
  background: var(--gray-300);
  transition: background 0.15s ease;
}

.toggle-switch input:checked+.toggle-track {
  background: var(--blue);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease;
}

.toggle-switch input:checked~.toggle-thumb {
  transform: translateX(20px);
}

/* --- Buttons --- */
.nav-buttons {
  display: flex;
  gap: 8px;
  margin-top: 28px;
}

.btn {
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--blue);
  color: var(--white);
  flex: 1;
  justify-content: center;
}

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

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-50);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Quote Result --- */
.quote-result {
  text-align: center;
  padding: 32px 0;
}

.quote-result .result-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 20px;
}

.quote-result .result-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 6px;
}

.quote-result .result-range {
  font-size: 2rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 8px;
}

.quote-result .result-watch {
  font-size: 0.95rem;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.quote-result .result-market {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 24px;
}

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

.quote-details .detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.88rem;
}

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

.quote-details .detail-label {
  color: var(--gray-600);
}

.quote-details .detail-value {
  font-weight: 600;
}

.quote-disclaimer {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.8rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 24px;
  text-align: left;
}

.quote-disclaimer strong {
  color: var(--gray-800);
}

/* --- Contact Section --- */
.contact-section {
  text-align: left;
}

.contact-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.contact-section .section-sub {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 20px;
}

/* --- Success --- */
.success-panel {
  text-align: center;
  padding: 48px 0;
}

.success-panel .success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 20px;
  color: var(--green);
}

.success-panel h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-panel p {
  color: var(--gray-600);
  max-width: 380px;
  margin: 0 auto 24px;
  font-size: 0.9rem;
}

/* --- Footer --- */
.app-footer {
  padding: 20px;
  text-align: center;
  border-top: 1px solid var(--gray-200);
  font-size: 0.75rem;
  color: var(--gray-500);
}

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

/* --- Loading Spinner --- */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.spinner-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.spinner-ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 12px;
}

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

.spinner-text {
  font-size: 0.85rem;
  color: var(--gray-600);
}

/* --- Mobile --- */
@media (max-width: 600px) {
  .app-main {
    padding: 24px 16px 48px;
  }

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

  .select-grid.models {
    grid-template-columns: 1fr;
  }

  .condition-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .step-line {
    width: 28px;
  }

  .nav-buttons {
    flex-direction: column-reverse;
  }

  .btn {
    justify-content: center;
    width: 100%;
  }

  .quote-result .result-range {
    font-size: 1.6rem;
  }

  .call-bar-link {
    font-size: 0.7rem;
  }

  .spec-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Model Selection Grid ===== */
.model-grid {
  margin-bottom: 20px;
}

.model-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 10px;
  margin-top: 18px;
}

.model-group-label:first-child {
  margin-top: 0;
}

.model-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.model-card {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.model-card:hover {
  border-color: var(--gray-400);
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(0,0,0,0.06);
}

.model-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.model-card-img {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: var(--gray-50);
}

.model-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.model-card-name {
  padding: 6px 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.2;
}

.model-card.selected .model-card-name {
  color: var(--blue);
}

@media (max-width: 600px) {
  .model-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .model-card-name {
    font-size: 0.65rem;
  }
}

/* ===== Reference Number Search ===== */
.ref-search-divider {
  text-align: center;
  margin: 20px 0 16px;
  position: relative;
}

.ref-search-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gray-300);
}

.ref-search-divider span {
  position: relative;
  background: var(--gray-50);
  padding: 0 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ref-search-box {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.ref-search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  transition: background 0.15s;
}

.ref-search-header:hover {
  background: var(--gray-100);
}

.ref-search-header svg {
  color: var(--blue);
  flex-shrink: 0;
}

.ref-search-form {
  padding: 0 16px 16px;
}

.ref-input-row {
  display: flex;
  gap: 8px;
}

.ref-input-row .form-input {
  flex: 1;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.ref-result-card {
  margin-top: 12px;
  padding: 14px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.ref-result-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgba(37,99,235,0.1);
}

.ref-result-main {
  margin-bottom: 8px;
}

.ref-result-model {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--black);
}

.ref-result-ref {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 500;
}

.ref-result-details {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ref-result-details span {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 4px;
}

.ref-result-action {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
}

.ref-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #991b1b;
}

.ref-result-price {
  margin: 10px 0 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1px solid #bbf7d0;
  border-radius: 6px;
}

.ref-price-market {
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-bottom: 2px;
}

.ref-price-market strong {
  color: var(--gray-800);
}

.ref-price-offer {
  font-size: 0.85rem;
  color: #166534;
}

.ref-price-offer strong {
  font-size: 0.95rem;
}

/* ===== Matched Reference Banner ===== */
.ref-match-banner {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #eff6ff, #eef2ff);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
}

.ref-match-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ref-match-model {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-800);
}

.ref-match-ref {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--blue);
}

/* ===== Spec Image Cards ===== */
.spec-section {
  margin-bottom: 16px;
}

.spec-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.spec-card {
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

.spec-card:hover {
  border-color: var(--gray-400);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.spec-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

.spec-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.spec-card-label {
  display: block;
  text-align: center;
  padding: 6px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spec-card.selected .spec-card-label {
  color: var(--blue);
}

@media (max-width: 480px) {
  .spec-card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

/* --- Image Upload --- */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--gray-50);
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--blue);
  background: var(--blue-light);
}
.upload-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.upload-preview {
  position: relative;
  width: 80px; height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--gray-200);
}
.upload-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.upload-preview .remove-img {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none; border-radius: 50%;
  font-size: 12px; line-height: 20px;
  text-align: center;
  cursor: pointer;
}
.upload-status {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 6px;
}