/**
 * Quick Order Styles
 * Magaztk Theme
 */

/* Quick Buy Button */
.quick-buy-button {
  display: inline-block;
  color: #fff !important;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-buy-button:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.quick-buy-button i {
  margin-left: 5px;
}

/* Quick Order Modal */
.quick-order-modal .modal-content {
  border-radius: 15px;
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.quick-order-modal .modal-header {
  padding: 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 15px 15px 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.quick-order-modal .modal-title {
  color: #fff;
  font-weight: 700;
  font-size: 1.5rem;
}

.quick-order-modal .btn-close {
  filter: brightness(0) invert(1);
  opacity: 1;
}

.quick-order-modal .modal-body {
  padding: 2rem;
  max-height: calc(90vh - 100px);
  overflow-y: auto;
}

/* Product Info in Modal */
.quick-order-product-info {
  border: 2px solid #f0f0f0;
  transition: all 0.3s ease;
}

.quick-order-product-info:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

/* Variation Info */
.quick-order-variation-info {
  border-left: 3px solid #667eea;
  background: linear-gradient(135deg, #667eea05 0%, #764ba205 100%) !important;
}

.quick-order-variation-info .badge {
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  font-weight: 500;
}

/* Variation Details in Product Info */
.quick-order-product-info .variation-details {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e9ecef;
}

.quick-order-product-info .variation-details .badge {
  font-size: 0.75rem;
  padding: 0.35rem 0.5rem;
  font-weight: 500;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border: none;
  margin-bottom: 4px;
}

.quick-order-product-image {
  max-height: 80px;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.quick-order-product-image.loading {
  opacity: 0.5;
}

.quick-order-product-name {
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.quick-order-product-price {
  font-size: 18px;
  color: var(--primary, #667eea) !important;
}

/* Form Styles */
.quick-order-form .form-label {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
  font-size: 14px;
}

.quick-order-form .form-control,
.quick-order-form .form-select {
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
  font-family: "Cairo", sans-serif;
}

.quick-order-form .form-control:focus,
.quick-order-form .form-select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.quick-order-form .form-control::placeholder {
  color: #adb5bd;
  font-size: 14px;
}

/* Input with Icon */
.input-with-icon {
  position: relative;
}

.input-with-icon .form-control,
.input-with-icon .form-select {
  padding-right: 3rem;
}

.input-with-icon .input-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #667eea;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}

.input-with-icon .input-icon svg {
  width: 20px;
  height: 20px;
  stroke: #667eea;
}

/* Textarea icon positioning */
.input-with-icon .input-icon-textarea {
  top: 1rem;
  transform: none;
}

/* RTL Support for input icons */
[dir="ltr"] .input-with-icon .form-control,
[dir="ltr"] .input-with-icon .form-select {
  padding-right: 1rem;
  padding-left: 3rem;
}

[dir="ltr"] .input-with-icon .input-icon {
  right: auto;
  left: 1rem;
}

/* Quantity Buttons */
.quick-order-qty-minus,
.quick-order-qty-plus {
  border: 2px solid #e9ecef;
  background: #f8f9fa;
  color: #333;
  font-weight: 700;
  transition: all 0.3s ease;
}

.quick-order-qty-minus:hover,
.quick-order-qty-plus:hover {
  background: #667eea;
  border-color: #667eea;
  color: #fff;
}

#quick_order_quantity {
  border-left: none;
  border-right: none;
  font-weight: 700;
  font-size: 16px;
}

/* Total Display */
.quick-order-total {
  background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%) !important;
  border: 2px solid #667eea30;
  border-radius: 10px;
}

.quick-order-total-amount {
  color: #667eea !important;
  font-size: 1.75rem !important;
}

/* Submit Button */
.quick-order-submit {
  border: none;
  border-radius: 10px;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  position: sticky;
  bottom: 0;
  z-index: 10;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.quick-order-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 -6px 25px rgba(102, 126, 234, 0.3);
}

.quick-order-submit:active {
  transform: translateY(0);
}

.quick-order-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Alerts */
.quick-order-error,
.quick-order-success {
  border-radius: 8px;
  font-weight: 600;
  animation: slideInDown 0.3s ease;
}

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

/* Spinner */
.quick-order-submit-spinner {
  margin-right: 8px;
}

/* RTL Support */
[dir="rtl"] .quick-buy-button i {
  margin-right: 5px;
  margin-left: 0;
}

[dir="rtl"] .quick-order-submit-spinner {
  margin-left: 8px;
  margin-right: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .quick-order-modal .modal-dialog {
    margin: 0.5rem;
  }

  .quick-order-modal .modal-body {
    padding: 1.5rem 1rem;
  }

  .quick-order-modal .modal-title {
    font-size: 1.25rem;
  }

  .quick-buy-button-loop {
    font-size: 12px !important;
    padding: 6px !important;
  }

  .quick-order-product-info {
    padding: 0.75rem !important;
  }

  .quick-order-product-image {
    max-height: 60px;
  }

  .quick-order-total-amount {
    font-size: 1.5rem !important;
  }
}

/* Loading State */
.quick-order-form.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Success Animation */
@keyframes successPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.quick-order-success {
  animation: successPulse 0.5s ease;
}

/* Custom Scrollbar for Modal */
.quick-order-modal .modal-body::-webkit-scrollbar {
  width: 8px;
}

.quick-order-modal .modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.quick-order-modal .modal-body::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 10px;
}

.quick-order-modal .modal-body::-webkit-scrollbar-thumb:hover {
  background: #764ba2;
}

/* Hide external variation selection table on single product pages */
.single-product .product .variations_form table.variations {
  display: none !important;
}

/* Hide variation price and description but not the entire wrap */
.single-product .product .variations_form .woocommerce-variation {
  display: none !important;
}

.single-product .product .variations_form .woocommerce-variation-price {
  display: none !important;
}

.single-product .product .variations_form .woocommerce-variation-description {
  display: none !important;
}

.single-product .product .variations_form .woocommerce-variation-availability {
  display: none !important;
}

/* Cart Items Variation Display */
.cart-item-row .badge {
  font-weight: 600;
  padding: 0.35em 0.65em;
  font-size: 0.75rem !important;
}

.cart-item-row .badge.bg-primary {
  background-color: #667eea !important;
}

/* Variation details grouping */
.cart-item-row .variation-details-group {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Ensure variations are visible on mobile */
@media (max-width: 768px) {
  .cart-item-row .badge {
    font-size: 0.7rem !important;
    padding: 0.25em 0.5em;
    display: inline-block;
    margin: 2px;
  }
}

/* Show the default add to cart button for variable products */
.single-product .product .variations_form .single_add_to_cart_button {
  display: flex !important;
}

/* Single Product Page - Button Layout and Styling */
.single-product .product .cart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Hide quantity selector on single product pages */
.single-product .product .cart .quantity {
  display: none !important;
}

/* Ensure the quick buy button is visible and styled */
.single-product .product .quick-buy-button {
  display: inline-block !important;
  border-radius: 10px;
  width: 100%;
  padding: 15px 20px;
  order: 1;
  margin-top: 0;
}

/* Style the add to cart button to match quick buy button */
.single-product .product .single_add_to_cart_button {
  border-radius: 10px !important;
  width: 100%;
  padding: 15px 20px !important;
  order: 2;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff !important;
}

/* Add cart icon to the add to cart button */
.single-product .product .single_add_to_cart_button::before {
  content: "\f07a";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 18px;
}

/* Variation Select Styling in Modal */
.quick-order-variation-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  background-size: 16px 12px;
  padding-left: 2.5rem;
}

[dir="ltr"] .quick-order-variation-select {
  background-position: right 0.75rem center;
  padding-left: 1rem;
  padding-right: 2.5rem;
}

/* Cart Items Styling */
.cart-item-row {
  background: #ffffff;
  transition: all 0.3s ease;
  border: 2px solid #e9ecef !important;
  position: relative;
}

.cart-item-row:hover {
  background: #f8f9fa;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #667eea !important;
  transform: translateY(-2px);
}

.cart-item-row img {
  max-height: 70px;
  object-fit: cover;
  border-radius: 8px;
}

.cart-item-row h6 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
  line-height: 1.4;
}

.cart-item-row .badge {
  font-size: 0.7rem;
  padding: 0.3rem 0.5rem;
  font-weight: 500;
  border-radius: 4px;
}

.cart-item-row .badge.bg-info {
  background-color: #cfe2ff !important;
  color: #084298 !important;
  border: 1px solid #b6d4fe;
}

.cart-item-row .badge.bg-light {
  background-color: #f8f9fa !important;
}

.quick-order-remove-item {
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  border-radius: 6px;
}

.quick-order-remove-item:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.quick-order-remove-item:active {
  transform: scale(0.95);
}

#cart-empty-message {
  padding: 2rem !important;
}

#cart-empty-message i {
  display: block;
  margin-bottom: 15px;
  animation: emptyCartPulse 2s ease-in-out infinite;
}

