/* ==========================================================================
   MODAL DE CONFIGURACIÓN DE PRODUCTOS - ESTILOS
   Se integra con el diseño existente de cart.css
   ========================================================================== */

/* Modal Container */
.product-config-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

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

/* Overlay */
.config-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

/* Modal Content */
.config-modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  max-width: 550px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  z-index: 10001;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header */
.config-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 12px 12px 0 0;
}

.config-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.config-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.config-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Body */
.config-modal-body {
  padding: 14px 18px;
}

.config-product-info {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f3f4f6;
}

.config-product-info h4 {
  margin: 0 0 3px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.config-product-sku {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

/* Options */
.config-option {
  margin-bottom: 10px;
}

.config-option label {
  display: block;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  font-size: 12px;
}

.config-option label i {
  color: #3b82f6;
  margin-right: 6px;
}

.required {
  color: #f59e0b;
  font-weight: bold;
}

/* Select */
.config-select {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.config-select:hover {
  border-color: #c7d2fe;
}

.config-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Colors Grid */
.config-colors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.config-color-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
}

.config-color-item:hover {
  border-color: #3b82f6;
  background: #f9fafb;
}

.config-color-item input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
}

.config-color-item input[type="checkbox"]:checked + span {
  font-weight: 600;
  color: #3b82f6;
}

.config-color-item span {
  font-size: 14px;
  color: #374151;
  transition: all 0.3s ease;
}

/* Checkbox Label */
.config-checkbox-label {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.config-checkbox-label:hover {
  border-color: #3b82f6;
  background: #fafbff;
}

.config-checkbox-label input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
}

.config-checkbox-label span {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.config-sticker-price {
  margin-left: auto;
  color: #10b981;
  font-weight: 600;
  font-size: 13px;
}

/* Quantity Controls */
.config-quantity-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-qty-btn {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.config-qty-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.4);
}

.config-qty-btn:active {
  transform: translateY(0);
}

.config-quantity-input {
  width: 70px;
  padding: 8px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
}

.config-quantity-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.config-min-text {
  margin: 4px 0 0 0;
  font-size: 11px;
  color: #6b7280;
  font-style: italic;
}

/* Price Box */
.config-price-box {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 10px;
}

.config-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
  color: #374151;
}

.config-price-row:last-child {
  margin-bottom: 0;
}

.config-total {
  padding-top: 6px;
  border-top: 2px solid #d1d5db;
  font-size: 14px;
  font-weight: 700;
}

.config-price-value {
  font-weight: 700;
  color: #1f2937;
}

.config-total .config-price-value {
  color: #3b82f6;
  font-size: 16px;
}

/* Footer */
.config-modal-footer {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid #e5e7eb;
  background: #fafbff;
  border-radius: 0 0 12px 12px;
}

.config-btn-cancel,
.config-btn-add {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.config-btn-cancel {
  background: white;
  color: #6b7280;
  border: 2px solid #e5e7eb;
}

.config-btn-cancel:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.config-btn-add {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
}

.config-btn-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(59, 130, 246, 0.4);
}

.config-btn-add:active {
  transform: translateY(0);
}

/* Scrollbar */
.config-modal-content::-webkit-scrollbar {
  width: 8px;
}

.config-modal-content::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 0 16px 16px 0;
}

.config-modal-content::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 4px;
}

.config-modal-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
}

/* ==========================================================================
   SISTEMA DE COLORES CON DISTRIBUCIÓN (ESTILO CALCULADORA)
   ========================================================================== */

/* Help Text */
.config-help-text {
  margin: 0 0 6px 0;
  font-size: 11px;
  color: #6b7280;
  font-style: italic;
}

/* Grid de colores - 3 COLUMNAS PROFESIONAL */
.config-colors-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 3px;
}

/* Item de color individual */
.color-item-pro {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px 6px;
  background: linear-gradient(135deg, #fafbff 0%, #ffffff 100%);
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  transition: all 0.2s ease;
  overflow: hidden;
}

.color-item-pro:hover {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.1);
}

/* Info del color */
.color-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Indicador de color (círculo) */
.color-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}

