/**
 * @file
 * Quick Checkout Modal styles - Compact design matching cart modal.
 */

/* Enhanced Cairo Font Import */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&display=swap');

/* Body scroll lock when modal is open */
body.quick-checkout-open {
  overflow: hidden;
}

/* Page loading overlay */
.quick-checkout-page-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4));
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

/* Modal Overlay - Glass morphism effect */
.quick-checkout-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4));
  backdrop-filter: blur(5px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Modal Container - Compact Glass morphism design */
.quick-checkout-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 94%;
  max-width: 520px;
  background: #fff;
  backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 
    0 24px 48px rgba(102, 126, 234, 0.15),
    0 12px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255,255,255,0.4);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  direction: rtl;
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Wide modal for two-column layout */
.quick-checkout-modal.quick-checkout-modal--wide {
  max-width: 900px;
}

.quick-checkout-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Modal Content - No scroll */
.quick-checkout-modal-content {
  overflow: visible;
}

/* Two Column Layout */
.quick-checkout-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.quick-checkout-column {
  padding: 16px;
}

.quick-checkout-column--product {
  background: #f8f9fa;
  border-left: 1px solid #eee;
  display: flex;
  flex-direction: column;
}

.quick-checkout-column--address {
  background: #fff;
}

.qc-column-title {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #667eea;
  font-family: "Cairo", sans-serif;
}

/* Header - Compact */
.quick-checkout-header {
  background: linear-gradient(135deg, #667eea, #764ba2);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-checkout-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  font-family: "Cairo", sans-serif;
  color: #fff;
}

.quick-checkout-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.2s ease;
}

.quick-checkout-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Product Info - With variation image */
.quick-checkout-product {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

/* Product in column layout - no extra padding */
.quick-checkout-column--product .quick-checkout-product {
  padding: 0;
  background: transparent;
  border-bottom: none;
}

.quick-checkout-product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

/* Price Breakdown */
.quick-checkout-price-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #eee;
}

/* Price breakdown in column layout */
.quick-checkout-column--product .quick-checkout-price-breakdown {
  margin-top: auto;
}

.qc-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #666;
}

.qc-price-label {
  font-weight: 500;
}

.qc-subtotal-row .qc-subtotal {
  font-weight: 600;
  color: #333;
}

.qc-shipping-row {
  color: #888;
}

.qc-shipping-cost {
  font-weight: 500;
}

.qc-shipping-cost .free-shipping {
  color: #28a745;
  font-weight: 600;
}

.qc-shipping-cost s {
  color: #999;
  font-size: 11px;
  margin-right: 4px;
}

.qc-discount-row {
  color: #28a745;
}

.qc-discount {
  font-weight: 600;
}

.qc-total-row {
  border-top: 1px solid #eee;
  padding-top: 6px;
  margin-top: 4px;
  font-size: 14px;
}

.qc-total-row .qc-price-label {
  font-weight: 700;
  color: #333;
}

.qc-total {
  font-size: 16px;
  font-weight: 700;
  color: #667eea;
}

