/* VISTA RÁPIDA GLOBAL DE PRODUCTOS RUBAN */

body.vista-rapida-abierta {
    overflow: hidden;
}

.vista-rapida[hidden],
.vista-rapida [hidden] {
    display: none !important;
}

.vista-rapida {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: grid;
    place-items: center;
    padding: 28px;
    font-family: Arial, Helvetica, sans-serif;
}

.vista-rapida__fondo {
    position: absolute;
    inset: 0;
    background: rgba(20, 17, 18, 0.68);
    backdrop-filter: blur(1.5px);
    opacity: 0;
    transition: opacity 220ms ease;
}

.vista-rapida__dialogo {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100vw - 56px));
    max-height: calc(100vh - 56px);
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
    opacity: 0;
    transform: translateY(18px) scale(0.975);
    transition: opacity 220ms ease, transform 220ms ease;
}

.vista-rapida.abierta .vista-rapida__fondo,
.vista-rapida.abierta .vista-rapida__dialogo {
    opacity: 1;
}

.vista-rapida.abierta .vista-rapida__dialogo {
    transform: translateY(0) scale(1);
}

.vista-rapida__cerrar {
    position: absolute;
    top: 15px;
    right: 17px;
    z-index: 5;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0 0 3px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: #5d5558;
    font: inherit;
    font-size: 31px;
    line-height: 1;
    cursor: pointer;
    transition: 180ms ease;
}

.vista-rapida__cerrar:hover {
    background: #fff0f6;
    color: #e71968;
    transform: rotate(5deg);
}

.vista-rapida__cerrar:focus-visible,
.vista-rapida button:focus-visible,
.vista-rapida a:focus-visible {
    outline: 3px solid rgba(231, 25, 104, 0.27);
    outline-offset: 3px;
}

.vista-rapida__cargando,
.vista-rapida__error {
    min-height: 460px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    padding: 48px;
    color: #665e61;
    text-align: center;
}

.vista-rapida__cargando p,
.vista-rapida__error p {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.vista-rapida__spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #f6dbe6;
    border-top-color: #e71968;
    border-radius: 50%;
    animation: vistaRapidaGirar 700ms linear infinite;
}

@keyframes vistaRapidaGirar {
    to { transform: rotate(360deg); }
}

.vista-rapida__error {
    color: #d91562;
}

.vista-rapida__error i {
    font-size: 36px;
}

.vista-rapida__contenido {
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(390px, 0.94fr);
    gap: 34px;
    padding: 32px;
}

.vista-rapida__imagen-panel {
    min-width: 0;
    height: 465px;
    min-height: 465px;
    display: grid;
    overflow: hidden;
    border: 2px solid #ffd83d;
    border-radius: 18px;
    background: #f4ebe4;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}


.vista-rapida__imagen,
.vista-rapida__sin-imagen {
    grid-area: 1 / 1;
    width: 100%;
    height: 100%;
    min-height: 465px;
    max-height: 465px;
    border-radius: 14px;
}

.vista-rapida__imagen {
    display: block;
    object-fit: cover;
}

.vista-rapida__sin-imagen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #756b6f;
    text-align: center;
}

.vista-rapida__sin-imagen span {
    font-size: 82px;
    line-height: 1;
}

.vista-rapida__sin-imagen small {
    font-size: 14px;
    font-weight: 700;
}

.vista-rapida__informacion {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 2px 2px;
}

.vista-rapida__informacion h2 {
    max-width: calc(100% - 48px);
    margin: 0 0 10px;
    color: #e71968;
    font-size: 30px;
    line-height: 1.13;
}

.vista-rapida__descripcion {
    margin: 0 0 13px;
    color: #625a5d;
    font-size: 15px;
    line-height: 1.5;
}

.vista-rapida__precios {
    min-height: 42px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px 12px;
    margin-bottom: 12px;
}

.vista-rapida__precio {
    margin: 0;
    color: #e71968;
    font-size: 29px;
    font-weight: 800;
}

