/* Parche inmediato: fuerza tipografía del módulo por especificidad y !important */
.wac-wrap,
.wac-wrap * {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    "Noto Sans",
    "Liberation Sans",
    sans-serif !important;
}
.wac-wrap {
  max-width: 1100px;
  margin: 24px auto;
}
.wac-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.wac-col {
  flex: 1;
  min-width: 300px;
  background: #fff;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
}
.wac-field {
  margin-bottom: 12px;
}
#wac-customer-results {
  margin-top: 12px;
  list-style: none;
  padding-left: 0;
}
#wac-customer-results li {
  padding: 6px 8px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.wac-qty {
  display: flex;
  gap: 6px;
  align-items: center;
}
.wac-assigned {
  margin-top: 8px;
  font-style: italic;
}
#wac-cart-container {
  margin-top: 16px;
}
.eliminar {
  background-color: #e63b33 !important;
}
.wac-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}
table.widefat {
  width: 100%;
  border-collapse: collapse;
}
table.widefat th,
table.widefat td {
  padding: 8px;
}
.b1 {
  padding-top: 10px !important;
  padding-right: 20px !important;
  padding-bottom: 10px !important;
  padding-left: 20px !important;
}
/* ============================================
   AUTOCOMPLETADO - DISEÑO MEJORADO CON IMÁGENES
   ============================================ */

/* Ajustar ancho del contenedor de búsqueda */
.wac-search-col {
  min-width: 50% !important;
  flex: 0 0 50% !important;
}

/* POR DEFECTO, OCULTO */
.ui-autocomplete {
  display: none !important;
  max-height: 400px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  z-index: 999999 !important;
  background: #fff !important;
  border: 1px solid #ccc !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
  border-radius: 8px !important;
  margin-top: 4px !important;
  padding: 0 !important;
  list-style: none !important;
  position: absolute !important;
  width: auto !important;
  min-width: 600px !important;
}

/* MOSTRAR cuando tiene cualquiera de estas clases */
.ui-autocomplete.wac-autocomplete-open,
.ui-autocomplete.wac-customer-autocomplete-open {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Items del listado */
.ui-autocomplete li {
  padding: 0 !important;
  margin: 0 !important;
  list-style: none !important;
  border: none !important;
  border-bottom: 1px solid #e8e8e8 !important;
}

.ui-autocomplete li:last-child {
  border-bottom: none !important;
}

/* Alternancia de colores de fondo - GRISES MUY SUAVES */
.ui-autocomplete li:nth-child(odd) {
  background: #fafafa !important; /* Gris muy suave */
}

.ui-autocomplete li:nth-child(even) {
  background: #f5f5f5 !important; /* Gris ligeramente más oscuro */
}

/* Hover */
.ui-autocomplete li:hover,
.ui-autocomplete li.ui-state-active,
.ui-autocomplete li.ui-state-focus {
  background: #e3f2fd !important; /* Azul muy suave */
}

/* Contenedor del producto - LAYOUT CON IMAGEN */
.wac-autocomplete-item {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  padding: 12px !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  gap: 12px !important;
}

/* Imagen del producto */
.wac-autocomplete-img {
  width: 60px !important;
  height: 60px !important;
  object-fit: cover !important;
  border-radius: 6px !important;
  border: 1px solid #e0e0e0 !important;
  flex-shrink: 0 !important;
  background: #fff !important;
}

/* Avatar del cliente (emoji o icono) */
.wac-customer-avatar {
  width: 60px !important;
  height: 60px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 32px !important;
  background: #e3f2fd !important;
  border-radius: 50% !important;
  border: 1px solid #2271b1 !important;
  flex-shrink: 0 !important;
}

/* Contenedor de información (todo excepto la imagen) */
.wac-autocomplete-info {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  min-width: 0 !important; /* Para que funcione el ellipsis */
}

/* Header: Nombre + Precio en la misma línea */
.wac-autocomplete-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 10px !important;
}