/* Variation Image */
.quick-checkout-product-image {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 2px solid rgba(102, 126, 234, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quick-checkout-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Attribute Selection (Color & Size) */
.quick-checkout-attributes {
  padding: 12px 0;
  background: transparent;
  border-bottom: none;
  margin-bottom: 12px;
}

/* Attributes in column - no extra padding */
.quick-checkout-column--product .quick-checkout-attributes {
  padding: 12px 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.quick-checkout-attribute-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.quick-checkout-attribute-row:last-child {
  margin-bottom: 0;
}

.quick-checkout-attribute-row > label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  min-width: 45px;
}

/* Color Buttons */
.quick-checkout-colors {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Color Swatches */
.qc-color-btn.qc-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: 0 0 0 1px #ddd, 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
}

.qc-color-btn.qc-color-swatch .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.qc-color-btn.qc-color-swatch:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px #667eea, 0 4px 8px rgba(0,0,0,0.15);
}

.qc-color-btn.qc-color-swatch.selected {
  box-shadow: 0 0 0 3px #667eea, 0 4px 8px rgba(102, 126, 234, 0.3);
  transform: scale(1.1);
}

/* Fallback for colors without hex - text button */
.qc-color-btn:not(.qc-color-swatch) {
  width: auto;
  min-width: 28px;
  height: 28px;
  border-radius: 14px;
  border: 2px solid #ddd;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0 10px;
  font-size: 11px;
  background: #f5f5f5;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qc-color-btn:not(.qc-color-swatch):hover {
  border-color: #667eea;
}

.qc-color-btn:not(.qc-color-swatch).selected {
  border-color: #667eea;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}

/* Size Buttons */
.quick-checkout-sizes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.qc-size-btn {
  min-width: 36px;
  height: 28px;
  padding: 0 10px;
  border-radius: 14px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  font-family: "Cairo", sans-serif;
  transition: all 0.2s ease;
}

.qc-size-btn:hover {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

.qc-size-btn.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-color: transparent;
}

/* Unavailable size buttons - hidden by default */
.qc-size-btn.qc-size-unavailable {
  display: none !important;
}

/* Low Stock Warning - hidden by default */
.qc-stock-warning {
  display: none !important;
  margin-top: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
  border: 1px solid #ffc107;
  border-radius: 8px;
  font-size: 12px;
  color: #856404;
  text-align: center;
  font-family: "Cairo", sans-serif;
}

/* Only show when explicitly set to block */
.qc-stock-warning[style*="display: block"],
.qc-stock-warning[style*="display:block"] {
  display: block !important;
  animation: pulse-warning 2s infinite;
}

.qc-stock-warning .qc-stock-icon {
  margin-left: 4px;
}

.qc-stock-warning strong {
  color: #d63384;
  font-weight: 700;
}

/* Out of stock style */
.qc-stock-warning.out-of-stock {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  border-color: #dc3545;
  color: #721c24;
}

@keyframes pulse-warning {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* Quantity Input */
.quick-checkout-quantity-row {
  margin-top: 8px;
}

.quick-checkout-quantity {
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 20px;
  overflow: hidden;
  width: fit-content;
}

.qc-qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: #667eea;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.qc-qty-btn:hover {
  background: #667eea;
  color: #fff;
}

.qc-qty-btn:active {
  transform: scale(0.95);
}

.qc-qty-input {
  width: 50px;
  height: 32px;
  border: none;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  font-family: "Cairo", sans-serif;
  color: #333;
  background: #fff;
  -moz-appearance: textfield;
}

.qc-qty-input::-webkit-outer-spin-button,
.qc-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qc-qty-input:focus {
  outline: none;
}

/* Coupon/Promotion Code - Separate Section */
.quick-checkout-coupon-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

/* Coupon in column layout */
.quick-checkout-column--product .quick-checkout-coupon-section {
  border: 1px dashed rgba(102, 126, 234, 0.3);
}

.qc-coupon-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  margin: 0;
}

.qc-coupon-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #667eea;
  cursor: pointer;
}

.qc-coupon-icon {
  font-size: 16px;
}

.qc-coupon-checkbox-label span:last-child {
  font-weight: 600;
  color: #667eea;
}

.quick-checkout-coupon-content {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(102, 126, 234, 0.15);
}

.quick-checkout-coupon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qc-coupon-input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #ddd;
  border-radius: 18px;
  font-size: 13px;
  font-family: "Cairo", sans-serif;
  background: #fff;
  transition: border-color 0.2s ease;
}

.qc-coupon-input:focus {
  outline: none;
  border-color: #667eea;
}

.qc-coupon-input::placeholder {
  color: #999;
}

.qc-apply-coupon-btn {
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: "Cairo", sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.qc-apply-coupon-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.qc-apply-coupon-btn:active {
  transform: scale(0.98);
}

.qc-apply-coupon-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.qc-coupon-message {
  margin-top: 6px;
  font-size: 12px;
  min-height: 16px;
}

.qc-coupon-message.success {
  color: #28a745;
}

.qc-coupon-message.error {
  color: #dc3545;
}

.qc-coupon-message .discount-amount {
  font-weight: 600;
}

/* Applied coupon badge */
.qc-coupon-applied {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.3);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  color: #28a745;
}

.qc-coupon-applied .remove-coupon {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}

/* Form - Compact */
.quick-checkout-form {
  padding: 0;
}

/* Form in column layout */
.quick-checkout-column--address .quick-checkout-form {
  padding: 0;
}

/* Form Grid - 2 columns */
.quick-checkout-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-checkout-form-row {
  margin-bottom: 10px;
}

.quick-checkout-form-row label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  font-family: "Cairo", sans-serif;
}

.quick-checkout-form-row label .optional {
  font-weight: 400;
  color: #aaa;
  font-size: 10px;
}

.quick-checkout-form-row input,
.quick-checkout-form-row select {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: "Cairo", sans-serif;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
  color: #333;
}

.quick-checkout-form-row select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
  cursor: pointer;
}

.quick-checkout-form-row select:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