.vista-rapida__precio-anterior {
    color: #858084;
    font-size: 14px;
    text-decoration: line-through;
}

.vista-rapida__descuento {
    padding: 6px 10px;
    border-radius: 999px;
    background: #e71968;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.vista-rapida__variantes h3 {
    margin: 0 0 13px;
    color: #302b2d;
    font-size: 17px;
}

.vista-rapida__grupo {
    margin-bottom: 14px;
}

.vista-rapida__etiqueta {
    display: block;
    margin-bottom: 8px;
    color: #373133;
    font-size: 14px;
    font-weight: 800;
}

.vista-rapida__opciones {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.vista-rapida__opcion-talla,
.vista-rapida__opcion-color {
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid #ddd6d9;
    border-radius: 12px;
    background: #fff;
    color: #332e30;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 160ms ease;
}

.vista-rapida__opcion-color {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px 6px 7px;
    border-radius: 999px;
}

.vista-rapida__muestra-color {
    position: relative;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 50%;
    background: var(--color-muestra, #f3a2c0);
}

.vista-rapida__opcion-talla:hover:not(:disabled),
.vista-rapida__opcion-color:hover:not(:disabled),
.vista-rapida__opcion-talla.seleccionada,
.vista-rapida__opcion-color.seleccionada {
    border-color: #e71968;
    background: #fff0f6;
    color: #e71968;
    transform: translateY(-1px);
}

.vista-rapida__opcion-talla.seleccionada,
.vista-rapida__opcion-color.seleccionada {
    box-shadow: 0 0 0 2px rgba(231, 25, 104, 0.1);
}

.vista-rapida__opcion-talla:disabled,
.vista-rapida__opcion-color:disabled {
    border-color: #e7e1e4;
    background: #f7f4f5;
    color: #aaa1a5;
    cursor: not-allowed;
    opacity: 0.62;
    transform: none;
}

.vista-rapida__opcion-talla:disabled {
    text-decoration: line-through;
}

.vista-rapida__opcion-color:disabled .vista-rapida__muestra-color {
    filter: grayscale(0.55);
}

.vista-rapida__opcion-color:disabled .vista-rapida__muestra-color::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 2px;
    width: 21px;
    height: 2px;
    border-radius: 999px;
    background: #81777b;
    transform: translateY(-50%) rotate(-45deg);
}

.vista-rapida__cantidad-stock {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-top: 5px;
    padding: 13px 14px;
    border: 1px solid #f0e3e9;
    border-radius: 14px;
    background: #fffafd;
}

.vista-rapida__cantidad {
    display: grid;
    grid-template-columns: 40px 52px 40px;
    overflow: hidden;
    border: 1px solid #e1d9dd;
    border-radius: 11px;
    background: #fff;
}

.vista-rapida__cantidad button,
.vista-rapida__cantidad input {
    min-width: 0;
    min-height: 40px;
    border: 0;
    background: transparent;
    color: #302b2d;
    font: inherit;
    font-weight: 800;
    text-align: center;
}

.vista-rapida__cantidad button {
    font-size: 19px;
    cursor: pointer;
}

.vista-rapida__cantidad button:hover:not(:disabled) {
    background: #fff0f6;
    color: #e71968;
}

.vista-rapida__cantidad button:disabled {
    color: #c9c2c5;
    cursor: not-allowed;
}

.vista-rapida__cantidad input {
    width: 52px;
    border-right: 1px solid #eee6ea;
    border-left: 1px solid #eee6ea;
    appearance: textfield;
    -moz-appearance: textfield;
}

.vista-rapida__cantidad input::-webkit-inner-spin-button,
.vista-rapida__cantidad input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

.vista-rapida__stock {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 40px;
    color: #967000;
    font-size: 13px;
    line-height: 1.3;
    text-align: right;
}

.vista-rapida__stock > span {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 50%;
    background: #e0b02f;
    box-shadow: 0 0 0 4px rgba(224, 176, 47, 0.12);
}

.vista-rapida__stock.disponible {
    color: #198c46;
}

.vista-rapida__stock.disponible > span {
    background: #1fa34f;
    box-shadow: 0 0 0 4px rgba(31, 163, 79, 0.12);
}

.vista-rapida__stock.no-disponible {
    color: #d91562;
}

.vista-rapida__stock.no-disponible > span {
    background: #e71968;
}

.vista-rapida__aviso {
    display: none;
    margin: 10px 0 0;
    padding: 11px 13px;
    border-radius: 11px;
    background: #fff0f6;
    color: #d91562;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.vista-rapida__aviso:not(:empty) {
    display: block;
}

.vista-rapida__detalles {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 15px;
    color: #e71968;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.vista-rapida__detalles:hover {
    color: #b81250;
    text-decoration: underline;
}

.vista-rapida__acciones {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) 52px;
    gap: 10px;
    margin-top: 16px;
    padding-top: 0;
}

