/* ============================================
   ADD TO CART MODAL - Clean Modern Design
   Inspired by premium e-commerce UX
   ============================================ */

/* Google Fonts loaded globally in theme - removed duplicate @import */

/* ============================================
   FULLSCREEN LOADING SPINNER
   ============================================ */
.cart-modal-fullscreen-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.cart-modal-fullscreen-loader.active {
  opacity: 1;
  visibility: visible;
}

.cart-modal-fullscreen-loader .loader-spinner {
  width: 60px;
  height: 60px;
}

.cart-modal-fullscreen-loader .loader-spinner svg {
  width: 100%;
  height: 100%;
  animation: spinner-rotate 1s linear infinite;
}

.cart-modal-fullscreen-loader .loader-spinner circle {
  stroke: #fff;
  stroke-linecap: round;
  stroke-dasharray: 90, 150;
  stroke-dashoffset: 0;
  animation: spinner-dash 1.5s ease-in-out infinite;
}

@keyframes spinner-rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes spinner-dash {
  0% {
    stroke-dasharray: 1, 150;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -35;
  }
  100% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -124;
  }
}

/* ============================================
   OVERLAY
   ============================================ */
.cart-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 99990; /* Modal overlay - extremely high */
  opacity: 0;
}

.cart-modal-overlay.overlay-animate-in {
  animation: overlayFadeIn 0.3s ease-out forwards;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   MODAL CONTAINER
   ============================================ */
.cart-modal {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) scale(0.9) !important;
  background: #fff;
  z-index: 99991; /* Modal - extremely high */
  width: 95%;
  max-width: 900px;
  max-height: 90vh;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  opacity: 0;
  display: flex;
  flex-direction: column;
}

.cart-modal.modal-animate-in {
  animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Legacy animation - keep for compatibility */
@keyframes slideIn {
  from { 
    opacity: 0; 
    transform: translate(-50%, -48%); 
  }
  to { 
    opacity: 1; 
    transform: translate(-50%, -50%); 
  }
}

/* ============================================
   CLOSE BUTTON - Top Left
   ============================================ */
.cart-modal-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: transparent;
  border: none;
  z-index: 10;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

/* Header title - hidden on desktop */
.cart-modal-header-title {
  display: none;
}

.cart-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--nm-text-primary);
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  line-height: 1;
}

.cart-modal-close:hover {
  background: var(--nm-gray-100);
  transform: scale(1.05);
}

/* ============================================
   CONTENT - Two Column Layout
   ============================================ */
.cart-modal-content {
  display: flex;
  flex-direction: row;
  min-height: 500px;
  /* Allow content to scroll inside the modal (desktop). */
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.cart-modal-content::after {
  display: none !important;
}

/* ============================================
   LEFT SIDE - Product Info
   ============================================ */
.cart-modal-info {
  flex: 1;
  padding: 60px 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  background: #fff;
  order: 1;
}

/* Brand & Category Tags - One Row */
.cart-modal-tags {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.cart-modal-tags .my-brand,
.cart-modal-tags .category {
  display: inline-flex;
}

.cart-modal-tags .my-brand > div,
.cart-modal-tags .category > div {
  display: inline;
}

.cart-modal-tags .product-brand,
.cart-modal-tags a {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
}


/* Product Title */
.cart-modal-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--nm-text-primary);
  margin: 0;
  line-height: 1.3;
  text-align: right;
  background: none;
  -webkit-text-fill-color: unset;
}

.cart-modal-title a {
  color: inherit;
  text-decoration: none;
}