.wac-autocomplete-name {
  font-weight: 600 !important;
  font-size: 14px !important;
  color: #333 !important;
  flex: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.wac-autocomplete-price {
  font-weight: 700 !important;
  font-size: 14px !important;
  color: #0062a4 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

/* Tags - SIN icono */
.wac-autocomplete-tags {
  font-size: 11px !important;
  color: #777 !important;
  font-style: italic !important;
  line-height: 1.3 !important;
}

/* Descripción */
.wac-autocomplete-desc {
  font-size: 11px !important;
  color: #999 !important;
  line-height: 1.4 !important;
}

/* ============================================
   SIN RESULTADOS
   ============================================ */
.ui-autocomplete .wac-no-results {
  background: #fafafa !important;
  border-bottom: none !important;
  cursor: default !important;
  pointer-events: none !important;
}
/* Evitar efecto hover en el ítem de sin resultados */
.ui-autocomplete .wac-no-results:hover,
.ui-autocomplete .wac-no-results.ui-state-active,
.ui-autocomplete .wac-no-results.ui-state-focus {
  background: #fafafa !important;
}
.wac-no-results-msg {
  padding: 20px 16px !important;
  color: #aaa !important;
  font-size: 13px !important;
  font-style: italic !important;
  text-align: center !important;
}
.wac-no-results-msg strong {
  font-style: normal !important;
  color: #888 !important;
}

/* ============================================
   RESALTADO DE TÉRMINO BUSCADO
   ============================================ */
.ui-autocomplete mark {
  background: #fff3b0 !important;
  color: inherit !important;
  font-weight: 700 !important;
  border-radius: 2px !important;
  padding: 0 1px !important;
}

/* ============================================
   PLACEHOLDER DE IMAGEN
   ============================================ */
.wac-img-placeholder {
  width: 60px !important;
  height: 60px !important;
  flex-shrink: 0 !important;
  border-radius: 6px !important;
  border: 1px solid #e0e0e0 !important;
  background: #f5f5f5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ccc'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") center/32px no-repeat !important;
}

/* ============================================
   ANIMACIÓN DE APERTURA
   ============================================ */
@keyframes wac-dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ui-autocomplete.wac-autocomplete-open,
.ui-autocomplete.wac-customer-autocomplete-open {
  animation: wac-dropdown-in 0.15s ease-out !important;
}

/* ============================================
   SPINNER DE CARGA EN EL CAMPO
   ============================================ */
@keyframes wac-spin {
  to { transform: rotate(360deg); }
}
.wac-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.wac-search-wrapper::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: #2271b1;
  border-radius: 50%;
  animation: wac-spin 0.7s linear infinite;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.wac-search-wrapper.wac-is-searching::after {
  opacity: 1;
}

/* ============================================
   CAMPOS DE BÚSQUEDA (PRODUCTO Y CLIENTE)
   ============================================ */
#wac-product-search,
#wac-customer-query {
  padding: 12px !important;
  font-size: 16px !important;
  border: 2px solid #2271b1 !important;
  border-radius: 6px !important;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100% !important;
  box-sizing: border-box !important;
}

#wac-product-search:focus,
#wac-customer-query:focus {
  outline: none;
  border-color: #135e96 !important;
  box-shadow: 0 0 0 3px rgba(33, 113, 177, 0.15) !important;
}

/* Estado buscando: padding-right para no tapar el spinner */
.wac-is-searching #wac-product-search,
.wac-is-searching #wac-customer-query {
  padding-right: 38px !important;
}

#wac-product-search-message {
  padding: 10px;
  margin-top: 10px;
  border-radius: 4px;
  font-weight: 500;
}

/* Order complete styling */
.wac-order-complete {
  background: #f7f7f7;
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-top: 12px;
}

/* Botón "Quitar" cupón como texto plano */
.wac-coupon .wac-remove-coupon {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin-left: 6px;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.wac-coupon .wac-remove-coupon:hover,
.wac-coupon .wac-remove-coupon:focus {
  color: #d32f2f; /* rojo */
  text-decoration: underline;
  outline: none;
}
/* 1. Forzar un ancho específico a la columna de WAC */
th.column-wac_payment_editable,
td.column-wac_payment_editable {
  width: 150px !important;
  min-width: 150px !important;
}

/* 2. Ajustar el contenedor */
.wac-payment-col-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

/* 3. Ajustar el select para que no sea tan ancho */
.wac-payment-col-select {
  width: 100%;
  max-width: 100px; /* Limita el ancho del dropdown */
  font-size: 11px;
  height: 28px;
  min-height: 28px;
}

/* 4. Ajustar el botón */
.wac-payment-save-btn {
  padding: 0 6px !important;
  line-height: 26px !important;
  min-height: 28px !important;
  font-size: 11px !important;
}
/* Tabla de carrito mejorada */
.widefat thead th {
  background: #2271b1;
  color: white;
}

.widefat tbody tr:hover {
  background: #f6f7f7;
}

/* Precios con descuento */
.widefat td del {
  color: #999;
  font-size: 0.9em;
}

/* Cupones aplicados */
.wac-coupon {
  display: inline-block;
  background: #00a32a;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  margin: 5px;
  font-size: 0.95em;
}

.wac-coupon em {
  opacity: 0.8;
  margin-left: 5px;
}

.wac-coupon button {
  background: transparent !important;
  border: 1px solid white !important;
  color: white !important;
  padding: 2px 8px !important;
  margin-left: 8px !important;
  cursor: pointer;
}

.wac-coupon button:hover {
  background: white !important;
  color: #00a32a !important;
}

/* Totales destacados */
.widefat tfoot tr {
  font-weight: 600;
}

.widefat tfoot tr:last-child {
  border-top: 2px solid #2271b1;
}

/* ============================================
   BOTONES "AGREGAR A CARRITO 2/3" EN TIENDA
   ============================================ */
.wac-shop-add-to-cart-group {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.wac-shop-add-to-cart {
  font-size: 11px !important;
  padding: 3px 8px !important;
  min-height: 28px !important;
  line-height: 1.4 !important;
  white-space: nowrap;
}

.wac-shop-add-to-cart[data-cart-id="2"] {
  background-color: #e0f0fc !important;
  border-color: #2271b1 !important;
  color: #2271b1 !important;
}

.wac-shop-add-to-cart[data-cart-id="3"] {
  background-color: #fef3cd !important;
  border-color: #f59e0b !important;
  color: #b45309 !important;
}

.wac-shop-add-to-cart:hover {
  opacity: 0.85;
}