.vista-rapida__agregar,
.vista-rapida__comprar,
.vista-rapida__favorito {
    min-height: 52px;
    border-radius: 13px;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: 180ms ease;
}

.vista-rapida__agregar,
.vista-rapida__comprar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 15px;
}

.vista-rapida__agregar {
    border: 1px solid #e71968;
    background: #e71968;
    color: #fff;
    box-shadow: 0 6px 15px rgba(231, 25, 104, 0.21);
}

.vista-rapida__agregar:hover:not(:disabled) {
    border-color: #c91458;
    background: #c91458;
    transform: translateY(-2px);
}

.vista-rapida__comprar {
    border: 1px solid #ffd83d;
    background: #fff8df;
    color: #765900;
}

.vista-rapida__comprar:hover:not(:disabled) {
    border-color: #efc500;
    background: #ffd83d;
    color: #3d3200;
    transform: translateY(-2px);
}

.vista-rapida__agregar:disabled,
.vista-rapida__comprar:disabled {
    border-color: #e8dfe3;
    background: #e8dfe3;
    color: #a99fa4;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.vista-rapida__favorito {
    width: 52px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid #eee4e8;
    border-radius: 50%;
    background: #fff;
    color: #e71968;
    font-size: 20px;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.1);
}

.vista-rapida__favorito:hover,
.vista-rapida__favorito.es-favorito {
    border-color: #f3a2c0;
    background: #fff0f6;
    transform: translateY(-2px);
}

.vista-rapida__resultado {
    display: none;
    margin-top: 12px;
    padding: 11px 13px;
    border-radius: 11px;
    background: #eefaf2;
    color: #198c46;
    font-size: 13px;
    font-weight: 700;
}

.vista-rapida__resultado.mostrar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.vista-rapida__resultado-texto {
    min-width: 0;
}

.vista-rapida__ver-carrito {
    flex: 0 0 auto;
    padding: 7px 11px;
    border: 1px solid #9bd7ae;
    border-radius: 8px;
    background: #fff;
    color: #14763a;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    transition: 180ms ease;
}

.vista-rapida__ver-carrito:hover,
.vista-rapida__ver-carrito:focus-visible {
    border-color: #198c46;
    background: #198c46;
    color: #fff;
    outline: none;
}

.vista-rapida__resultado.error {
    background: #fff0f6;
    color: #d91562;
}

@media (max-width: 900px) {
    .vista-rapida { padding: 18px; }

    .vista-rapida__dialogo {
        width: min(760px, calc(100vw - 36px));
        max-height: calc(100vh - 36px);
    }

    .vista-rapida__contenido {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 24px;
    }

    .vista-rapida__imagen-panel,
    .vista-rapida__imagen,
    .vista-rapida__sin-imagen {
        min-height: 390px;
        max-height: 500px;
    }
}