.quick-checkout-form-row select option {
  padding: 8px;
}

/* Location grid - region and city in one row */
.quick-checkout-location-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-checkout-form-row input:focus,
.quick-checkout-form-row select:focus,
.quick-checkout-form-row textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.quick-checkout-form-row input.quick-checkout-error,
.quick-checkout-form-row select.quick-checkout-error,
.quick-checkout-form-row textarea.quick-checkout-error {
  border-color: #e53e3e;
  background: #fff5f5;
}

/* Notes textarea */
.quick-checkout-form-row textarea,
.qc-notes-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: "Cairo", sans-serif;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
  color: #333;
  resize: vertical;
  min-height: 50px;
  max-height: 100px;
}

/* City select - Compact */
.quick-checkout-city-select {
  display: flex;
  gap: 6px;
}

.quick-checkout-city-select select {
  width: 45%;
  flex-shrink: 0;
  font-size: 12px;
  padding: 8px 8px;
}

.quick-checkout-city-select input {
  flex: 1;
  min-width: 0;
}

/* Action Buttons - Compact inline */
.quick-checkout-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.quick-checkout-submit,
.quick-checkout-cancel,
.quick-checkout-reset {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: "Cairo", sans-serif;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Primary Submit Button */
.quick-checkout-submit {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  flex: 1;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.quick-checkout-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Secondary Buttons */
.quick-checkout-cancel,
.quick-checkout-reset {
  background: #f0f0f0;
  color: #666;
  border: 1px solid #ddd;
}

.quick-checkout-cancel:hover,
.quick-checkout-reset:hover {
  background: #e8e8e8;
}

/* Loading State - Compact */
.quick-checkout-loading {
  padding: 40px 20px;
  text-align: center;
}

.quick-checkout-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(102, 126, 234, 0.2);
  border-top: 3px solid #667eea;
  border-radius: 50%;
  margin: 0 auto 15px;
  animation: quick-checkout-spin 1s linear infinite;
}

@keyframes quick-checkout-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.quick-checkout-loading p {
  margin: 0;
  font-size: 14px;
  color: #666;
  font-family: "Cairo", sans-serif;
}

/* Success State - Compact */
.quick-checkout-success {
  padding: 30px 20px;
  text-align: center;
}

.quick-checkout-success-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 15px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.quick-checkout-success h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #333;
  font-family: "Cairo", sans-serif;
  font-weight: 700;
}

.quick-checkout-order-number {
  margin: 0 0 15px 0;
  font-size: 13px;
  color: #888;
  font-family: "Cairo", sans-serif;
}

.quick-checkout-close-success {
  padding: 10px 30px;
  font-size: 13px;
  font-weight: 600;
  font-family: "Cairo", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-checkout-close-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Cart Checkout Modal - Cart Info Styling */
.quick-checkout-cart-info {
  width: 100%;
}

/* Cart modal without columns - add padding to sections */
.quick-checkout-modal:not(.quick-checkout-modal--wide) .quick-checkout-product {
  padding: 16px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
}

.quick-checkout-modal:not(.quick-checkout-modal--wide) .quick-checkout-coupon-section {
  margin: 0;
  padding: 14px 20px;
  border-radius: 0;
  border-top: none;
  border-bottom: 1px solid #eee;
}

.quick-checkout-modal:not(.quick-checkout-modal--wide) .quick-checkout-form {
  padding: 16px 20px 20px;
}

.quick-checkout-cart-info .quick-checkout-product-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.cart-items-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

/* Tablet Responsive - Stack columns */
@media (max-width: 768px) {
  .quick-checkout-modal.quick-checkout-modal--wide {
    max-width: 96%;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .quick-checkout-columns {
    grid-template-columns: 1fr;
  }
  
  .quick-checkout-column--product {
    border-left: none;
    border-bottom: 1px solid #eee;
  }
  
  .quick-checkout-column {
    padding: 12px 16px;
  }
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .quick-checkout-modal {
    width: 96%;
    max-width: none;
  }
  
  .quick-checkout-modal.quick-checkout-modal--wide {
    max-width: none;
  }
  
  .quick-checkout-form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .quick-checkout-city-select {
    flex-direction: column;
    gap: 8px;
  }
  
  .quick-checkout-city-select select {
    width: 100%;
  }
  
  .quick-checkout-actions {
    flex-wrap: wrap;
  }
  
  .quick-checkout-submit {
    width: 100%;
    order: -1;
  }
  
  .quick-checkout-cancel,
  .quick-checkout-reset {
    flex: 1;
  }
}
