/*!
 * TuCanarias · Modal "añadir al carro" · ESCRITORIO
 * Todo va bajo .tc-qv para no chocar con el tema (Bootstrap 3 / marketwide).
 * Los colores se ajustan en las variables de abajo.
 */

.tc-qv {
    /* Ajustar al tema */
    --tc-qv-acento: #0b5f8a;          /* botón principal: poner el de .btn-primary del tema */
    --tc-qv-acento-hover: #094c6e;
    --tc-qv-texto: #222222;
    --tc-qv-texto-suave: #5f6368;
    --tc-qv-borde: #e2e2de;
    --tc-qv-fondo-imagen: #f5f5f2;
    --tc-qv-ok: #2e7d32;
    --tc-qv-no: #b3261e;
    --tc-qv-radio: 6px;

    position: fixed;
    inset: 0;
    top: 0; right: 0; bottom: 0; left: 0; /* navegadores sin inset */
    z-index: 2000;                         /* por encima del modal de Bootstrap (1050) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: inherit;
    color: var(--tc-qv-texto);
}

.tc-qv[hidden],
.tc-qv [hidden] {
    display: none !important;
}

html.tc-qv-abierto {
    overflow: hidden;
}

/* ---------- Fondo y diálogo ---------- */

.tc-qv__fondo {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(20, 24, 28, 0.55);
    opacity: 0;
    transition: opacity 160ms ease-out;
}

.tc-qv__dialogo {
    position: relative;
    width: 100%;
    max-width: 860px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: #ffffff;
    border-radius: var(--tc-qv-radio);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 160ms ease-out, transform 160ms ease-out;
}

.tc-qv__dialogo:focus {
    outline: none;
}

.tc-qv--visible .tc-qv__fondo {
    opacity: 1;
}

.tc-qv--visible .tc-qv__dialogo {
    opacity: 1;
    transform: none;
}

.tc-qv__cerrar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--tc-qv-texto-suave);
    cursor: pointer;
}

.tc-qv__cerrar:hover {
    background: var(--tc-qv-fondo-imagen);
    color: var(--tc-qv-texto);
}

/* ---------- Cuerpo: imagen | información ---------- */

.tc-qv__cuerpo {
    display: grid;
    grid-template-columns: 320px 1fr;
}

.tc-qv__imagen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: var(--tc-qv-fondo-imagen);
    border-radius: var(--tc-qv-radio) 0 0 var(--tc-qv-radio);
}

.tc-qv__imagen img {
    display: block;
    width: 100%;
    max-width: 256px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    mix-blend-mode: multiply; /* las fotos con fondo blanco se funden con el panel */
}

.tc-qv__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 36px 40px 32px 36px;
}

.tc-qv__titulo {
    margin: 0 28px 12px 0;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--tc-qv-texto);
}

/* ---------- Precio (HTML clonado de la tarjeta) ---------- */

.tc-qv__precio {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin-bottom: 10px;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--tc-qv-texto);
}

.tc-qv__precio .price-old {
    order: 2;
    font-size: 15px;
    font-weight: 400;
    color: var(--tc-qv-texto-suave);
    text-decoration: line-through;
}

/* El tema posiciona .saving en absoluto (esquina de la tarjeta) con tamaño fijo;
   dentro del modal se anula para que vaya en línea junto al precio. */
.tc-qv .tc-qv__precio .saving {
    order: 3;
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    float: none;
    display: inline-block;
    width: auto;
    height: auto;
    min-width: 0;
    margin: 0;
    transform: none;
    line-height: 1.4;
    padding: 2px 7px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    background: var(--tc-qv-no);
    border-radius: 3px;
}

/* ---------- Stock ---------- */

.tc-qv__stock {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 20px;
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--tc-qv-texto-suave);
}

.tc-qv__stock::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tc-qv-borde);
}

.tc-qv__stock[data-estado="si"] { color: var(--tc-qv-ok); }
.tc-qv__stock[data-estado="si"]::before { background: var(--tc-qv-ok); }
.tc-qv__stock[data-estado="no"] { color: var(--tc-qv-no); }
.tc-qv__stock[data-estado="no"]::before { background: var(--tc-qv-no); }
.tc-qv__stock[data-estado="error"]::before { display: none; }

/* ---------- Descripción breve ---------- */

.tc-qv__descripcion {
    max-height: 11.5em;
    overflow-y: auto;
    margin-bottom: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--tc-qv-borde);
    font-size: 14px;
    line-height: 1.6;
    color: #444444;
    overscroll-behavior: contain;
}

.tc-qv__descripcion:empty {
    display: none;
}

