/* =========================================================
 * CRÉER UN RETOUR — modal
 * ========================================================= */

.cr-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9100;
  align-items: center;
  justify-content: center;
}
.cr-modal.is-open {
  display: flex;
}
.cr-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
.cr-modal__dialog {
  position: relative;
  background: linear-gradient(
    300deg,
    var(--color-tertiary, #f5f5f2) 66%,
    #fff 66%
  );
  width: 92%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
}
.cr-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  padding: 0;
  z-index: 2;
}

/* Título */
.cr-modal__title-bar {
  background: var(--color-txt, #1a1a1a);
  padding: 16px 40px 0;
  text-align: center;
}
.cr-modal__title-bar h2 {
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
  margin: 0;
}
.cr-modal__subtitle {
  background: var(--color-txt, #1a1a1a);
  padding: 6px 40px 14px;
  text-align: center;
}
.cr-modal__subtitle p {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: #fff;
  margin: 0;
  font-weight: 600;
}

/* Sección artículos */
.cr-modal__articles {
  padding: 20px 30px;
}
.cr-modal__articles-title {
  font-family: var(--font-body);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 1rem;
  color: var(--color-primary, #333);
  margin: 0 0 16px;
}
.cr-modal__swiper {
  overflow: hidden;
}
.cr-modal__slide {
  width: 150px;
}
.cr-modal__item {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  user-select: none;
}
.cr-modal__item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cr-modal__item-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  border: 1px solid var(--color-border-primary, #ddd);
  overflow: hidden;
  transition: border-color 0.15s;
}
.cr-modal__item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.cr-modal__item-img-empty {
  background: #f0f0f0;
  width: 100%;
  height: 100%;
}
.cr-modal__item-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--color-txt, #1a1a1a);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.cr-modal__item.is-disabled {
  cursor: not-allowed;
  pointer-events: none;
}
.cr-modal__item.is-disabled .cr-modal__item-img-wrap {
  opacity: 0.45;
}
.cr-modal__item-returned-badge {
    display: flex;
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #e67e00;
    border: 1px solid #e67e00;
    padding: 3px 5px 0px;
    margin-top: 2px;
    align-items: center;
    justify-content: center;
}
.cr-modal__item-returned-badge--approuve {
  color: #27ae60;
  border-color: #27ae60;
}
.cr-modal__item.is-selected .cr-modal__item-img-wrap {
  border-color: var(--color-txt, #1a1a1a);
  border-width: 2px;
}
.cr-modal__item.is-selected .cr-modal__item-check {
  opacity: 1;
  background: var(--color-txt, #1a1a1a);
  color: #fff;
}
.cr-modal__item-name {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  text-decoration: underline;
  text-transform: uppercase;
  color: var(--color-dark, #111);
  margin: 0;
  line-height: 1.3;
}
.cr-modal__item-price {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-dark, #111);
  margin: 0;
}
.cr-modal__item-attr {
  font-size: 0.68rem;
  color: var(--color-dark, #111);
  margin: 0;
  line-height: 1.4;
}

.cr-modal__item-qty {
  display: none;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}
.cr-modal__item.is-selected .cr-modal__item-qty {
  display: flex;
}
.cr-modal__item-qty-label {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--color-dark, #111);
  white-space: nowrap;
}
.cr-modal__item-qty-input {
  width: 46px;
  border: 1px solid var(--color-txt, #1a1a1a);
  background: #fff;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  padding: 2px 4px;
  outline: none;
}

/* Sección método de retorno */
.cr-modal__method {
  padding: 0 30px 20px;
  border-top: 6px solid #fff;
}
.cr-modal__method-title {
  font-family: var(--font-body);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 1rem;
  color: var(--color-primary, #333);
  margin: 20px 0 14px;
}
.cr-modal__method-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 100px;
  margin-top: 25px;
}
.cr-modal__method-option {
  cursor: pointer;
  transition: opacity 0.15s;
}
.cr-modal__method-option:not(.is-selected) {
  opacity: 0.6;
}

.cr-modal__method .sc-field__wrap.-der {
  max-width: 350px;
}
.cr-modal__method .sc-field__wrap.-der::after {
  background-color: var(--color-tertiary);
}
.cr-modal__method .sc-field__deco.-der svg {
  width: 25px;
  height: 25px;
  object-fit: contain;
}
.cr-method-option-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-dark, #111);
  margin-bottom: 8px;
}
.cr-method-select {
  width: 100%;
  border: 1.5px solid var(--color-txt, #1a1a1a);
  background: var(--color-tertiary, #f5f5f2);
  color: var(--color-txt, #1a1a1a);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 9px 14px;
  cursor: pointer;
  appearance: auto;
  outline: none;
}
/* Footer con botón submit */
.cr-modal__footer {
  padding: 20px 30px 30px;
  text-align: center;
  border-top: 6px solid #fff;
}
.cr-modal__submit {
  background: var(--color-txt);
  color: #fff;
  display: inline-block;
  font-size: 0.8rem;
  text-transform: uppercase;
  padding: 7px 18px;
  cursor: pointer;
  text-decoration: underline;
  text-align: center;
  border: 1px solid var(--color-txt);
  transition:
    background 0.2s,
    color 0.2s;
  white-space: nowrap;
  min-width: 230px;
}
.cr-modal__submit:hover:not(:disabled) {
  background: var(--color-txt, #1a1a1a);
  color: #fff;
}
.cr-modal__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mensaje feedback */
.cr-modal__feedback {
  margin-top: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 20px;
}
.cr-modal__feedback--success {
  color: #27ae60;
}
.cr-modal__feedback--error {
  color: #c0392b;
}

@media (max-width: 580px) {
  .cr-modal__method-options {
    grid-template-columns: 1fr;
    gap: 20px;
}
  .cr-modal__items-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  .cr-modal__title-bar,
  .cr-modal__subtitle {
    padding-left: 20px;
    padding-right: 20px;
  }
  .cr-modal__articles,
  .cr-modal__method,
  .cr-modal__footer {
    padding-left: 20px;
    padding-right: 20px;
  }
  .cr-modal__dialog {
    width: 96%;
    max-height: 92vh;
  }
}
