/* VD Instant Quote Modal - Luxury Modal v5 (Final Polish) */

/* Reset to stop legacy .btn styles */
.vd-card { all: unset; }

/* Modal overlay */
.vd-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.vd-modal-overlay.vd-active {
  opacity: 1;
  visibility: visible;
}

/* Modal container & layout - no scrollbars */
.vd-modal {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 720px);
  width: min(92vw, 520px);
  margin: 7vh auto;
  border-radius: 16px;
  background: #101214;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  box-sizing: border-box;
}

/* Form layout - flex column with footer inside */
.vd-form-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

/* Body layout - no scrollbars */
.vd-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.vd-body * {
  max-width: 100%;
}

/* Hide scrollbars */
.vd-modal::-webkit-scrollbar,
.vd-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Body scroll lock when modal is open */
html, body {
  overflow: hidden;
}

.vd-modal-overlay.vd-active .vd-modal {
  transform: scale(1) translateY(0);
}

/* Modal header */
.vd-modal__header {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.vd-modal__title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
}

.vd-close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #1a2032;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 300;
  transition: all 0.2s ease;
  outline: none;
}

.vd-close:hover,
.vd-close:focus {
  outline: 2px solid rgba(47, 107, 255, 0.35);
  outline-offset: 2px;
  background: #2a2a2a;
}

/* Modal body */
.vd-modal-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
  padding-bottom: calc(20px + var(--vd-footer-h, 64px));
}

.vd-step-title {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.vd-step-subtitle {
  color: #ccc;
  font-size: 14px;
  margin: 0 0 16px 0;
}

/* One visible step at a time (radio wizard) */
.vd-step {
  display: none;
}

#vd-w1:checked ~ .vd-steps #vd-step-1 {
  display: block;
}

#vd-w2:checked ~ .vd-steps #vd-step-2 {
  display: block;
}

#vd-w3:checked ~ .vd-steps #vd-step-3 {
  display: block;
}

/* Footer hidden on Step 1 */
#vd-form.vd-state-step1 .vd-modal__footer {
  display: none !important;
}

/* Modal layout: no horizontal scrollbars */
.vd-modal__sheet {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 720px);
}

.vd-body, .vd-steps {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* JS-class driven visibility (wins over any old rules) */
#vd-step-1, #vd-step-2, #vd-step-3 {
  display: none !important;
}

#vd-form.vd-state-step1 #vd-step-1 {
  display: block !important;
}

#vd-form.vd-state-step2 #vd-step-2 {
  display: block !important;
}

#vd-form.vd-state-step3 #vd-step-3 {
  display: block !important;
}

/* Only vertical scroll inside body; no horizontal bars */
.vd-modal__sheet {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 720px);
}

.vd-body, .vd-steps {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Hide footer on Step 1 */
#vd-form.vd-state-step1 .vd-modal__footer {
  display: none !important;
}

/* Minimal field styling to match the theme */
.vd-field {
  margin: 12px 16px;
}

.vd-label {
  display: block;
  font-size: 0.9rem;
  margin: 0 0 6px 2px;
  opacity: 0.85;
}

.vd-input {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #14161d;
  padding: 0 12px;
  color: #fff;
  outline: none;
}

.vd-input:focus {
  border-color: #2f6bff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

/* Service cards */
.vd-service-list {
  display: grid;
  gap: 16px;
  margin-top: 8px;
  padding: 0 16px 16px;
  box-sizing: border-box;
}

.vd-card {
  position: relative;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background: #14161a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
  outline: none;
  box-sizing: border-box;
}

.vd-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.vd-card.is-selected {
  border: 2px solid #2f6bff;
  background: #151823;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

.vd-card:focus {
  outline: 2px solid rgba(47, 107, 255, 0.45);
  outline-offset: 2px;
}

.vd-card__title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
}

.vd-card__desc {
  margin-top: 6px;
  font-size: 13px;
  color: #aeb1b7;
}

.vd-card__price {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(47, 107, 255, 0.1);
  color: #2f6bff;
  font-weight: 800;
}

.vd-card__price::before {
  content: "From ";
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  margin-right: 2px;
}

/* Selected state */
.vd-card.is-selected {
  border: 2px solid #2f6bff;
  background: #151823;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

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

.vd-form-label {
  display: block;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.vd-form-input {
  width: 100%;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  font-size: 16px;
  transition: border-color 0.2s ease;
  outline: none;
}

.vd-form-input:focus {
  border-color: #2f6bff;
  outline: 2px solid rgba(47, 107, 255, 0.45);
  outline-offset: 2px;
}

.vd-form-input::placeholder {
  color: #888;
}

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

/* Progress bar & labels */
.vd-progress {
  padding: 0 20px 10px;
}

.vd-stepbar {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.vd-stepbar > i {
  position: absolute;
  inset: 0;
  width: 33.33%;
  background: #2f6bff;
  transform-origin: left;
  transform: scaleX(var(--vd-step, 1));
  transition: transform 0.4s ease;
}

.vd-steplabels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  font-size: 12px;
  color: #aeb1b7;
}

/* Buttons */
.vd-btn-primary {
  background: #2f6bff;
  color: #fff;
  border: 0;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  min-width: 120px;
  outline: none;
}

.vd-btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
}

.vd-btn-primary:focus {
  outline: 2px solid rgba(47, 107, 255, 0.45);
  outline-offset: 2px;
}

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

.vd-btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  min-width: 80px;
  outline: none;
}

.vd-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
}