@media (max-width: 600px) {
    .vista-rapida {
        align-items: flex-end;
        padding: 0;
    }

    .vista-rapida__dialogo {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: auto;
        max-height: 94vh;
        max-height: 94dvh;
        overflow: hidden;
        border-radius: 22px 22px 0 0;
    }

    .vista-rapida__contenido {
        display: flex;
        flex: 0 1 auto;
        flex-direction: column;
        gap: 12px;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 12px 14px 0;
    }

    .vista-rapida__imagen-panel {
        flex: 0 0 auto;
        width: 100%;
        height: clamp(220px, 36dvh, 280px);
        min-height: 220px;
        max-height: 280px;
        border-radius: 14px;
    }

    .vista-rapida__imagen,
    .vista-rapida__sin-imagen {
        width: 100%;
        height: 100%;
        min-height: 0;
        max-height: none;
        border-radius: 12px;
    }

    .vista-rapida__informacion {
        display: flex;
        flex: 0 0 auto;
        flex-direction: column;
        gap: 8px;
        min-width: 0;
        padding-bottom: 0;
    }

    .vista-rapida__informacion h2 {
        max-width: calc(100% - 42px);
        margin: 0;
        font-size: 21px;
        line-height: 1.2;
    }

    .vista-rapida__descripcion {
        margin: 0;
        font-size: 12px;
        line-height: 1.4;
    }

    .vista-rapida__precios {
        min-height: 0;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 9px;
        margin: 0;
    }

    .vista-rapida__precio {
        font-size: 22px;
    }

    .vista-rapida__precio-anterior {
        font-size: 12px;
    }

    .vista-rapida__descuento {
        padding: 4px 8px;
        font-size: 11px;
    }

    .vista-rapida__variantes h3 {
        margin: 0 0 7px;
        font-size: 15px;
    }

    .vista-rapida__grupo {
        margin-bottom: 8px;
    }

    .vista-rapida__etiqueta {
        margin-bottom: 4px;
        font-size: 12px;
    }

    .vista-rapida__opciones {
        gap: 7px;
    }

    .vista-rapida__opcion-talla,
    .vista-rapida__opcion-color {
        min-height: 34px;
        padding: 6px 11px;
        font-size: 12px;
    }

    .vista-rapida__cantidad-stock {
        align-items: center;
        flex-direction: row;
        gap: 10px;
    }

    .vista-rapida__stock {
        justify-content: flex-start;
        text-align: left;
        font-size: 12px;
    }

    .vista-rapida__detalles-fila {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .vista-rapida__detalles {
        align-self: flex-start;
        margin-top: 1px;
        font-size: 12px;
    }

    .vista-rapida__resultado {
        order: 1;
        margin: 0;
        padding: 9px 11px;
        font-size: 12px;
    }

    .vista-rapida__acciones {
        position: sticky;
        bottom: 0;
        z-index: 4;
        order: 2;
        flex: 0 0 auto;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        margin: 0;
        padding: 9px 0 12px;
        background: linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.92),
            #fff 14px
        );
    }

    .vista-rapida__agregar,
    .vista-rapida__comprar {
        min-height: 52px;
        border-radius: 11px;
        font-size: 14px;
    }

    .vista-rapida__favorito {
        width: 44px;
        min-height: 44px;
        border: 0;
        border-radius: 50%;
        background: transparent;
        color: #222;
        font-size: 25px;
        box-shadow: none;
    }

    .vista-rapida__favorito:hover,
    .vista-rapida__favorito.es-favorito {
        border-color: transparent;
        background: transparent;
        color: #e71968;
        transform: none;
        box-shadow: none;
    }

    .vista-rapida__comprar {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vista-rapida__fondo,
    .vista-rapida__dialogo,
    .vista-rapida button {
        transition: none;
    }
}

/* Mantener visible el aviso de favoritos sobre la vista rápida. */
.aviso-favorito-global.en-vista-rapida {
    top: 14px;
    z-index: 30010;
}

@media (max-width: 600px) {
    .aviso-favorito-global.en-vista-rapida {
        top: calc(env(safe-area-inset-top, 0px) + 8px);
        gap: 7px;
        padding: 9px 12px;
        font-size: 12px;
    }
}