/* Product description body */
.cart-modal-body {
  display: block !important;
  font-size: 14px;
  color: #666;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  text-align: right;
  max-height: 150px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Mobile - smaller max height */
@media (max-width: 768px) {
  .cart-modal-body {
    max-height: 100px;
  }
}


/* ============================================
   PRICE
   ============================================ */
.cart-modal .product-price,
.cart-modal-variations .product-price {
  width: 100%;
}

.cart-modal .field--name-price,
.cart-modal .price,
.cart-modal-variations .price {
  font-size: 32px !important;
  font-weight: 700 !important;
  color: var(--nm-text-primary) !important;
  text-align: right !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  display: block;
}

.cart-modal .price--original {
  font-size: 18px !important;
  color: var(--nm-text-muted) !important;
  text-decoration: line-through;
  margin-left: 12px;
}

/* ============================================
   VARIATIONS / ATTRIBUTES
   ============================================ */
.cart-modal-variations {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cart-modal .variations {
  margin: 0 !important;
}

.cart-modal .attribute-widgets {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

.cart-modal .attribute-widgets fieldset {
  margin: 0;
  padding: 0;
  border: none;
}

.cart-modal .attribute-widgets fieldset legend,
.cart-modal .attribute-widgets .fieldset-legend {
  font-size: 14px;
  font-weight: 600;
  color: var(--nm-text-primary);
  margin-bottom: 5px !important;
  padding: 0;
  border: none;
  display: block;
  text-align: right;
}

.cart-modal .attribute-widgets .fieldset-wrapper {
  width: 100%;
}

/* Hide radio inputs */
.cart-modal .attribute-widgets input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cart-modal .attribute-widgets .form-item {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

.cart-modal .attribute-widgets .form-item::before {
  display: none !important;
}

/* ============================================
   SIZE SELECTOR - Dropdown Style
   ============================================ */
.cart-modal .attribute-widgets .form-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: none;
  overflow: visible;
}

/* Size fieldset - always RTL for alignment */
fieldset[id*='attribute-size-att'],
.cart-modal fieldset[id*='attribute-size'] {
  direction: rtl !important;
}

/* Size options as pills - use auto-fit grid for flexible widths */
fieldset[id*='attribute-size-att'] .form-radios,
.cart-modal fieldset[id*='attribute-size'] .form-radios,
.cart-modal fieldset[id*='attribute-size-att'] > .fieldset-wrapper {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)) !important;
  gap: 8px !important;
  direction: rtl !important;
  justify-content: end !important;
}

/* Ensure size labels display text properly (not RTL reversed) */
.cart-modal fieldset[id*='attribute-size-att'] .form-check-label,
.cart-modal fieldset[id*='attribute-size'] .form-check-label {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Gap for dynamically created sizes in modal */
.cart-modal fieldset[id*='attribute-size-att'] > .fieldset-wrapper > .form-item,
.cart-modal .form-radios > .form-item {
  margin: 0 !important;
}

fieldset[id*='attribute-size-att'] .form-item .form-check-label,
.cart-modal fieldset[id*='attribute-size'] .form-check-label,
.cart-modal fieldset[id*='attribute-size-att'] .fieldset-wrapper .form-check-label {
  width: 100% !important;
  min-width: unset !important;
  height: 48px;
  padding: 0 8px;
  display: inline-flex;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--nm-gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

fieldset[id*='attribute-size-att'] .form-item .form-check-label:hover {
  border-color: var(--nm-text-primary);
}

/* Selected size */
fieldset[id*='attribute-size-att'] input[type='radio']:checked + .form-check-label {
  background: #1a1a1a !important;
  border-color: #414042 !important;
  color: var(--nm-white) !important;
}

/* Size name inside label */
fieldset[id*='attribute-size-att'] .form-check-label .name,
.cart-modal fieldset[id*='attribute-size'] .form-check-label .name {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: auto !important;
  min-width: unset !important;
  max-width: 100% !important;
  box-shadow: none !important;
  font-size: inherit !important;
  color: inherit !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* ============================================
   COLOR OPTIONS
   ============================================ */
.cart-modal .attribute-widgets .form-check-label {
  cursor: pointer;
  margin: 0;
  display: block;
  transition: transform 0.15s ease;
}

/* Color swatches */
.cart-modal .color_field__swatch,
.cart-modal .attribute-widgets .color_field__swatch,
.cart-modal .rendered-color .color_field__swatch {
  width: 44px !important;
  height: 44px !important;
  border-radius: 8px !important;
  border: 2px solid var(--nm-gray-200) !important;
  transition: all 0.15s ease;
  box-shadow: none;
}

.cart-modal .attribute-widgets .form-check-label:hover .color_field__swatch {
  border-color: var(--nm-text-muted) !important;
}

/* Selected color */
.cart-modal .attribute-widgets input[type="radio"]:checked + .form-check-label .color_field__swatch {
  border-color: var(--nm-text-primary) !important;
  box-shadow: 0 0 0 2px var(--nm-white), 0 0 0 4px var(--nm-text-primary) !important;
}

/* Hide color names */
fieldset[id*='attribute-color-att'] .name,
.cart-modal fieldset[id*='attribute-color'] .name {
  display: none !important;
}

/* ============================================
   SELECT DROPDOWNS
   ============================================ */
.cart-modal .attribute-widgets select {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--nm-gray-200);
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
  font-weight: 500;
  color: var(--nm-text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
  background-size: 20px;
  text-align: right;
  direction: rtl;
}

.cart-modal .attribute-widgets select:focus {
  outline: none;
  border-color: var(--nm-text-primary);
}

/* Hidden/Disabled size options (for color-based filtering) */
.cart-modal .form-item--hidden,
.cart-modal .form-item.disabled {
  display: none !important;
}

.cart-modal .form-item--disabled {
  opacity: 0.4;
  pointer-events: none;
}

.cart-modal .form-item--disabled label {
  text-decoration: line-through;
  cursor: not-allowed;
}

/* ============================================
   QUANTITY & ADD TO CART ROW
   ============================================ */

/* Quantity wrapper */
.cart-modal #edit-quantity-wrapper,
.cart-modal [data-drupal-selector="edit-quantity-wrapper"],
.cart-modal .field--name-quantity {
  display: flex !important;
  align-items: center !important;
  margin-top: 10px !important;
  padding-top: 10px !important;
  border-top: 1px solid var(--nm-gray-100) !important;
  gap: 16px !important;
}

/* RTL (Arabic) - align to start (right side) */
html[dir="rtl"] .cart-modal #edit-quantity-wrapper,
html[dir="rtl"] .cart-modal [data-drupal-selector="edit-quantity-wrapper"],
html[dir="rtl"] .cart-modal .field--name-quantity {
  justify-content: flex-start;
}

/* LTR (English) - align to end (right side) */
html[dir="ltr"] .cart-modal #edit-quantity-wrapper,
html[dir="ltr"] .cart-modal [data-drupal-selector="edit-quantity-wrapper"],
html[dir="ltr"] .cart-modal .field--name-quantity,
html:not([dir="rtl"]) .cart-modal #edit-quantity-wrapper,
html:not([dir="rtl"]) .cart-modal [data-drupal-selector="edit-quantity-wrapper"],
html:not([dir="rtl"]) .cart-modal .field--name-quantity {
  justify-content: flex-end;
}

.cart-modal .js-form-item-quantity-0-value {
  display: flex !important;
  align-items: center !important;
  margin: 0 !important;
  gap: 12px !important;
}

.cart-modal .js-form-item-quantity-0-value > label {
  font-size: 14px;
  font-weight: 600;
  color: var(--nm-text-primary);
  margin: 0 !important;
  white-space: nowrap;
}

/* Form actions - inline with quantity */
.cart-modal .form-actions,
.cart-modal [data-drupal-selector="edit-actions"],
.cart-modal #edit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 5px;
  padding: 0;
  flex-direction: row-reverse;
}

/* Wishlist Button */
.cart-modal .flag-wishlist,
.cart-modal .wishlist-btn {
  width: 52px;
  height: 52px;
  border: 1px solid var(--nm-gray-200);
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cart-modal .flag-wishlist:hover {
  border-color: var(--nm-text-primary);
}

.cart-modal .flag-wishlist svg {
  width: 24px;
  height: 24px;
  stroke: var(--nm-text-primary);
  fill: none;
}

/* Add to Cart Button - Gradient Style */
.cart-modal .form-submit,
.cart-modal .btn-primary,
.cart-modal .button--primary,
.cart-modal .button--add-to-cart {
  flex: 1 !important;
  height: 52px !important;
  padding: 0 32px !important;
  border: 1px solid rgba(255,255,255,0.3) !important;
  border-radius: 12px !important;
  color: var(--nm-white) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-transform: none !important;
  letter-spacing: 0.3px !important;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3), inset 0 1px 0 rgba(255,255,255,0.2) !important;
  min-width: 180px !important;
  position: relative !important;
  overflow: hidden !important;
}

.cart-modal .form-submit::before,
.cart-modal .btn-primary::before,
.cart-modal .button--primary::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: -100% !important;
  width: 100% !important;
  height: 100% !important;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent) !important;
  transition: left 0.5s ease !important;
  display: block !important;
}


.cart-modal .form-submit:hover::before,
.cart-modal .btn-primary:hover::before,
.cart-modal .button--primary:hover::before {
  left: 100% !important;
}

.cart-modal .form-submit:active,
.cart-modal .btn-primary:active,
.cart-modal .button--primary:active {
  transform: translateY(0) !important;
}

/* Quantity Selector */
.cart-modal .custom-number-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--nm-gray-200);
  border-radius: 30px;
  overflow: hidden;
  background: #fff;
  height: 52px;
  flex-shrink: 0;
}

