/**
 * Cart Sidebar Variation Editor Styles
 * Prefix: cs-var-editor (Cart Sidebar Variation Editor)
 */

.cs-var-editor {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.cs-var-editor--active {
  opacity: 1;
  visibility: visible;
}

.cs-var-editor__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.cs-var-editor__modal {
  position: relative;
  background: #fff;
  border-radius: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 420px;
  width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.2s ease;
}

.cs-var-editor--active .cs-var-editor__modal {
  transform: translateY(0);
}

.cs-var-editor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.cs-var-editor__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.cs-var-editor__close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  transition: background 0.15s ease;
}

.cs-var-editor__close:hover {
  background: #f5f5f5;
  color: #333;
}

.cs-var-editor__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.cs-var-editor__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 12px;
  color: #666;
}

.cs-var-editor__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #eee;
  border-top-color: #81ba78;
  border-radius: 50%;
  animation: cs-var-spin 0.8s linear infinite;
}

@keyframes cs-var-spin {
  to {
    transform: rotate(360deg);
  }
}

.cs-var-editor__error {
  text-align: center;
  padding: 40px 20px;
  color: #c00;
}

.cs-var-editor__product {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.cs-var-editor__product-image {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 0;
  overflow: hidden;
  background: #f9f9f9;
}

.cs-var-editor__product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cs-var-editor__product-info {
  flex: 1;
  min-width: 0;
}

.cs-var-editor__product-name {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
}

.cs-var-editor__product-price {
  font-size: 14px;
  color: #81ba78;
  font-weight: 600;
}

.cs-var-editor__product-price del {
  color: #999;
  font-weight: 400;
}

.cs-var-editor__product-price ins {
  text-decoration: none;
}

.cs-var-editor__unavailable {
  color: #999;
  font-weight: 400;
}

.cs-var-editor__attributes {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cs-var-editor__attr {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-var-editor__attr-label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cs-var-editor__attr-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cs-var-editor__option {
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 0;
  background: #fff;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cs-var-editor__option:hover {
  border-color: #81ba78;
}

.cs-var-editor__option--selected {
  background: #81ba78;
  border-color: #81ba78;
  color: #fff;
}

.cs-var-editor__option--disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

.cs-var-editor__option--disabled:hover {
  border-color: #ddd;
}

.cs-var-editor__quantity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.cs-var-editor__quantity-label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cs-var-editor__quantity-controls {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid #ddd;
  border-radius: 0;
  overflow: hidden;
}

.cs-var-editor__qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f9f9f9;
  font-size: 18px;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.cs-var-editor__qty-btn:hover {
  background: #eee;
}

.cs-var-editor__qty-value {
  width: 48px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  background: #fff;
}

.cs-var-editor__footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #eee;
}

.cs-var-editor__btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cs-var-editor__btn--cancel {
  background: #f5f5f5;
  color: #666;
}

.cs-var-editor__btn--cancel:hover {
  background: #eee;
}

.cs-var-editor__btn--confirm {
  background: #81ba78;
  color: #fff;
}

.cs-var-editor__btn--confirm:hover {
  background: #6ea566;
}

.cs-var-editor__btn--disabled,
.cs-var-editor__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cs-var-editor__btn--confirm:disabled:hover {
  background: #81ba78;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .cs-var-editor__modal {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    height: 100%;
  }

  .cs-var-editor__body {
    flex: 1;
  }

  .cs-var-editor__product {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .cs-var-editor__product-image {
    width: 100px;
    height: 100px;
  }

  .cs-var-editor__attr-options {
    justify-content: center;
  }
}

/* ============================================
   Sidebar Inline Quantity Controls
   ============================================ */

.sidebar-qty-editor {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-qty-editor.updating {
  opacity: 0.5;
  pointer-events: none;
}

.sidebar-qty-controls {
  display: flex;
  align-items: center;
  border: 1px solid #000;
  height: 30px;
  overflow: hidden;
}

.sidebar-qty-btn {
  width: 33.33%;
  height: 100%;
  font-size: 26px;
  color: #81ba78;
  background: #fff;
}

.sidebar-qty-btn:hover {
  background: #eee;
}

.sidebar-qty-value {
  width: 28px;
  text-align: center;
  border: none;
  background: #fff !important;
  box-shadow: none !important;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  -moz-appearance: textfield;
}

.sidebar-qty-confirm {
  width: 24px;
  height: 24px;
  border: none;
  background: #81ba78;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  padding: 0;
  line-height: 1;
}

.sidebar-qty-confirm:hover {
  background: #6ea566;
}

.sidebar-qty-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sidebar-qty-confirm.hidden {
  display: none;
}

.remove-button {
  text-align: end;
  padding-top: 0.5rem;
}
