/* Simplified Rectangular Item Customization UI */
.item-customization-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.item-customization-popup.active {
  opacity: 1;
  visibility: visible;
}

.popup-content {
  width: 95%;
  max-width: 500px;
  background-color: #1a1a1a;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transform: scale(0.98);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.item-customization-popup.active .popup-content {
  transform: scale(1);
}

/* Header */
.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(0, 0, 0, 0.2);
}

.popup-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff !important;
  margin: 0;
}

.close-popup {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 20px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-popup:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Ensure customize popup title is always visible */
.item-customization-popup .popup-header h3 {
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Body */
.popup-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  flex-grow: 1;
  background-color: #1a1a1a;
}

/* Item Preview */
.item-preview {
  display: flex;
  align-items: center;
  padding: 15px;
  background-color: rgba(40, 40, 40, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  gap: 15px;
  border-radius: 8px;
}

.item-image-container {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 5px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.preview-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.item-name {
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 5px;
  font-size: 16px;
  line-height: 1.4;
}

/* Customization Options */
.customization-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.option-group {
  background-color: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.option-group label {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  margin-bottom: 10px;
  display: block;
}

/* Weight Slider */
.weight-input-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.weight-control-row {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.weight-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  border-radius: 3px;
}

.weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ffffff;
  cursor: pointer;
  border: 2px solid #000000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.weight-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ffffff;
  cursor: pointer;
  border: 2px solid #000000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.weight-text-input {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  height: 36px;
  border-radius: 4px;
}

.weight-text-input input {
  width: 60px;
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 14px;
  text-align: right;
  -moz-appearance: textfield;
  padding: 0;
}

.weight-text-input input::-webkit-outer-spin-button,
.weight-text-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.weight-unit {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-left: 4px;
}

/* Price Slider */
.price-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  border-radius: 3px;
}

.price-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ffffff;
  cursor: pointer;
  border: 2px solid #000000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.price-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ffffff;
  cursor: pointer;
  border: 2px solid #000000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Mutation Selection */
.mutations-checkbox-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mutation-checkbox {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.mutation-checkbox:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.mutation-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.mutation-checkbox label {
  position: relative;
  padding-left: 25px;
  cursor: pointer;
  font-size: 14px;
  color: #ffffff;
  user-select: none;
  width: 100%;
  margin: 0;
  transform: scale(1);
  transform-origin: left center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mutation-checkbox label:before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.mutation-checkbox label:after {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 6px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  opacity: 0;
}

.mutation-checkbox input:checked + label:before {
  background: #ffffff;
  border-color: #ffffff;
}

.mutation-checkbox input:checked + label:after {
  opacity: 1;
  border-color: #000000;
}

/* Footer */
.popup-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(0, 0, 0, 0.2);
}

.cancel-btn,
.confirm-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  transition: all 0.2s ease;
}

.cancel-btn {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

.cancel-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

.confirm-btn {
  background-color: #333333;
  color: #ffffff;
  border: 1px solid #ffffff;
}

.confirm-btn:hover {
  background-color: #555555;
}

/* Responsive Adjustments */
@media (max-width: 550px) {
  .item-preview {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px;
  }

  .item-image-container {
    margin-bottom: 10px;
  }

  .mutations-checkbox-group {
    grid-template-columns: repeat(2, 1fr);
  }

  .popup-header h3 {
    font-size: 15px;
  }

  .popup-body {
    padding: 15px;
  }

  .popup-footer {
    padding: 12px 15px;
  }

  .cancel-btn,
  .confirm-btn {
    padding: 8px 12px;
    min-width: 70px;
    font-size: 13px;
  }
}