/* 
 * Xi Woo Cart Components
 * 
 * This file contains styles for reusable UI components:
 * - Loaders and spinners
 * - Progress indicators
 * - Notifications and alerts
 * - Buttons and interactive elements
 */

/* ==========================================================================
   Buttons
   ========================================================================== */

/* Primary button */
.xi-button,
.xi-next-step,
.xi-redirect-button,
.xi-retry-button,
.continue-shopping-btn {
  background-color: #0c2633 !important;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.3s;
  display: inline-block;
  text-decoration: none;
}

.xi-button:hover,
.xi-next-step:hover,
.xi-redirect-button:hover,
.xi-retry-button:hover,
.continue-shopping-btn:hover {
  background-color: #194461;
  color: white;
  text-decoration: none;
}

/* Secondary button */
.xi-back-step {
  border-radius: 10px;
  background: none;
  color: #777;
  border: 1px solid #ddd;
  padding: 10px 15px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.xi-back-step:hover {
  color: #333333 !important;
  background: #cccccc !important;
  border-color: #999999 !important;
}

/* Button loading state */
.xi-button.loading,
.xi-redirect-button.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Navigation button container */
.xi-cart-navigation {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.xi-cart-navigation .xi-back-step {
  flex: 1; /* Takes one-third of the space */
  min-height: 40px;
}

.xi-cart-navigation .xi-next-step {
  flex: 2; /* Takes two-thirds of the space */
  min-height: 40px;
}

/* ==========================================================================
   Loaders and Spinners
   ========================================================================== */

/* Standard loader overlay */
.xi-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.xi-loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Standard circular spinner */
.xi-loader {
  width: 50px;
  height: 50px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #003b71;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Small spinner variant */
.xi-loader-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* Inline spinner for specific elements */
.field-loader {
  width: 18px;
  height: 18px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #4a90e2;
  border-radius: 50%;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  animation: spin 1s linear infinite;
}

/* Loading spinner for quantity control */
.loading-spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.quantity-col.loading .loading-spinner {
  display: block;
  border: 2px solid #e0e0e0;
  border-top: 2px solid #003b71;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.quantity-col.loading {
  opacity: 0.7;
}

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

/* ==========================================================================
   Progress Indicators
   ========================================================================== */

/* Horizontal progress bar */
.progress-bar-container,
.progress-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  margin: 20px auto 30px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill,
.progress-fill {
  height: 100%;
  background: #0c303d;
  border-radius: 4px;
  transition: width 0.8s ease;
}

/* ==========================================================================
   Notifications and Alerts
   ========================================================================== */

/* Notification toast messages */
.xi-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 25px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}

.xi-notification.show {
  opacity: 1;
  transform: translateY(0);
}

.xi-notification.success {
  background: #0c2633d1;
  color: #fff;
  border: 2px solid #FE6B01;
}

.xi-notification.error {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
}

/* Alert Messages */
.xi-alert {
  padding: 12px 15px;
  margin-bottom: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.xi-alert.info {
  background: #e8f4fd;
  color: #004085;
  border: 1px solid #b8daff;
}

.xi-alert.warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.xi-alert.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.xi-alert.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* Inline error messages */
.error-message {
  color: #dc3545;
  font-size: 12px;
  margin-top: 4px;
  display: none;
  text-align: right;
  margin-right: 10px;
}

.field-wrapper.has-error .error-message {
  display: block;
}

/* Enhanced Notification Styling for Desktop */
@media (min-width: 769px) {
  .xi-notification {
    min-width: 350px; /* Wider on desktop */
    max-width: 500px; /* Maximum width */
    padding: 18px 28px; /* More padding */
    font-size: 16px; /* Larger font */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); /* More prominent shadow */
    top: 40px; /* Position further down from top */
    border-width: 0 0 0 5px; /* Thicker left border */
    right: 40px; /* Further from right edge */
  }

  /* Success notification */
  .xi-notification.success {
    border-left-color: #FE6B01; /* Brighter green */
  }

  /* Error notification */
  .xi-notification.error {
    border-left-color: #dc3545; /* Brighter red */
  }
}

/* Animation Enhancement - Add subtle bounce to improve visibility */
@keyframes notification-bounce {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }
  50% {
    transform: translateY(5px);
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (min-width: 769px) {
  .xi-notification.show {
    animation: notification-bounce 0.4s ease forwards;
  }
}

/* ==========================================================================
   Shipping Progress (Mobile)
   ========================================================================== */

/* Mobile shipping progress - hide on desktop */
.achieved-text {
  text-align: center;
  color: #333;
  font-weight: 500;
  font-size: 2rem;
  margin-bottom: 0;
  padding: 10px;
  border-bottom: 6px solid #FE6B01;
}

.xi-shipping-progress-mobile {
  display: none;
}

/* Desktop vs. Mobile display rules */
@media (min-width: 769px) {
  .xi-shipping-progress-mobile {
    display: none !important;
  }

  .xi-cart-totals .xi-shipping-progress,
  .xi-cart-totals .xi-shipping-achieved {
    display: block;
  }
}

@media (max-width: 768px) {
  .xi-back-step
  {
    padding:10px!important;
  }
  .xi-shipping-progress-mobile {
    display: block;
    margin: 15px 0px;
    padding: 15px;
    background: #f7f7f7;
    border-radius: 10px;
    box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.1);
  }

  .xi-cart-totals .xi-shipping-progress,
  .xi-cart-totals .xi-shipping-achieved {
    display: none !important;
  }

  .xi-shipping-progress-mobile .progress-text {
    margin-bottom: 10px;
    text-align: center;
    font-weight: 500;
    font-size: 1.7rem;
  }

  .missing-amount {
    font-weight: 600;
    font-size: 2rem;
    color: rgb(255, 102, 0);
  }

  .xi-steps-progress {
    margin: 20px 0;
  }

  .xi-steps-progress .step-text {
    font-size: 12px;
  }

  .xi-steps-progress .step {
    flex-basis: 18%;
    min-width: 70px;
  }

    .xi-notification {
      left: 20px;
      right: 20px;
      text-align: center;
    }
    .xi-cart-navigation 
    {
      align-items: center;
    }
}

@media (max-width: 480px) {
  .xi-steps-progress {
    justify-content: flex-start;
  }

  .xi-steps-progress .step {
    flex-basis: 20%;
  }
}