@keyframes emptyCartPulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Cart items scrollbar */
.quick-order-cart-items .card-body::-webkit-scrollbar {
  width: 6px;
}

.quick-order-cart-items .card-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.quick-order-cart-items .card-body::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 10px;
}

.quick-order-cart-items .card-body::-webkit-scrollbar-thumb:hover {
  background: #764ba2;
}

/* Loading animation for cart item removal */
.cart-item-row.removing {
  opacity: 0.5;
  pointer-events: none;
}

/* Card header improvements */
.quick-order-cart-items .card-header {
  padding: 1rem;
  border-radius: 8px 8px 0 0 !important;
}

.quick-order-cart-items .card-header h6 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.quick-order-cart-items .card-header small {
  font-size: 0.8rem;
  display: block;
}

/* Elementor Widget Styles */
.magaztk-quick-order-widget {
  display: inline-block;
  width: 100%;
}

.magaztk-quick-order-widget .magaztk-quick-order-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.magaztk-quick-order-widget .magaztk-quick-order-btn:hover {
  transform: translateY(-2px);
}

.magaztk-quick-order-widget .magaztk-quick-order-btn:active {
  transform: translateY(0);
}

.magaztk-quick-order-widget .magaztk-quick-order-btn i,
.magaztk-quick-order-widget .magaztk-quick-order-btn svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Override icon colors to inherit from button text color */
.magaztk-quick-order-widget .magaztk-quick-order-btn i,
.magaztk-quick-order-widget .magaztk-quick-order-btn svg {
  color: inherit;
  fill: currentColor;
}