.cart-modal .custom-number-input .minus,
.cart-modal .custom-number-input .plus {
  width: 44px;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--nm-text-primary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.cart-modal .custom-number-input .minus:hover,
.cart-modal .custom-number-input .plus:hover {
  background: var(--nm-gray-100);
}

.cart-modal .custom-number-input input[type="number"] {
  width: 50px;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--nm-text-primary);
  background: #fff;
  -moz-appearance: textfield;
}

.cart-modal .custom-number-input input[type="number"]::-webkit-outer-spin-button,
.cart-modal .custom-number-input input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-modal .form-item-quantity-0-value > label {
  display: none !important;
}

.cart-modal .js-form-item-quantity-0-value {
  margin: 0 !important;
}

.cart-modal #edit-quantity-wrapper,
.cart-modal [data-drupal-selector="edit-quantity-wrapper"] {
  margin: 0;
}

/* ============================================
   PAYMENT OPTIONS (Google Pay, etc.)
   ============================================ */
.cart-modal .payment-buttons,
.cart-modal .gpay-button,
.cart-modal [class*="gpay"] {
  margin-top: 16px;
}

.cart-modal .more-payment-options {
  text-align: center;
  margin-top: 12px;
}

.cart-modal .more-payment-options a {
  font-size: 13px;
  color: #666;
  text-decoration: underline;
}

/* ============================================
   RIGHT SIDE - Product Image
   ============================================ */
