/* =========================
   pagine.css
   - Stima veloce
   ========================= */

.quick-estimate-page {
  gap: 18px;
}

/* =========================
   Hero
   ========================= */

.quick-estimate-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(620px 240px at 10% 0%, rgba(37, 99, 235, 0.10), transparent 60%),
    radial-gradient(480px 220px at 100% 20%, rgba(14, 165, 233, 0.08), transparent 60%),
    var(--card-bg);
}

.quick-estimate-hero::before,
.quick-estimate-hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.8;
}

.quick-estimate-hero::before {
  width: 220px;
  height: 220px;
  left: -110px;
  top: -110px;
  background: radial-gradient(circle at 35% 35%, rgba(29, 78, 216, 0.16), transparent 66%);
}

.quick-estimate-hero::after {
  width: 280px;
  height: 280px;
  right: -140px;
  bottom: -140px;
  background: radial-gradient(circle at 35% 35%, rgba(14, 165, 233, 0.14), transparent 68%);
}

.quick-estimate-hero__inner {
  position: relative;
  display: grid;
  gap: 10px;
}

.quick-estimate-hero__inner h1 {
  margin: 0;
  font-size: 1.95rem;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.quick-estimate-hero__subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 64ch;
}

/* =========================
   Main layout
   ========================= */

.quick-estimate-main {
  display: grid;
  gap: 18px;
}

.quick-estimate-form,
.quick-estimate-result {
  min-width: 0;
}

.quick-estimate-form {
  position: relative;
  z-index: 2;
}

.quick-estimate-result {
  position: relative;
  z-index: 1;
}

/* =========================
   Form card
   ========================= */

.quick-estimate-form__inner {
  display: grid;
  gap: 16px;
}

.quick-estimate-form__head {
  display: grid;
  gap: 4px;
}

.quick-estimate-form__form {
  display: grid;
  gap: 14px;
}

.quick-estimate-form__errors {
  border-radius: 16px;
  border: 1px solid rgba(220, 38, 38, 0.16);
  background: rgba(220, 38, 38, 0.06);
  padding: 12px 14px;
  color: var(--text);
}

body.theme-dark .quick-estimate-form__errors {
  background: rgba(220, 38, 38, 0.10);
}

.quick-estimate-form__errors strong {
  display: block;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.quick-estimate-form__error-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.quick-estimate-form__fields {
  display: grid;
  gap: 14px;
}

.quick-estimate-field {
  display: grid;
  gap: 8px;
}

.quick-estimate-field__label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.quick-estimate-field--select {
  position: relative;
}

.quick-estimate-field__control {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  transition:
    border-color 180ms ease,
    background-color 220ms ease,
    box-shadow 180ms ease;
}

.quick-estimate-field__control:hover {
  border-color: rgba(37, 99, 235, 0.20);
}

.quick-estimate-field__control:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.quick-estimate-dropdown {
  position: relative;
  z-index: 1;
}

.quick-estimate-dropdown.is-open {
  z-index: 50;
}

.quick-estimate-dropdown__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.quick-estimate-dropdown__button {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--select-border);
  padding: 0 50px 0 16px;
  background:
    linear-gradient(180deg, var(--select-surface-top) 0%, var(--select-surface-bottom) 100%),
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.16), transparent 55%);
  box-shadow: var(--select-shadow);
  color: var(--text);
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 160ms ease,
    background-color 220ms ease;
}

.quick-estimate-dropdown__button:hover {
  border-color: var(--select-border-strong);
  box-shadow: var(--select-shadow-hover);
  transform: translateY(-1px);
}

.quick-estimate-dropdown__button:focus-visible {
  outline: none;
  border-color: var(--select-border-strong);
  box-shadow: 0 0 0 4px var(--select-ring), var(--select-shadow-hover);
  transform: translateY(-1px);
}

.quick-estimate-dropdown.is-open .quick-estimate-dropdown__button {
  border-color: var(--select-border-strong);
  box-shadow: 0 0 0 4px var(--select-ring), var(--select-shadow-hover);
}

.quick-estimate-dropdown.is-disabled .quick-estimate-dropdown__button {
  cursor: not-allowed;
  opacity: 0.7;
}

.quick-estimate-dropdown__value {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-estimate-dropdown__caret {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--primary) 84%, var(--text));
  position: relative;
  transition: transform 180ms ease, color 180ms ease;
}

.quick-estimate-dropdown__caret::before,
.quick-estimate-dropdown__caret::after {
  content: "";
  position: absolute;
  top: 7px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.quick-estimate-dropdown__caret::before {
  left: 2px;
  transform: rotate(45deg);
}

.quick-estimate-dropdown__caret::after {
  right: 2px;
  transform: rotate(-45deg);
}

.quick-estimate-dropdown.is-open .quick-estimate-dropdown__caret {
  transform: rotate(180deg);
}

.quick-estimate-dropdown__panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 40;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.12),
    0 4px 14px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(-4px) scale(0.985);
  transform-origin: top center;
  transition:
    opacity 160ms ease,
    transform 180ms ease;
}

body.theme-dark .quick-estimate-dropdown__panel {
  border-color: rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.96);
  box-shadow:
    0 20px 44px rgba(2, 6, 23, 0.34),
    0 6px 16px rgba(2, 6, 23, 0.22);
}

.quick-estimate-dropdown.is-open .quick-estimate-dropdown__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.quick-estimate-dropdown__listbox {
  max-height: min(280px, 42vh);
  overflow: auto;
  padding: 2px;
  display: grid;
  gap: 4px;
  outline: none;
}

.quick-estimate-dropdown__option {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease,
    box-shadow 160ms ease;
}

