/**
 * NP Styled Components — Size stock dropdown (custom).
 * El <option> nativo no admite HTML/color; este UI sí.
 * Check estilo similar a npaddressdependency (.np-rut-check).
 */

.np-sc-size-select.np-sc-size-select--enhanced {
  position: absolute !important;
  width: 1px !important;
  max-width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Refuerzo: pdp/plp mobile no deben forzar width:100% sobre el sr-only */
@media (max-width: 767.98px) {
  .npv-size-row .np-sc-size-select.np-sc-size-select--enhanced,
  .npv-size-row select.form-select.np-sc-size-select--enhanced {
    width: 1px !important;
    max-width: 1px !important;
    min-width: 0 !important;
  }

  .npv-size-row .np-sc-size-dd {
    grid-area: select;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}

.np-sc-size-dd {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  font-size: 0.9375rem;
  z-index: 5;
}

.np-sc-size-dd.is-open {
  z-index: 80;
}

.np-sc-size-dd__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.375rem 2.25rem 0.375rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat right 0.75rem center / 12px;
  color: #212529;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.np-sc-size-dd__btn:hover,
.np-sc-size-dd__btn:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.np-sc-size-dd.is-open .np-sc-size-dd__btn {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.np-sc-size-dd__btn-main {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1;
}

.np-sc-size-dd__list {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 90;
  max-height: 16rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}

.np-sc-size-dd.is-open .np-sc-size-dd__list {
  display: block;
}

.np-sc-size-dd__opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 0;
  background: transparent;
  color: #212529;
  text-align: left;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  box-sizing: border-box;
}

.np-sc-size-dd__opt:hover,
.np-sc-size-dd__opt:focus {
  background: #f1f3f5;
  outline: 0;
}

.np-sc-size-dd__opt.is-selected {
  background: #e9ecef;
}

.np-sc-size-dd__opt.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.np-sc-size-dd__size {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  flex: 0 0 auto;
  line-height: 1;
}

.np-sc-size-dd__status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.np-sc-size-dd__status > span:last-child {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.np-sc-size-dd__status--ok {
  color: #198754;
}

.np-sc-size-dd__status--bad {
  color: #dc3545;
}

.np-sc-size-dd__status--pending {
  color: #6c757d;
  font-weight: 500;
}

/* Ticket verde (mismo espíritu que .np-rut-check) */
.np-sc-size-dd__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.np-sc-size-dd__badge--ok {
  background: #198754;
  color: #fff;
  border: 1px solid #146c43;
}

.np-sc-size-dd__badge--bad {
  background: #dc3545;
  color: #fff;
  border: 1px solid #b02a37;
}

/* Loader (solo si falta data; no abrir el listado) */
.np-sc-size-dd__skel {
  display: inline-block;
  width: 4.25rem;
  height: 0.55rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #e9ecef 25%, #f8f9fa 50%, #e9ecef 75%);
  background-size: 200% 100%;
  animation: np-sc-size-skel 0.9s ease-in-out infinite;
}

@keyframes np-sc-size-skel {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* Encajar en fila talla + qty + guía */
.npv-size-row .np-sc-size-dd {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 992px) {
  .npv-size-row .np-sc-size-dd {
    max-width: 232px;
  }
}

@media (max-width: 767.98px) {
  .np-sc-size-dd {
    font-size: 0.8125rem;
  }

  .np-sc-size-dd__btn {
    min-height: 2.25rem;
    font-size: 0.8125rem;
    padding: 0.3rem 2rem 0.3rem 0.55rem;
  }

  .np-sc-size-dd__status {
    font-size: 0.65rem;
    gap: 0.2rem;
  }

  .np-sc-size-dd__badge {
    width: 0.95rem;
    height: 0.95rem;
    font-size: 0.58rem;
  }

  .np-sc-size-dd__opt {
    padding: 0.4rem 0.6rem;
    font-size: 0.8125rem;
  }

  .np-sc-size-dd__skel {
    width: 3.5rem;
    height: 0.45rem;
  }
}

/* Quickview: labels más compactos para que quepan sin scroll horizontal */
.quickview .np-sc-size-dd,
.page-product--quickview .np-sc-size-dd {
  max-width: 100%;
  min-width: 0;
}

.quickview .np-sc-size-dd__btn,
.page-product--quickview .np-sc-size-dd__btn {
  padding: 0.3rem 1.85rem 0.3rem 0.5rem;
  min-height: 2.25rem;
  font-size: 0.8125rem;
  background-position: right 0.5rem center;
  background-size: 10px;
}

.quickview .np-sc-size-dd__btn-main,
.page-product--quickview .np-sc-size-dd__btn-main {
  gap: 0.3rem;
}

.quickview .np-sc-size-dd__status,
.page-product--quickview .np-sc-size-dd__status {
  font-size: 0.68rem;
  gap: 0.18rem;
}

.quickview .np-sc-size-dd__badge,
.page-product--quickview .np-sc-size-dd__badge {
  width: 0.9rem;
  height: 0.9rem;
  font-size: 0.55rem;
}

.quickview .np-sc-size-dd__opt,
.page-product--quickview .np-sc-size-dd__opt {
  padding: 0.35rem 0.55rem;
  font-size: 0.8125rem;
}

.quickview .npv-size-row,
.page-product--quickview .npv-size-row {
  overflow: visible;
  max-width: 100%;
  min-width: 0;
}

/*
 * Viewport intermedio (tablet / laptop angosto ~768–1199):
 * el badge «disponible» no debe desbordar; «Ver tabla» ya va debajo del select.
 */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .np-sc-size-dd__btn {
    min-height: 2.35rem;
    padding: 0.3rem 1.9rem 0.3rem 0.55rem;
    font-size: 0.875rem;
    background-position: right 0.55rem center;
    background-size: 11px;
  }

  .np-sc-size-dd__btn-main {
    gap: 0.28rem;
    min-width: 0;
  }

  .np-sc-size-dd__size {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .np-sc-size-dd__status {
    font-size: 0.68rem;
    gap: 0.18rem;
    max-width: 70%;
    overflow: hidden;
  }

  .np-sc-size-dd__status > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .np-sc-size-dd__badge {
    width: 0.95rem;
    height: 0.95rem;
    font-size: 0.55rem;
  }

  /* QV en este rango: más compacto (columna derecha estrecha) */
  .quickview .np-sc-size-dd__status > span:last-child,
  .page-product--quickview .np-sc-size-dd__status > span:last-child {
    max-width: 8rem;
  }

  body#product .npv-size-row,
  .quickview .npv-size-row,
  .page-product--quickview .npv-size-row {
    max-width: 100%;
    min-width: 0;
  }
}