.cart-modal-image {
  flex: 1;
  min-width: 0;
  background: var(--nm-gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  order: 2;
  position: relative;
}

.cart-modal-image .swiper {
  width: 100%;
  height: 100%;
  max-height: 450px;
  border-radius: 0;
  overflow: hidden;
}

.cart-modal-image img {
  width: 100%;
  height: 100%;
  max-height: 450px;
  object-fit: contain;
  display: block;
}

/* ============================================
   SPACING & UTILITIES
   ============================================ */
.cart-modal .mb-3 {
  margin-bottom: 0 !important;
}

.cart-modal .my-3 {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.cart-modal .form-check {
  margin-bottom: 0 !important;
  padding-left: 0 !important;
}

.cart-modal .fieldset-wrapper {
  margin: 0 !important;
  padding: 0 !important;
}

.pagination-swiper-recent-viewed-products-block-1 {
  display: none;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .cart-modal {
    width: 92%;
    max-width: 92%;
    height: auto;
    max-height: 98vh;
    border-radius: 12px;
    top: 50% !important;
    bottom: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    animation: fadeInMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes fadeInMobile {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  }

  .cart-modal-header {
    position: relative;
    padding: 8px 10px;
    background: #fff;
    border-bottom: 1px solid var(--nm-gray-100);
    min-height: auto;
    justify-content: space-between;
  }

  .cart-modal-header-title {
    display: block;
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--nm-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
  }

  .cart-modal-close {
    width: 24px;
    height: 24px;
    font-size: 14px;
    box-shadow: none;
    background: transparent;
    flex-shrink: 0;
  }

  .cart-modal-content {
    flex-direction: column;
    min-height: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(98vh - 36px);
  }

  .cart-modal-image {
    order: 1;
    width: 100%;
    min-height: 120px;
    max-height: 140px;
    padding: 8px;
    flex: none;
  }

  .cart-modal-image .swiper,
  .cart-modal-image img {
    max-height: 130px;
  }

  .cart-modal-info {
    order: 2;
    padding: 8px 12px 12px;
    gap: 6px;
  }

  .cart-modal-title {
    font-size: 14px;
    display: none;
  }

  .cart-modal .field--name-price,
  .cart-modal .price {
    font-size: 16px !important;
    color: #2e7d32 !important;
    font-weight: 700 !important;
  }

  .cart-modal .attribute-widgets {
    gap: 8px !important;
  }

  .cart-modal .attribute-widgets fieldset {
    margin: 0 !important;
    padding: 0 !important;
  }

  .cart-modal .attribute-widgets fieldset legend,
  .cart-modal .attribute-widgets .fieldset-legend {
    font-size: 11px !important;
    margin-bottom: 4px !important;
  }

  /* Size options - grid */
  .cart-modal fieldset[id*='attribute-size-att'] .form-radios,
  .cart-modal fieldset[id*='attribute-size'] .form-radios,
  .cart-modal fieldset[id*='attribute-size-att'] > .fieldset-wrapper {
    display: grid !important;
    gap: 6px !important;
    justify-content: stretch !important;
  }

  .cart-modal fieldset[id*='attribute-size-att'] .form-item .form-check-label,
  .cart-modal fieldset[id*='attribute-size'] .form-check-label,
  .cart-modal fieldset[id*='attribute-size-att'] label.form-check-label,
  .cart-modal fieldset[id*='attribute-size'] label.form-check-label {
    width: 100% !important;
    min-width: auto !important;
    height: 30px !important;
    padding: 0 2px !important;
    font-size: 9px !important;
    border-radius: 3px !important;
    line-height: 30px !important;
  }



  /* Action row - stack on mobile */
  .cart-modal .form-actions,
  .cart-modal [data-drupal-selector="edit-actions"],
  .cart-modal #edit-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .cart-modal .flag-wishlist {
    width: 36px;
    height: 36px;
  }

  .cart-modal .form-submit,
  .cart-modal .btn-primary,
  .cart-modal .button--primary {
    height: 40px !important;
    font-size: 12px !important;
    border-radius: 20px !important;
    flex: 1 1 auto !important;
    min-width: 100px !important;
  }

  .cart-modal .custom-number-input {
    height: 36px;
  }

  .cart-modal .custom-number-input .minus,
  .cart-modal .custom-number-input .plus {
    width: 32px;
    font-size: 14px;
  }

  .cart-modal .custom-number-input input[type="number"] {
    width: 36px;
    font-size: 13px;
  }

  .cart-modal #edit-quantity-wrapper,
  .cart-modal [data-drupal-selector="edit-quantity-wrapper"],
  .cart-modal .field--name-quantity {
    margin-top: 6px !important;
    padding-top: 6px !important;
  }

  .cart-modal #edit-quantity-wrapper,
  .cart-modal [data-drupal-selector="edit-quantity-wrapper"],
  .cart-modal .field--name-quantity,
  .cart-modal .js-form-item-quantity-0-value {
    justify-content: center !important;
  }

  .cart-modal .custom-number-input {
    width: 45% !important;
    min-width: 110px !important;
    justify-content: center;
  }

  .cart-modal .custom-number-input input[type="number"] {
    flex: 1;
    min-width: 30px;
  }
}

@media (max-width: 480px) {
  .cart-modal-image {
    min-height: 100px;
    max-height: 120px;
  }

  .cart-modal-image .swiper,
  .cart-modal-image img {
    max-height: 110px;
  }

  .cart-modal-title {
    font-size: 12px;
    display: none;
  }

  .cart-modal .field--name-price,
  .cart-modal .price {
    font-size: 15px !important;
    color: #2e7d32 !important;
  }

  .cart-modal fieldset[id*='attribute-size-att'] .form-radios {
    gap: 4px;
  }

  fieldset[id*='attribute-size-att'] .form-item .form-check-label {
    height: 28px;
    font-size: 10px;
    padding: 0 4px;
  }

  .cart-modal .color_field__swatch,
  .cart-modal .attribute-widgets .color_field__swatch {
    width: 28px !important;
    height: 28px !important;
  }

  .cart-modal .form-submit,
  .cart-modal .btn-primary,
  .cart-modal .button--primary {
    height: 38px !important;
    font-size: 11px !important;
  }

  .cart-modal .custom-number-input {
    height: 34px;
  }

  .cart-modal .custom-number-input .minus,
  .cart-modal .custom-number-input .plus {
    width: 28px;
    font-size: 13px;
  }
}

/* ============================================
   BODY SCROLL LOCK - preserves scroll position
   ============================================ */
body.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  left: 0 !important;
  right: 0 !important;
}

body:has(.cart-modal-overlay:not([hidden])) {
  overflow: hidden !important;
}

/* Ensure body creates a proper stacking context for modals */
body {
  isolation: isolate;
}

/* ============================================
   Z-INDEX HIERARCHY (when modal is on body)
   - 99990: Modal overlay (extremely high to be above everything)
   - 99991: Modal
   - 99998: jQuery UI widget overlay (for success/error)
   - 99999: Success/Error modal
   ============================================ */

/* Modal on body needs extremely high z-index to be above any views wrappers */
body > .cart-modal-overlay {
  z-index: 99990 !important;
  position: fixed !important;
}

body > .cart-modal {
  z-index: 99991 !important;
  position: fixed !important;
}

/* Global modal wrapper content (AJAX loaded) should be scrollable. */
body > .cart-modal .cart-modal-ajax-content {
  flex: 1;
  min-height: 0; /* important for flexbox scrolling */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body > .cart-modal .cart-modal-loading {
  flex: 1;
}

/* Fallback for when modal is inside article (lower z-index is fine) */
article .cart-modal-overlay {
  z-index: 100;
}

article .cart-modal {
  z-index: 101;
}

/* ============================================
   CART SUCCESS/ERROR MODAL - Above regular modals
   Z-INDEX NOTES:
   - cart-modal-overlay: 99990 (when on body)
   - cart-modal: 99991 (when on body)
   - ui-widget-overlay: 99998 (set in cart-success-modal.css)
   - cart-success-modal: 99999 (set in cart-success-modal.css)
   ============================================ */

/* When success/error modal is open, the cart modal stays visible behind it.
   Success/error modals have higher z-index to appear on top. */
body:has(.ui-dialog.cart-success-modal) .cart-modal-overlay,
body:has(.ui-dialog.cart-error-modal) .cart-modal-overlay {
  /* Keep overlay visible but allow clicks through to success/error modal */
}

/* jQuery UI overlay for success/error modals */
.ui-widget-overlay {
  background: rgba(0, 0, 0, 0.3) !important;
}

/* ============================================
   LAZY LOADING SPINNER FOR MODAL
   ============================================ */
.cart-modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  width: 100%;
}

.cart-modal-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--nm-primary-color, #333);
  border-radius: 50%;
  animation: modalSpinner 0.8s linear infinite;
}

