/**
 * 1:1 In-Popup Form Loading Overlay
 * Blurs/whitens the existing popup form directly without stacking extra popups.
 * Typography: Inter font.
 *
 * @package GP_WineVN
 */

/* Import Google Font Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Hide the old single red spinner */
.catalogue-popup-loading__spinner,
.wpcf7-spinner {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* In-Popup White Blurred Loading Overlay */
.catalogue-popup-loading,
.mqt-loading-overlay {
  position: absolute !important;
  inset: 0 !important;
  z-index: 10010 !important;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.97) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  border-radius: inherit !important;
  padding: 36px 24px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.25s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  -webkit-font-smoothing: antialiased;
}

/* Display overlay when active or when popup is loading */
.catalogue-popup.is-loading .catalogue-popup-loading,
.contact-popup.is-loading .catalogue-popup-loading,
#cataloguePopup.is-loading .catalogue-popup-loading,
#contactPopupRuouTet.is-loading .catalogue-popup-loading,
#contactPopupQuaTet.is-loading .catalogue-popup-loading,
#mqtCf7Popup.is-loading .catalogue-popup-loading,
.mqt-contact-form-popup.is-loading .catalogue-popup-loading,
.catalogue-popup-loading:not([hidden]),
.catalogue-popup-loading.is-active,
.mqt-loading-overlay.is-active {
  display: flex !important;
  opacity: 1 !important;
}

/* Fallback if form is inline on page */
.mqt-loading-overlay.is-global-fallback {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 99999999 !important;
}

/* Loading Content Box: Expanded width for comfortable reading */
.mqt-loading-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: auto;
  text-align: left;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  animation: mqtFadeInUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Spoke Spinner in Wine Red */
.mqt-loading-spinner-wrap {
  text-align: center;
  margin-bottom: 14px;
}

.mqt-spoke-spinner {
  display: inline-block;
  vertical-align: middle;
  animation: mqtSpinSpokes 0.85s steps(12, end) infinite;
}

@keyframes mqtSpinSpokes {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Inter Heading & Subtitle */
.mqt-loading-title {
  margin: 0 0 10px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  text-align: center;
  line-height: 1.35;
  letter-spacing: -0.2px;
}

.mqt-loading-desc {
  margin: 0 auto 28px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 13.5px;
  color: #666666;
  text-align: center;
  line-height: 1.5;
  max-width: 100%;
  white-space: nowrap;
}

/* Vertical Timeline */
.mqt-loading-timeline {
  margin: 0 auto 24px;
  position: relative;
  padding: 0 4px;
  max-width: 500px;
}

.mqt-timeline-step {
  display: flex;
  align-items: flex-start;
  position: relative;
  padding-bottom: 22px;
}

.mqt-timeline-step:last-child {
  padding-bottom: 0;
}

/* Indicator column stretches full height of step */
.mqt-step-indicator {
  position: relative;
  margin-right: 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
}

/* Step Circle */
.mqt-step-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 2;
  position: relative;
  flex-shrink: 0;
  transition: all 0.25s ease;
  background: #ffffff;
  border: 1.5px solid #dcdcdc;
  color: #555555;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.mqt-check-icon {
  display: none;
}

.mqt-step-number {
  display: block;
}

/* Completed Step: Solid Wine Red + White Checkmark */
.mqt-timeline-step.is-completed .mqt-step-circle {
  background: #990d23;
  border-color: #990d23;
  color: #ffffff;
}

.mqt-timeline-step.is-completed .mqt-check-icon {
  display: block;
}

.mqt-timeline-step.is-completed .mqt-step-number {
  display: none;
}

/* Continuous Vertical Connector Line from Circle to Circle */
.mqt-step-line {
  position: absolute;
  top: 26px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  background: #e5e5e5;
  z-index: 1;
}

.mqt-timeline-step:last-child .mqt-step-line {
  display: none !important;
}

/* Step Content */
.mqt-step-content {
  flex: 1;
  padding-top: 2px;
}

.mqt-step-title {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 14.5px;
  font-weight: 600;
  color: #222222;
  line-height: 1.45;
  margin-bottom: 2px;
}

.mqt-step-time {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 12.5px;
  color: #888888;
  line-height: 1.3;
}

/* Bottom Progress Bar Row */
.mqt-loading-progress-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 26px auto 0;
  padding: 0 4px;
  max-width: 500px;
}

.mqt-loading-progress-track {
  flex: 1;
  height: 8px;
  background: #e8eaed;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.mqt-loading-progress-fill {
  height: 100%;
  background: #990d23;
  border-radius: 999px;
  transition: width 0.12s linear;
  min-width: 4px;
}

.mqt-loading-progress-percent {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 15px;
  font-weight: 700;
  color: #990d23;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: right;
  line-height: 1;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .mqt-loading-desc {
    white-space: normal;
    font-size: 13px;
    margin-bottom: 22px;
    text-wrap: balance;
  }
}

@media (max-width: 480px) {
  .catalogue-popup-loading,
  .mqt-loading-overlay {
    padding: 24px 16px;
  }

  .mqt-loading-title {
    font-size: 19px;
  }

  .mqt-step-title {
    font-size: 13.5px;
  }

  .mqt-timeline-step {
    padding-bottom: 18px;
  }
}