/* RTL Support for Widget */
[dir="rtl"] .magaztk-quick-order-widget .magaztk-quick-order-btn {
  flex-direction: row-reverse;
}

/* Ensure Elementor widget controls override global theme styles */
.elementor-widget-magaztk_quick_order_button .magaztk-quick-order-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
}

/* Exit-Intent Discount Popup */
.exit-intent-discount-modal .modal-content {
  border-radius: 20px;
  border: none;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
  z-index: 1060;
}

.exit-intent-discount-modal .modal-body {
  position: relative;
}

/* Blur the quick order modal when exit intent appears */
.quick-order-modal-blurred .modal-content {
  filter: blur(2px);
  transition: filter 0.3s ease;
}

.quick-order-modal-blurred::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1;
  transition: opacity 0.3s ease;
}

.quick-order-modal-blurred .modal-content {
  position: relative;
  z-index: 0;
}

.exit-intent-discount-modal ~ .modal-backdrop {
  backdrop-filter: blur(3px);
}

.exit-intent-icon {
  animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.exit-intent-title {
  color: #333;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.exit-intent-message {
  color: #666;
  font-size: 1rem;
  line-height: 1.6;
}

.exit-intent-discount-badge {
  display: inline-block;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: #fff;
  padding: 1.5rem 2.5rem;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(40, 167, 69, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.exit-intent-discount-badge .discount-value {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.exit-intent-discount-badge .discount-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

#acceptExitDiscount {
  font-weight: 600;
  font-size: 1.1rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

#acceptExitDiscount:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

#declineExitDiscount {
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.3s ease;
}

#declineExitDiscount:hover {
  background-color: #6c757d;
  color: #fff;
  border-color: #6c757d;
}

/* Discount Applied Badge in Quick Order Modal */
.quick-order-discount-applied {
  display: inline-block;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.5rem;
  animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.quick-order-discount-applied i {
  margin-left: 0.5rem;
}

.quick-order-original-price {
  text-decoration: line-through;
  color: #999;
  font-size: 0.9rem;
  margin-left: 0.5rem;
}
