/* Ventana de complementos del carrito.
   Va en un mu-plugin con handle propio porque wallflower-theme-switch.php
   desregistra wf-style en prioridad 99 y este CSS se perdería. */

.wf-comple {
  --wf-comple-linea: var(--wf-line, rgba(0, 0, 0, .14));
  --wf-comple-rosa: var(--wf-rose-deep, #a63d5b);
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(.8rem, 3vw, 2rem);
}

.wf-comple[hidden] {
  display: none;
}

/* Mientras está abierta, la página de detrás no se desplaza. */
body.wf-comple-abierta {
  overflow: hidden;
}

.wf-comple__fondo {
  position: absolute;
  inset: 0;
  background: rgba(60, 30, 40, .45);
  backdrop-filter: blur(2px);
}

.wf-comple__caja {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(60rem, 100%);
  max-height: 100%;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(80, 30, 50, .28);
  overflow: hidden;
}

.wf-comple__cerrar {
  position: absolute;
  top: .5rem;
  right: .7rem;
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
}

.wf-comple__cerrar:hover {
  opacity: 1;
}

.wf-comple__cabecera {
  padding: 1.6rem 3rem 1rem;
  text-align: center;
}

.wf-comple__titulo {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.7rem);
}

.wf-comple__bajada {
  margin: .35rem 0 0;
  font-size: .92rem;
  opacity: .7;
}

.wf-comple__cuerpo {
  overflow-y: auto;
  padding: .5rem 1.4rem 1.2rem;
}

.wf-comple__lista {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wf-comple__producto {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .9rem .8rem 1rem;
  border: 1px solid var(--wf-comple-linea);
  border-radius: 16px;
  text-align: center;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.wf-comple__producto:hover {
  border-color: var(--wf-comple-rosa);
  box-shadow: 0 10px 24px rgba(120, 40, 70, .1);
}

.wf-comple__producto.esta-anadido {
  border-color: var(--wf-comple-rosa);
  background: rgba(231, 155, 180, .08);
}

.wf-comple__foto {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  background: var(--wf-bg-soft, #fdf4f7);
}

.wf-comple__foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wf-comple__nombre {
  margin: .5rem 0 0;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 500;
}

.wf-comple__precio {
  margin: 0;
  color: var(--wf-comple-rosa);
  font-weight: 600;
}

.wf-comple__precio .amount,
.wf-comple__precio bdi {
  color: inherit;
}

.wf-comple__opcion {
  width: 100%;
  max-width: 14rem;
  margin-top: .3rem;
  padding: .5rem 2rem .5rem .8rem;
  border: 1px solid var(--wf-comple-linea);
  border-radius: 999px;
  background-color: #fff;
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  /* Flecha propia: al quitar la del navegador hay que devolver alguna. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  background-size: 15px 15px;
}

.wf-comple__opcion:focus {
  outline: 0;
  border-color: var(--wf-comple-rosa);
}

.wf-comple__anadir {
  /* Pegado abajo: la tarjeta con selector es más alta que las demás y, sin
     esto, sus botones quedaban a distinta altura dentro de la misma fila. */
  margin-top: auto;
  padding: .6rem 1.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--wf-comple-rosa);
  color: #fff;
  font: inherit;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .2s ease;
}

.wf-comple__anadir:hover {
  opacity: .88;
}

.wf-comple__anadir:disabled {
  cursor: default;
}

.wf-comple__anadir.esta-cargando {
  opacity: .6;
}

.wf-comple__producto.esta-anadido .wf-comple__anadir {
  background: transparent;
  color: var(--wf-comple-rosa);
  border: 1px solid var(--wf-comple-rosa);
}

.wf-comple__producto.esta-anadido .wf-comple__anadir::before {
  content: "✓ ";
}

.wf-comple__aviso {
  margin: .35rem 0 0;
  font-size: .8rem;
  color: var(--wf-comple-rosa);
}

.wf-comple__aviso:empty {
  margin: 0;
}

.wf-comple__pie {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.4rem 1.4rem;
  border-top: 1px solid var(--wf-comple-linea);
  background: #fff;
}

.wf-comple__seguir {
  border: 0;
  background: none;
  padding: .6rem .4rem;
  font: inherit;
  font-size: .9rem;
  color: inherit;
  opacity: .7;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.wf-comple__seguir:hover {
  opacity: 1;
}

.wf-comple__pagar {
  padding: .85rem 2.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--wf-comple-rosa);
  color: #fff;
  font: inherit;
  font-size: .82rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
}

.wf-comple__pagar:hover {
  opacity: .9;
}

/* ------------------------------------------------------------------
   Pantallas medianas y teléfonos
   ------------------------------------------------------------------ */
@media (max-width: 860px) {
  .wf-comple__lista {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .wf-comple {
    padding: 0;
    align-items: flex-end;
  }

  /* En el teléfono ocupa la pantalla de abajo hacia arriba, como una hoja:
     así el pulgar llega a los botones sin estirarse. */
  .wf-comple__caja {
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }

  .wf-comple__cabecera {
    padding: 1.3rem 3rem .8rem;
  }

  .wf-comple__cuerpo {
    padding: .4rem 1rem 1rem;
  }

  .wf-comple__lista {
    gap: .7rem;
  }

  .wf-comple__producto {
    padding: .7rem .6rem .8rem;
  }

  .wf-comple__nombre {
    font-size: .92rem;
  }

  .wf-comple__precio {
    font-size: .95rem;
  }

  .wf-comple__anadir {
    width: 100%;
    padding: .6rem .6rem;
  }

  .wf-comple__pie {
    padding: .9rem 1rem 1.1rem;
    gap: .5rem;
  }

  .wf-comple__pagar {
    order: -1;
    width: 100%;
  }
}