@keyframes modalSpinner {
  to {
    transform: rotate(360deg);
  }
}

.cart-modal-lazy-content {
  display: flex;
  flex-direction: row;
  gap: 20px;
  width: 100%;
}

.cart-modal-lazy-content .cart-modal-image {
  flex: 1;
}

.cart-modal-lazy-content .cart-modal-info {
  flex: 1;
}

.cart-modal-lazy-content .modal-product-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  max-height: 400px;
}

/* ============================================
   NEW FANTASTIC QUICK MODAL DESIGN
   Modern two-panel layout with gallery
   ============================================ */

/* Close Button - Floating */
.quick-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.quick-modal-close:hover {
  background: #fff;
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.quick-modal-close svg {
  width: 20px;
  height: 20px;
}

[dir="rtl"] .quick-modal-close {
  right: auto;
  left: 16px;
}

/* Modal Body - Two Column Layout */
.quick-modal-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  max-height: 80vh;
  overflow: hidden;
}

/* Gallery Panel (Left) - Contains Image + Actions */
.quick-modal-gallery {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  flex-direction: column;
  padding: 20px;
  position: relative;
  width: 320px;
  max-width: 320px;
}

/* Actions area below image (injected by JS) */
.modal-actions-area {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Quantity input in actions area - Compact and centered */
.modal-actions-area .form-item-quantity-0-value,
.modal-actions-area .quantity-field,
.modal-actions-area .js-form-item-quantity-0-value {
  width: auto;
  display: flex;
  justify-content: center;
}

.modal-actions-area .custom-number-input {
  height: 40px !important;
  border-radius: 20px !important;
  min-width: 120px;
  max-width: 140px;
}

.modal-actions-area .custom-number-input .minus,
.modal-actions-area .custom-number-input .plus {
  width: 36px !important;
  font-size: 16px !important;
}

.modal-actions-area .custom-number-input input[type="number"] {
  width: 40px !important;
  font-size: 14px !important;
}

.modal-actions-area .form-item-quantity-0-value input:not(.custom-number-input input),
.modal-actions-area input[name*="quantity"]:not(.custom-number-input input) {
  width: 100px;
  padding: 10px 14px;
  font-size: 14px;
  text-align: center;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  background: #fff;
  transition: border-color 0.2s ease;
}

.modal-actions-area input:focus {
  border-color: var(--nm-primary, #333);
  outline: none;
}

/* Add to Cart button - 90% width centered */
.modal-actions-area .form-actions,
.modal-actions-area [data-drupal-selector="edit-actions"] {
  width: 100%;
  display: flex;
  justify-content: center;
}

.modal-actions-area .button--add-to-cart,
.modal-actions-area .form-submit,
.modal-actions-area button[type="submit"] {
  width: 100% !important;
  max-width: 100%;
  padding: 12px 20px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  color: #fff !important;
  border: none !important;
  cursor: pointer;
  transition: all 0.2s ease;
  display: block !important;
}


.modal-actions-area .button--add-to-cart:disabled,
.modal-actions-area .form-submit:disabled {
  background: #ccc !important;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Stock badge in actions area - hidden */
.modal-actions-area .modal-stock-badge,
.modal-stock-badge {
  display: none !important;
}

/* Main Image Container - Compact */
.gallery-main {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  aspect-ratio: 1;
  width: 100%;
  max-height: 280px;
}

.gallery-main .modal-product-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.gallery-main:hover .modal-product-image {
  transform: scale(1.03);
}

/* Gallery Navigation Buttons - Compact */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: #333;
}

.gallery-nav svg {
  width: 16px;
  height: 16px;
}

.gallery-nav:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-prev {
  left: 8px;
}

.gallery-next {
  right: 8px;
}

[dir="rtl"] .gallery-prev {
  left: auto;
  right: 12px;
}

[dir="rtl"] .gallery-next {
  right: auto;
  left: 12px;
}

[dir="rtl"] .gallery-prev svg,
[dir="rtl"] .gallery-next svg {
  transform: scaleX(-1);
}

/* Thumbnails Strip - Compact */
.gallery-thumbs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  padding: 4px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.gallery-thumbs::-webkit-scrollbar {
  display: none;
}

.gallery-thumb {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.gallery-thumb:hover {
  opacity: 0.9;
  border-color: rgba(0, 0, 0, 0.1);
}

.gallery-thumb.active {
  opacity: 1;
  border-color: var(--nm-primary-color, #667eea);
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.25);
}

/* Details Panel (Right) - Scrollable */
.quick-modal-details {
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  background: #fff;
  max-height: 80vh;
}

/* Tags (Brand & Category) */
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-tags .tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-tags .tag a {
  text-decoration: none;
  color: inherit;
}

.detail-tags .tag-brand,
.detail-tags .tag-brand a {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff !important;
}

.detail-tags .tag-category,
.detail-tags .tag-category a {
  background: #f1f3f4;
  color: #5f6368;
}

/* Title */
.detail-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.3;
  margin: 0;
  letter-spacing: -0.5px;
}

/* Description */
.detail-description {
  font-size: 15px;
  line-height: 1.7;
  color: #666;
  max-height: 520px !important;
  overflow-y: auto !important;
  overflow-x: hidden;
}

.detail-description p {
  margin: 0;
}

/* Product body text in cart modal */
.cart-modal .field--name-body,
.cart-modal .product-body,
.cart-modal .product-description {
  max-height: 520px !important;
  overflow-y: auto !important;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.6;
  color: #666;
  padding-right: 5px;
  margin-bottom: 10px;
}

/* Price */
.detail-price {
  margin: 8px 0;
}

.detail-price .price,
.detail-price .field--name-price {
  font-size: 32px !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.detail-price .price--original {
  font-size: 18px !important;
  color: #999 !important;
  text-decoration: line-through;
  -webkit-text-fill-color: #999;
  margin-inline-start: 12px;
}

/* Price number (current price) - bold green */
.detail-price .price-number {
  font-size: 28px;
  font-weight: 800;
  color: #28a745;
}

/* Original price with strikethrough */
.detail-price .original-price {
  font-size: 18px;
  color: #999;
  text-decoration: line-through;
  margin-inline-start: 10px;
}

/* Discount badge */
.detail-price .discount-badge {
  background: #e53935;
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  margin-inline-start: 10px;
}

/* Variations */
.detail-variations {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================================
   QUICK MODAL - MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .quick-modal-body {
    grid-template-columns: 1fr;
    max-height: 95vh;
    overflow: hidden;
  }

  .quick-modal-gallery {
    width: 100%;
    max-width: 100%;
    padding: 8px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .gallery-main {
    width: 140px;
    min-width: 140px;
    max-height: 140px;
    aspect-ratio: 1;
    flex-shrink: 0;
  }

  .gallery-main .modal-product-image {
    max-height: 130px;
  }

  .gallery-thumbs {
    display: none;
  }

  .gallery-nav {
    display: none;
  }

  /* Smaller description on mobile */
  .detail-description {
    max-height: 320px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
  }
  
  .cart-modal .field--name-body,
  .cart-modal .product-body,
  .cart-modal .product-description {
    max-height: 280px !important;
    font-size: 13px !important;
  }

  .quick-modal-details {
    padding: 10px 12px;
    gap: 6px;
    max-height: calc(95vh - 180px);
    overflow-y: auto;
  }

  .detail-title {
    font-size: 16px;
    line-height: 1.2;
     margin-top:10px;
    margin-bottom:10px;
  }


  .detail-tags .tag {
    padding: 3px 8px;
    font-size: 9px;
  }

  .detail-price .price,
  .detail-price .field--name-price {
    font-size: 18px !important;
  }

  .detail-price {
    margin: 4px 0;
  }

  .detail-variations {
    gap: 8px;
  }

  .quick-modal-close {
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
  }

  .quick-modal-close svg {
    width: 12px;
    height: 12px;
  }

  [dir="rtl"] .quick-modal-close {
    right: auto;
    left: 6px;
  }

  /* Compact attribute widgets */
  .cart-modal .attribute-widgets {
    gap: 6px !important;
  }

  .cart-modal .attribute-widgets fieldset legend,
  .cart-modal .attribute-widgets .fieldset-legend {
    font-size: 10px !important;
    margin-bottom: 3px !important;
  }

  /* Smaller size buttons */
  fieldset[id*='attribute-size-att'] .form-item .form-check-label,
  .cart-modal fieldset[id*='attribute-size'] .form-check-label {
    min-width: 40px;
    height: 32px;
    padding: 0 8px;
    font-size: 11px;
  }

  /* Smaller color swatches */
  .cart-modal .color_field__swatch,
  .cart-modal .attribute-widgets .color_field__swatch {
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
  }

  /* Compact quantity and button */
  .cart-modal .custom-number-input {
    height: 36px;
  }

  .cart-modal .custom-number-input .minus,
  .cart-modal .custom-number-input .plus {
    width: 30px;
    font-size: 14px;
  }

  .cart-modal .custom-number-input input[type="number"] {
    width: 36px;
    font-size: 13px;
  }

  .cart-modal .form-submit,
  .cart-modal .btn-primary,
  .cart-modal .button--primary,
  .cart-modal .button--add-to-cart {
    height: 38px !important;
    font-size: 12px !important;
    padding: 0 16px !important;
    min-width: 100px !important;
  }

  .cart-modal .form-actions,
  .cart-modal [data-drupal-selector="edit-actions"],
  .cart-modal #edit-actions {
    gap: 8px;
  }

  .cart-modal #edit-quantity-wrapper,
  .cart-modal [data-drupal-selector="edit-quantity-wrapper"],
  .cart-modal .field--name-quantity {
    margin-top: 4px !important;
    padding-top: 4px !important;
    border-top: none !important;
  }
}

@media (max-width: 480px) {
  .quick-modal-gallery {
    padding: 6px;
    gap: 6px;
  }

  .gallery-main {
    width: 100px;
    min-width: 100px;
    max-height: 100px;
  }

  .gallery-main .modal-product-image {
    max-height: 90px;
  }

  .quick-modal-details {
    padding: 8px 10px;
    gap: 5px;
    max-height: calc(95vh - 140px);
  }

  .detail-title {
    font-size: 12px;
  }



  .detail-tags .tag {
    padding: 2px 6px;
    font-size: 8px;
  }

  .detail-price .price,
  .detail-price .field--name-price {
    font-size: 16px !important;
  }

  /* Even smaller size buttons */
  fieldset[id*='attribute-size-att'] .form-item .form-check-label,
  .cart-modal fieldset[id*='attribute-size'] .form-check-label {
    min-width: 36px;
    height: 28px;
    padding: 0 6px;
    font-size: 10px;
  }



  .cart-modal .form-submit,
  .cart-modal .btn-primary,
  .cart-modal .button--primary,
  .cart-modal .button--add-to-cart {
    height: 34px !important;
    font-size: 11px !important;
  }

  .cart-modal .custom-number-input {
    height: 32px;
  }

  .cart-modal .custom-number-input .minus,
  .cart-modal .custom-number-input .plus {
    width: 26px;
    font-size: 12px;
  }

  .cart-modal .custom-number-input input[type="number"] {
    width: 32px;
    font-size: 12px;
  }
}

/* ============================================
   SKELETON LOADING STATE
   Shows immediately while content loads
   ============================================ */

/* Skeleton line animation */
@keyframes skeletonPulse {
  0% { opacity: 0.4; }
  50% { opacity: 0.7; }
  100% { opacity: 0.4; }
}

.skeleton-line {
  display: inline-block;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  border-radius: 4px;
  height: 16px;
}

.skeleton-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.skeleton-tags .skeleton-line {
  height: 24px;
  border-radius: 12px;
}

.skeleton-price {
  margin: 16px 0;
}

.skeleton-price .skeleton-line {
  border-radius: 8px;
}

.skeleton-variations {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.skeleton-variations .skeleton-line {
  border-radius: 8px;
}

.skeleton-actions {
  margin-top: 20px;
}

.skeleton-actions .skeleton-line {
  border-radius: 12px;
}

/* Loading state for details panel */
.quick-modal-details--loading {
  pointer-events: none;
}

.quick-modal-details--loading .detail-title {
  color: #666;
}

/* Image loading state */
.modal-product-image.loading {
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.modal-product-image:not(.loading) {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Hide gallery nav buttons (no longer used) */
.gallery-nav,
.gallery-thumbs {
  display: none !important;
}

/* Simplified gallery - just the main image */
.quick-modal-gallery {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-main {
  position: relative;
}

/* Mobile skeleton adjustments */
@media (max-width: 768px) {
  .skeleton-variations .skeleton-line {
    height: 40px;
  }
  
  .skeleton-actions .skeleton-line {
    height: 44px;
  }
  
  .skeleton-price .skeleton-line {
    width: 80px !important;
    height: 24px !important;
  }
}

/* ============================================
   STOCK STATUS BADGE
   Shows real-time stock availability
   ============================================ */

.modal-stock-badge {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}

.modal-stock-badge span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.modal-stock-badge .stock-available {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  color: #155724;
}

.modal-stock-badge .stock-low {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
  color: #856404;
  animation: pulse-warning 2s ease-in-out infinite;
}

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

.modal-stock-badge .stock-out {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #721c24;
}

/* RTL support */
[dir="rtl"] .modal-stock-badge {
  justify-content: flex-start;
}

/* Disabled state for out-of-stock button */
.cart-modal .form-submit:disabled,
.cart-modal .button--add-to-cart:disabled {
  background: #ccc !important;
  cursor: not-allowed !important;
  opacity: 0.7 !important;
  box-shadow: none !important;
  transform: none !important;
}

.cart-modal .form-submit:disabled:hover,
.cart-modal .button--add-to-cart:disabled:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Mobile stock badge */
@media (max-width: 768px) {
  .modal-stock-badge {
    margin-bottom: 8px;
  }
  
  .modal-stock-badge span {
    font-size: 11px;
    padding: 4px 10px;
  }
}

/* ============================================
   CLIENT-SIDE ATTRIBUTE FILTERING STYLES
   Shows which sizes are unavailable for color
   ============================================ */

/* Disabled size options in select dropdown */
.cart-modal select[name*="attribute_size"] option:disabled {
  color: #999;
  background: #f5f5f5;
}

/* Hidden options (filtered out) - use CSS to hide smoothly */
.cart-modal select[name*="attribute_size"] option[disabled] {
  display: none;
}

/* Disabled size radio/checkbox labels */
.cart-modal .form-item.disabled,
.cart-modal label.disabled {
  opacity: 0.4;
  pointer-events: none;
  text-decoration: line-through;
}

/* Size buttons that are disabled */
.cart-modal .size-button:disabled,
.cart-modal .size-option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
  background: #f5f5f5 !important;
  border-color: #ddd !important;
  color: #999 !important;
}

/* Smooth transition for attribute changes */
.cart-modal select[name*="attribute"] {
  transition: opacity 0.15s ease;
}

.cart-modal select[name*="attribute"].updating {
  opacity: 0.6;
  pointer-events: none;
}

/* ============================================================
   OPTIMISTIC UI - Instant feedback animations
   ============================================================ */

/* Button success flash animation */
.btn-success-flash {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
  border-color: #28a745 !important;
  color: white !important;
  transform: scale(1.02);
  transition: all 0.2s ease;
}

/* Cart badge pulse animation */
.cart-badge-pulse {
  animation: cartBadgePulse 0.6s ease;
}

@keyframes cartBadgePulse {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.4);
    background-color: #28a745;
  }
  60% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

/* Floating success notification */
.cart-success-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  padding: 16px 28px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(40, 167, 69, 0.4);
  z-index: 100000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-success-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* RTL support */
[dir="rtl"] .cart-success-notification {
  font-family: 'Cairo', 'Tajawal', sans-serif;
}

/* Floating error notification */
.cart-error-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  padding: 16px 28px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(220, 53, 69, 0.4);
  z-index: 100000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cart-error-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .cart-success-notification,
  .cart-error-notification {
    bottom: 20px;
    padding: 12px 20px;
    font-size: 13px;
    max-width: 90%;
  }
}

/* ============================================================
   INSTANT SUCCESS MODAL - Client-side rendered
   ============================================================ */

/* Force center success modal on all screen sizes */
.ui-dialog.cart-success-modal {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  z-index: 9999999 !important;
  top: 50% !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  max-width: calc(100vw - 40px) !important;
  margin: 0 !important;
}

/* Override inline top style set by jQuery UI */
.ui-dialog.cart-success-modal[style*="top"] {
  top: 50% !important;
}

.cart-success-modal.instant-success .ui-dialog-content {
  padding: 0 !important;
}

.cart-added-modal-content {
  padding: 24px;
  text-align: center;
  font-family: 'Cairo', 'Tajawal', sans-serif;
}

.cart-added-modal-content .success-header {
  margin-bottom: 20px;
}

.cart-added-modal-content .success-icon {
  margin-bottom: 12px;
  animation: successPop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.cart-added-modal-content .success-title {
  font-size: 20px;
  font-weight: 700;
  color: #28a745;
  margin: 0;
}

.cart-added-modal-content .product-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 16px;
  text-align: start;
}

[dir="rtl"] .cart-added-modal-content .product-summary {
  flex-direction: row-reverse;
}

.cart-added-modal-content .product-image {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.cart-added-modal-content .product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-added-modal-content .product-info {
  flex: 1;
  min-width: 0;
}

.cart-added-modal-content .product-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-added-modal-content .product-attributes {
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
}

.cart-added-modal-content .product-attributes .attribute {
  display: inline-block;
  margin-inline-end: 12px;
}

.cart-added-modal-content .product-qty {
  font-size: 13px;
  color: #666;
}

.cart-added-modal-content .product-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--nm-primary-color, #333);
  margin-top: 4px;
}

.cart-added-modal-content .cart-summary {
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.cart-added-modal-content .cart-count-label {
  color: #666;
}

.cart-added-modal-content .cart-count-value {
  font-weight: 700;
  color: #333;
}

.cart-added-modal-content .modal-actions {
  display: flex;
  gap: 12px;
}

.cart-added-modal-content .modal-actions .btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.cart-added-modal-content .btn-continue {
  background: #f1f1f1;
  color: #333;
}

.cart-added-modal-content .btn-continue:hover {
  background: #e5e5e5;
}

.cart-added-modal-content .btn-view-cart {
  background: var(--nm-primary-color, #333);
  color: white;
}

.cart-added-modal-content .btn-view-cart:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Mobile responsive */
@media (max-width: 480px) {
  /* Increase modal width on mobile */
  .ui-dialog.cart-success-modal,
  .ui-dialog.cart-error-modal {
    width: calc(100vw - 20px) !important;
    left: 50% !important;
  }
  
  .cart-added-modal-content {
    padding: 16px 12px;
  }
  
  .cart-added-modal-content .success-icon svg {
    width: 48px;
    height: 48px;
  }
  
  .cart-added-modal-content .success-title {
    font-size: 16px;
  }
  
  .cart-added-modal-content .product-summary {
    flex-direction: column !important;
    text-align: center;
    padding: 12px;
    gap: 10px;
  }
  
  .cart-added-modal-content .product-info {
    text-align: center;
  }
  
  .cart-added-modal-content .product-name {
    font-size: 13px;
    white-space: normal;
    line-height: 1.3;
  }
  
  .cart-added-modal-content .product-attributes,
  .cart-added-modal-content .product-qty {
    font-size: 11px;
  }
  
  .cart-added-modal-content .product-price {
    font-size: 14px;
  }
  
  .cart-added-modal-content .cart-summary {
    padding: 10px 12px;
    font-size: 12px;
    margin-bottom: 14px;
  }
  
  .cart-added-modal-content .modal-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .cart-added-modal-content .modal-actions .btn {
    padding: 12px 16px;
    font-size: 13px;
  }
}

/* ============================================================
   ERROR MODAL - Server rejection display
   ============================================================ */

/* Force center error modal on all screen sizes */
.ui-dialog.cart-error-modal {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  z-index: 9999999 !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  max-width: calc(100vw - 40px) !important;
  margin: 0 !important;
}

.cart-error-modal .ui-dialog-content {
  padding: 0 !important;
}

.cart-error-modal-content {
  padding: 24px;
  text-align: center;
  font-family: 'Cairo', 'Tajawal', sans-serif;
}

.cart-error-modal-content .error-header {
  margin-bottom: 16px;
}

.cart-error-modal-content .error-icon {
  margin-bottom: 12px;
  animation: errorShake 0.5s ease;
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.cart-error-modal-content .error-title {
  font-size: 20px;
  font-weight: 700;
  color: #dc3545;
  margin: 0;
}

.cart-error-modal-content .error-message {
  font-size: 15px;
  color: #555;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #fff5f5;
  border-radius: 8px;
  border: 1px solid #ffccd5;
}

.cart-error-modal-content .stock-info {
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.cart-error-modal-content .stock-info.available {
  background: #fff3cd;
  color: #856404;
}

.cart-error-modal-content .stock-info.out-of-stock {
  background: #f8d7da;
  color: #721c24;
}

.cart-error-modal-content .modal-actions {
  display: flex;
  justify-content: center;
}

.cart-error-modal-content .btn-close-error {
  padding: 12px 40px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--nm-primary-color, #333);
  color: white;
  transition: all 0.2s ease;
}

.cart-error-modal-content .btn-close-error:hover {
  opacity: 0.9;
}