.vd-btn-secondary:focus {
  outline: 2px solid rgba(47, 107, 255, 0.45);
  outline-offset: 2px;
}

/* Footer (sticky inside modal) */
.vd-modal__footer {
  --vd-footer-h: 64px;
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  min-height: var(--vd-footer-h);
  background: #101214;
}

/* Review Step */
.vd-review-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #333;
}

.vd-review-item:last-child {
  border-bottom: none;
}

.vd-review-label {
  color: #ccc;
  font-size: 14px;
}

.vd-review-value {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .vd-modal {
    margin: 5vh auto;
    max-width: none;
    width: min(92vw, 520px);
  }
  
  .vd-modal__header,
  .vd-modal-body {
    padding: 16px;
  }
  
  .vd-modal__footer {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  
  .vd-progress {
    padding: 0 16px 10px;
  }
  
  .vd-steplabels {
    padding: 0 16px;
  }
  
  /* Mobile buttons go equal width */
  .vd-btn-primary,
  .vd-btn-secondary {
    flex: 1;
  }
}

/* Focus trap and accessibility */
.vd-modal[aria-hidden="true"] {
  display: none;
}

.vd-modal:focus {
  outline: none;
}

/* Body scroll lock */
body.vd-modal-open {
  overflow: hidden;
}

/* Hide footer on Step 1 */
.vd-footer--hidden {
  visibility: hidden;
  height: 0;
  padding: 0;
  border-top: 0;
  margin: 0;
}

.vd-step1-hint {
  padding: 8px 20px 0;
  color: #aeb1b7;
  font-size: 12px;
}

/* Selection pulse (120ms) */
@keyframes vd-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0); }
  50%  { box-shadow: 0 0 0 6px rgba(47, 107, 255, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0); }
}

.vd-card.vd-pulse {
  animation: vd-pulse 140ms ease-out;
}

/* Ensure price pill stays tight when we insert "From" via ::before */
.vd-card__price {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(47, 107, 255, 0.10);
  color: #2f6bff;
  font-weight: 800;
}

.vd-card__price::before {
  content: "From ";
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  margin-right: 2px;
}

/* Step visibility */
/* Radio-wizard step control */
.vd-step {
  display: none;
}

#vd-w1:checked ~ .vd-steps #vd-step-1 {
  display: block;
}

#vd-w2:checked ~ .vd-steps #vd-step-2 {
  display: block;
}

#vd-w3:checked ~ .vd-steps #vd-step-3 {
  display: block;
}

/* Forms */
.vd-step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.vd-step-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.vd-change-service {
  font-size: 12px;
  color: #aeb1b7;
  text-decoration: underline;
}

.vd-form {
  display: grid;
  gap: 12px;
}

.vd-field label {
  display: block;
  font-size: 12px;
  color: #aeb1b7;
  margin-bottom: 6px;
}

.vd-field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #15171c;
  color: #fff;
}

.vd-field input:focus {
  outline: 2px solid rgba(47, 107, 255, 0.45);
  outline-offset: 2px;
}

/* Radio wizard step control */
.vd-step {
  display: none;
}

#vd-w1:checked ~ .vd-steps [data-step="1"] {
  display: block;
}

#vd-w2:checked ~ .vd-steps [data-step="2"] {
  display: block;
}

#vd-w3:checked ~ .vd-steps [data-step="3"] {
  display: block;
}

/* Footer controls visibility */
#vd-w1:checked ~ .vd-modal__footer {
  visibility: hidden;
  height: 0;
  padding: 0;
  border-top: 0;
  margin: 0;
}