.color-item-pro:hover .color-indicator {
  transform: scale(1.15);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

/* Nombre del color */
.color-name {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Controles de cantidad */
.color-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Botones +/- profesionales */
.btn-color-decrease,
.btn-color-increase {
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-color-decrease:hover,
.btn-color-increase:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

.btn-color-decrease:active,
.btn-color-increase:active {
  transform: scale(0.98);
}

.btn-color-decrease:disabled,
.btn-color-increase:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Input de cantidad */
.input-color-qty {
  flex: 1;
  padding: 3px 4px;
  border: 1.5px solid #e5e7eb;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
  background: white;
  transition: all 0.2s ease;
  min-width: 0;
  max-width: 100%;
}

.input-color-qty:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.input-color-qty::placeholder {
  color: #9ca3af;
  font-size: 11px;
  font-weight: 500;
}

/* Efecto cuando tiene valor */
.input-color-qty:not([value="0"]) {
  border-color: #10b981;
  background: #f0fdf4;
  color: #065f46;
}

/* Scrollbar del grid de colores */
.config-colors-grid::-webkit-scrollbar {
  width: 6px;
}

.config-colors-grid::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.config-colors-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 3px;
}

.config-colors-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
}

/* Responsive */
@media (max-width: 768px) {
  .config-modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .config-modal-header {
    padding: 14px 16px;
  }

  .config-modal-header h3 {
    font-size: 16px;
  }

  .config-modal-body {
    padding: 12px 14px;
  }

  .config-colors-grid {
    grid-template-columns: repeat(3, 1fr);
    max-height: 190px;
    gap: 5px;
  }

  .color-item-pro {
    padding: 4px 5px;
    gap: 3px;
  }

  .color-indicator {
    width: 14px;
    height: 14px;
  }

  .color-name {
    font-size: 11px;
  }

  .btn-color-decrease,
  .btn-color-increase {
    width: 22px;
    height: 22px;
    font-size: 13px;
  }

  .input-color-qty {
    font-size: 12px;
    padding: 3px 5px;
  }

  .config-modal-footer {
    padding: 12px 14px;
  }
}

@media (max-width: 480px) {
  .config-modal-content {
    width: 96%;
    max-height: 92vh;
    border-radius: 10px;
  }

  .config-modal-header {
    padding: 12px 14px;
    border-radius: 10px 10px 0 0;
  }

  .config-modal-header h3 {
    font-size: 15px;
  }

  .config-modal-body {
    padding: 10px 12px;
  }

  .config-colors-grid {
    grid-template-columns: repeat(2, 1fr);
    max-height: 170px;
    gap: 4px;
    overflow-x: hidden;
  }

  .color-item-pro {
    padding: 3px 4px;
    gap: 2px;
  }

  .color-info {
    gap: 4px;
  }

  .color-indicator {
    width: 13px;
    height: 13px;
  }

  .color-name {
    font-size: 10px;
  }

  .color-controls {
    gap: 2px;
  }

  .btn-color-decrease,
  .btn-color-increase {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  .input-color-qty {
    font-size: 11px;
    padding: 3px 4px;
  }

  .config-quantity-controls {
    gap: 6px;
  }

  .config-quantity-input {
    width: 60px;
    font-size: 14px;
  }

  .config-modal-footer {
    padding: 10px 12px;
  }

  .config-btn-cancel,
  .config-btn-add {
    padding: 9px 16px;
    font-size: 13px;
  }

  .config-total .config-price-value {
    font-size: 15px;
  }
}

/* ==========================================================================
   CAMPOS ADICIONALES: Fecha, Hora, Zona de Envío, Urgente
   ========================================================================== */

/* Input de fecha */
.config-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.config-input:hover {
  border-color: #c7d2fe;
}

.config-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Radio Group para zona de envío */
.config-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-radio-label {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.config-radio-label:hover {
  border-color: #3b82f6;
  background: #fafbff;
}

.config-radio-label input[type="radio"] {
  margin-right: 10px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
}

.config-radio-label input[type="radio"]:checked + span {
  font-weight: 600;
  color: #3b82f6;
}

.config-radio-label span {
  font-size: 13px;
  color: #374151;
  transition: all 0.2s ease;
}

/* Radio seleccionado */
.config-radio-label:has(input:checked) {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}

/* Iconos en radio labels */
.config-radio-label span i {
  margin-right: 6px;
  font-size: 14px;
}

/* Sección de tipo de entrega destacada */
#config-delivery-option-section {
  background: #f0fdf4;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #86efac;
}

#config-delivery-option-section > label {
  color: #166534;
}

#config-delivery-option-section .config-radio-label:has(input[value="pickup"]:checked) {
  border-color: #22c55e;
  background: linear-gradient(135deg, #dcfce7 0%, #ffffff 100%);
}

#config-delivery-option-section .config-radio-label:has(input[value="delivery"]:checked) {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #dbeafe 0%, #ffffff 100%);
}

/* Suma de colores */
.config-colors-sum {
  margin: 8px 0 0 0;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border-radius: 6px;
  background: #f3f4f6;
  transition: all 0.3s ease;
}

/* Nota del producto */
.config-note {
  margin: 8px 0 0 0;
  padding: 8px 10px;
  font-size: 11px;
  color: #6b7280;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  border-left: 3px solid #f59e0b;
}

/* Urgente checkbox especial */
#config-urgent-section .config-checkbox-label {
  border-color: #fcd34d;
  background: #fffbeb;
}

#config-urgent-section .config-checkbox-label:hover {
  border-color: #f59e0b;
  background: #fef3c7;
}

#config-urgent-section .config-checkbox-label span {
  color: #92400e;
}

#config-urgent-section .config-checkbox-label i {
  color: #f59e0b;
}

/* Animación para precio cuando cambia */
@keyframes priceUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); color: #10b981; }
  100% { transform: scale(1); }
}

.config-total .config-price-value.updated {
  animation: priceUpdate 0.3s ease;
}

/* Nota de envío en el modal de configuración */
.config-shipping-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border: 1px dashed #7dd3fc;
  border-radius: 6px;
  color: #0369a1;
  font-size: 0.75rem;
  margin-top: 10px;
}

.config-shipping-note i {
  color: #E19100;
}

/* Responsive adicional */
@media (max-width: 480px) {
  .config-radio-group {
    gap: 6px;
  }

  .config-radio-label {
    padding: 8px 10px;
  }

  .config-radio-label span {
    font-size: 12px;
  }

  .config-input {
    padding: 7px 10px;
    font-size: 13px;
  }
}