.tc-qv__descripcion p { margin: 0 0 0.6em; }
.tc-qv__descripcion ul,
.tc-qv__descripcion ol { margin: 0 0 0.6em; padding-left: 1.3em; }

.tc-qv__descripcion[aria-busy="true"] {
    display: block;
    min-height: 4.8em;
    background:
        linear-gradient(var(--tc-qv-fondo-imagen), var(--tc-qv-fondo-imagen)) 0 16px / 92% 0.9em no-repeat,
        linear-gradient(var(--tc-qv-fondo-imagen), var(--tc-qv-fondo-imagen)) 0 calc(16px + 1.6em) / 78% 0.9em no-repeat,
        linear-gradient(var(--tc-qv-fondo-imagen), var(--tc-qv-fondo-imagen)) 0 calc(16px + 3.2em) / 60% 0.9em no-repeat;
}

/* ---------- Compra: cantidad + botón ---------- */

.tc-qv__compra {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.tc-qv__cantidad {
    display: inline-flex;
    align-items: stretch;
    height: 46px;
    border: 1px solid var(--tc-qv-borde);
    border-radius: var(--tc-qv-radio);
    overflow: hidden;
}

.tc-qv__cantidad button {
    width: 40px;
    padding: 0;
    border: 0;
    background: #ffffff;
    font-size: 20px;
    line-height: 1;
    color: var(--tc-qv-texto);
    cursor: pointer;
}

.tc-qv__cantidad button:hover {
    background: var(--tc-qv-fondo-imagen);
}

.tc-qv__cantidad input {
    width: 48px;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--tc-qv-borde);
    border-right: 1px solid var(--tc-qv-borde);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: var(--tc-qv-texto);
    -moz-appearance: textfield;
    appearance: textfield;
}

.tc-qv__cantidad input::-webkit-outer-spin-button,
.tc-qv__cantidad input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tc-qv__anadir {
    flex: 1;
    height: 46px;
    padding: 0 24px;
    border: 0;
    border-radius: var(--tc-qv-radio);
    background: var(--tc-qv-acento);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 120ms ease-out;
}

.tc-qv__anadir:hover:not(:disabled) {
    background: var(--tc-qv-acento-hover);
}

.tc-qv__anadir:disabled {
    opacity: 0.55;
    cursor: default;
}

/* ---------- Resultado (añadido / errores / sin stock) ---------- */

.tc-qv__resultado {
    font-size: 14px;
    line-height: 1.5;
    color: var(--tc-qv-texto-suave);
}

.tc-qv__resultado:not(:empty) {
    margin-top: 14px;
}

.tc-qv__ok {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 600;
    color: var(--tc-qv-ok);
}

.tc-qv__ok::before {
    content: "";
    width: 18px;
    height: 18px;
    flex: none;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.tc-qv__acciones {
    display: flex;
    gap: 12px;
}

.tc-qv__ir-carrito,
.tc-qv__seguir {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 20px;
    border-radius: var(--tc-qv-radio);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.tc-qv__ir-carrito,
.tc-qv__ir-carrito:hover,
.tc-qv__ir-carrito:focus {
    background: var(--tc-qv-acento);
    color: #ffffff;
    text-decoration: none;
}

.tc-qv__ir-carrito:hover {
    background: var(--tc-qv-acento-hover);
}

.tc-qv__seguir {
    border: 1px solid var(--tc-qv-borde);
    background: #ffffff;
    color: var(--tc-qv-texto);
}

.tc-qv__seguir:hover {
    background: var(--tc-qv-fondo-imagen);
}

.tc-qv__ficha {
    align-self: flex-start;
    margin-top: 16px;
    font-size: 14px;
    color: var(--tc-qv-texto-suave);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tc-qv__ficha:hover {
    color: var(--tc-qv-texto);
}

/* ---------- Foco visible ---------- */

.tc-qv button:focus-visible,
.tc-qv a:focus-visible,
.tc-qv input:focus-visible {
    outline: 2px solid var(--tc-qv-acento);
    outline-offset: 2px;
}

/* ---------- Ventanas estrechas (la plantilla móvil tendrá su propio CSS) ---------- */

@media (max-width: 720px) {
    .tc-qv {
        padding: 12px;
    }
    .tc-qv__cuerpo {
        grid-template-columns: 1fr;
    }
    .tc-qv__imagen {
        padding: 20px;
        border-radius: var(--tc-qv-radio) var(--tc-qv-radio) 0 0;
    }
    .tc-qv__imagen img {
        max-width: 180px;
    }
    .tc-qv__info {
        padding: 24px 20px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tc-qv__fondo,
    .tc-qv__dialogo,
    .tc-qv__anadir {
        transition: none;
    }
}