#vd-w2:checked ~ .vd-modal__footer .vd-fn-send {
  display: none;
}

#vd-w3:checked ~ .vd-modal__footer .vd-fn-next {
  display: none;
}

/* Card checked state */
.vd-card:has(.vd-svc:checked) {
  border: 2px solid #2f6bff;
  background: #151823;
}

/* Card is the click target, children don't swallow clicks */
.vd-service-list {
  position: relative;
}

.vd-card {
  position: relative;
  cursor: pointer;
  z-index: 1;
}

.vd-card * {
  pointer-events: none; /* text/icons won't block */
}

.vd-card input.vd-svc {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

/* Selected look driven by the radio state */
.vd-card:has(.vd-svc:checked) {
  border: 2px solid var(--vd-blue, #2f6bff);
  background: #151823;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

/* Footer visibility by wizard radio state */
#vd-w1:checked ~ .vd-modal__footer {
  visibility: hidden;
  height: 0;
  padding: 0;
  border-top: 0;
  margin: 0;
}

/* Buttons shown per step */
.vd-modal__footer .vd-fn-next {
  display: inline-flex;
}

.vd-modal__footer .vd-fn-send {
  display: none;
}

#vd-w2:checked ~ .vd-modal__footer .vd-fn-send {
  display: none;
}

#vd-w3:checked ~ .vd-modal__footer .vd-fn-next {
  display: none;
}

#vd-w3:checked ~ .vd-modal__footer .vd-fn-send {
  display: inline-flex;
}

/* Fallback: form state classes (if sibling selectors don't work) */
#vd-form.vd-state-step1 .vd-modal__footer {
  visibility: hidden;
  height: 0;
  padding: 0;
  border-top: 0;
  margin: 0;
}

#vd-form.vd-state-step3 .vd-modal__footer .vd-fn-next {
  display: none;
}

#vd-form.vd-state-step3 .vd-modal__footer .vd-fn-send {
  display: inline-flex;
}

/* Progress labels formatting */
.vd-steplabels__left {
  font-weight: 600;
}

.vd-steplabels__right {
  color: #aeb1b7;
  font-size: 12px;
}

/* CSS Variables */
:root {
  --vd-blue: #2f6bff;
}

/* Override any legacy styles that might interfere */
.vd-modal .vd-card {
  background: #14161a !important;
}

/* Card click safety - avoid swallowed clicks */
.vd-card {
  cursor: pointer;
  position: relative;
}

.vd-card * {
  pointer-events: none; /* so inner spans don't eat the click */
}

/* Failsafe button cards */
.vd-card-btn {
  all: unset;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: 100%;
  cursor: pointer;
}

.vd-card-btn * {
  pointer-events: none; /* nothing inside the card steals the click */
}

/* Selected flash */
.vd-card-btn.is-selected {
  border: 2px solid #2f6bff;
  background: #151823;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

/* Safety CSS - ensure nothing blocks clicks */
.vd-modal, .vd-body, .vd-service-list, .vd-card {
  pointer-events: auto;
}

.vd-card * {
  pointer-events: none;
}

/* Footer visibility - simple and bullet-proof */
#vd-form.vd-state-step1 .vd-modal__footer {
  display: none;
}

#vd-form.vd-state-step3 .vd-modal__footer .vd-fn-next {
  display: none;
}

#vd-form.vd-state-step3 .vd-modal__footer .vd-fn-send {
  display: inline-flex;
}

/* Remove any conflicting old rules */
.vd-card.is-selected {
  /* Remove old is-selected class - use :has(.vd-svc:checked) instead */
}

.vd-step.is-active {
  /* Remove old is-active class - use radio wizard instead */
}

.vd-modal .vd-card.is-selected {
  background: #151823 !important;
}

/* Debug overlay styles */
.vd-debug-overlay {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 12px;
  z-index: 10000;
  max-width: 300px;
  border: 1px solid #2f6bff;
}

.vd-debug-overlay h4 {
  margin: 0 0 8px 0;
  color: #2f6bff;
  font-size: 14px;
}

.vd-debug-overlay p {
  margin: 4px 0;
  line-height: 1.3;
}

.vd-debug-click-outline {
  outline: 2px solid #2f6bff !important;
  outline-offset: 2px !important;
  animation: vd-debug-pulse 1s ease-out;
}

@keyframes vd-debug-pulse {
  0% { outline-color: #2f6bff; }
  50% { outline-color: #ff6b2f; }
  100% { outline-color: #2f6bff; }
}