.quick-estimate-dropdown__option:hover,
.quick-estimate-dropdown__option.is-active {
  background: rgba(37, 99, 235, 0.08);
}

.quick-estimate-dropdown__option:focus-visible {
  outline: none;
  background: rgba(37, 99, 235, 0.10);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.quick-estimate-dropdown__option.is-selected {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.14), rgba(37, 99, 235, 0.08));
  color: color-mix(in srgb, var(--primary) 88%, var(--text));
  font-weight: 700;
}

.quick-estimate-dropdown__option.is-selected::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

body.theme-dark .quick-estimate-dropdown__option:hover,
body.theme-dark .quick-estimate-dropdown__option.is-active {
  background: rgba(96, 165, 250, 0.14);
}

body.theme-dark .quick-estimate-dropdown__option:focus-visible {
  background: rgba(96, 165, 250, 0.16);
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.16);
}

body.theme-dark .quick-estimate-dropdown__option.is-selected {
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.22), rgba(14, 165, 233, 0.14));
  color: #dbeafe;
}

.quick-estimate-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* =========================
   Result card
   ========================= */

.quick-estimate-result__inner {
  display: grid;
  gap: 16px;
}

.quick-estimate-result__eyebrow {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.quick-estimate-result__main {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  color: var(--text);
}

.quick-estimate-result__sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.quick-estimate-result__stats {
  display: grid;
  gap: 10px;
}

.quick-estimate-result__stat {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.42);
  padding: 14px;
  display: grid;
  gap: 4px;
}

body.theme-dark .quick-estimate-result__stat {
  background: rgba(15, 23, 42, 0.34);
}

.quick-estimate-result__stat-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.quick-estimate-result__stat-value {
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.quick-estimate-result__stat--intensity.is-light {
  border-color: rgba(14, 165, 233, 0.18);
}

.quick-estimate-result__stat--intensity.is-sustainable {
  border-color: rgba(59, 130, 246, 0.18);
}

.quick-estimate-result__stat--intensity.is-intense {
  border-color: rgba(245, 158, 11, 0.24);
}

.quick-estimate-result__stat--intensity.is-very-intense {
  border-color: rgba(239, 68, 68, 0.24);
}

.quick-estimate-result__visual {
  border-radius: 20px;
  border: 1px solid var(--border);
  background:
    radial-gradient(380px 160px at 0% 0%, rgba(37, 99, 235, 0.08), transparent 60%),
    rgba(255, 255, 255, 0.42);
  padding: 16px;
  display: grid;
  gap: 12px;
}

body.theme-dark .quick-estimate-result__visual {
  background:
    radial-gradient(380px 160px at 0% 0%, rgba(37, 99, 235, 0.12), transparent 60%),
    rgba(15, 23, 42, 0.34);
}

.quick-estimate-result__visual-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.quick-estimate-result__visual-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.quick-estimate-result__visual-value {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--muted);
}

.quick-estimate-result__bar {
  height: 14px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.quick-estimate-result__bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 220ms ease;
}

.quick-estimate-result__bar-fill.is-light {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.92), rgba(56, 189, 248, 0.92));
}

.quick-estimate-result__bar-fill.is-sustainable {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.92), rgba(14, 165, 233, 0.92));
}

.quick-estimate-result__bar-fill.is-intense {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(251, 191, 36, 0.95));
}

.quick-estimate-result__bar-fill.is-very-intense {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(248, 113, 113, 0.95));
}

.quick-estimate-result__visual-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.quick-estimate-result__comment {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.42);
  padding: 14px;
  color: var(--text);
  line-height: 1.5;
}

body.theme-dark .quick-estimate-result__comment {
  background: rgba(15, 23, 42, 0.34);
}

.quick-estimate-result__comment.is-light {
  border-color: rgba(14, 165, 233, 0.16);
}

.quick-estimate-result__comment.is-sustainable {
  border-color: rgba(37, 99, 235, 0.16);
}

.quick-estimate-result__comment.is-intense {
  border-color: rgba(245, 158, 11, 0.24);
}

.quick-estimate-result__comment.is-very-intense,
.quick-estimate-result__comment--warning {
  border-color: rgba(239, 68, 68, 0.18);
}

.quick-estimate-result__comment--warning {
  background: rgba(220, 38, 38, 0.05);
}

body.theme-dark .quick-estimate-result__comment--warning {
  background: rgba(220, 38, 38, 0.08);
}

.quick-estimate-result__placeholder {
  display: grid;
  gap: 10px;
}

.quick-estimate-result__placeholder-card {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.34);
  padding: 14px;
  display: grid;
  gap: 4px;
}

body.theme-dark .quick-estimate-result__placeholder-card {
  background: rgba(15, 23, 42, 0.28);
}

.quick-estimate-result__placeholder-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.quick-estimate-result__placeholder-value {
  font-size: 1rem;
  color: var(--text);
}

/* =========================
   Footer
   ========================= */

.quick-estimate-footer__inner {
  display: grid;
  gap: 10px;
}

.quick-estimate-footer__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.quick-estimate-footer__link-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-estimate-footer__link-text {
  color: var(--text);
  font-size: 0.92rem;
}

.quick-estimate-footer__link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

.quick-estimate-footer__link:hover {
  text-decoration: underline;
}

/* =========================
   Responsive
   ========================= */

@media (min-width: 700px) {
  .quick-estimate-form__fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-estimate-field:first-child,
  .quick-estimate-field:nth-child(3) {
    grid-column: 1 / -1;
  }

  .quick-estimate-result__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .quick-estimate-main {
    grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
    align-items: start;
  }

  .quick-estimate-hero__inner h1 {
    font-size: 2.3rem;
  }
}

@media (max-width: 560px) {
  .quick-estimate-form__actions .btn {
    width: 100%;
  }
}
