/**
 * Checkout Loading Overlay Styles
 * Displays loading spinner and message during payment method changes
 */

/* Loading Overlay Container */
.wm-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  z-index: 9999;
  border-radius: inherit;
  backdrop-filter: blur(2px);
}

/* Spinner Container (centered) */
.wm-spinner-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Spinner SVG/Element */
.wm-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border: 4px solid #f0f0f0;
  border-top: 4px solid #0073aa;
  border-radius: 50%;
  animation: wm-spin 1s linear infinite;
}

/* Loading Text */
.wm-loading-text {
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

/* Spinner Animation */
@keyframes wm-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Payment Section Processing State */
.woocommerce-checkout-payment.processing,
.wc-block-checkout__payment-methods.processing,
#payment-method.processing {
  position: relative;
  opacity: 0.6;
  pointer-events: none;
}

/* Ensure payment buttons are properly styled when disabled */
.woocommerce-checkout-payment.processing input,
.woocommerce-checkout-payment.processing label,
.wc-block-checkout__payment-methods.processing input,
.wc-block-checkout__payment-methods.processing label,
#payment-method.processing input,
#payment-method.processing label {
  cursor: not-allowed;
}

/* Smooth Fade In/Out */
.wm-loading-overlay {
  animation: wm-fadeIn 0.3s ease-in;
}

@keyframes wm-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .wm-spinner-container {
    padding: 16px;
  }

  .wm-spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
  }

  .wm-loading-text {
    font-size: 12px;
  }
}

/* District field ordering (Block-based checkout) */
.wc-block-components-address-address-wrapper.is-animated {
  transition: all 0.3s ease;
}

/* Shortcode Checkout: District Search Enhancer */
.wm-district-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none;
  margin-top: 4px;
}

.wm-district-item {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
}

.wm-district-item:last-child {
  border-bottom: none;
}

.wm-district-item:hover {
  background-color: #f5f5f5;
}

.wm-district-item.wm-district-item-selected {
  background-color: #e8f4f8;
  border-left: 3px solid #0073aa;
  padding-left: 7px;
}

/* Locked fields after district selection (Shortcode checkout) */
.woocommerce-checkout input[readonly] {
  background-color: #f9f9f9;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(0, 0, 0, 0.02) 10px,
    rgba(0, 0, 0, 0.02) 20px
  );
  cursor: not-allowed;
  color: #555;
  border-color: #ddd;
  padding-right: 35px;
}

/* Regular select (non-Select2) */
.woocommerce-checkout select[style*="pointer-events: none"],
.woocommerce-checkout select[data-wm-locked="true"] {
  background-color: #f9f9f9;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(0, 0, 0, 0.02) 10px,
    rgba(0, 0, 0, 0.02) 20px
  );
  cursor: not-allowed;
  color: #555;
  border-color: #ddd;
}

/* Select2 disabled state */
.woocommerce-checkout .select2-container.wm-select2-disabled {
  opacity: 1 !important;
}

.woocommerce-checkout
  .select2-container.wm-select2-disabled
  .select2-selection {
  background-color: #f9f9f9 !important;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(0, 0, 0, 0.02) 10px,
    rgba(0, 0, 0, 0.02) 20px
  ) !important;
  cursor: not-allowed !important;
  border-color: #ddd !important;
}

.woocommerce-checkout
  .select2-container.wm-select2-disabled
  .select2-selection__rendered {
  color: #555 !important;
}

.woocommerce-checkout
  .select2-container.wm-select2-disabled
  .select2-selection__arrow {
  opacity: 0.5;
}
