/*
 * Variantes y galería de productos - INSUMOS PRO PTY
 * Este archivo complementa estilos.css y puede mantenerse de forma independiente.
 */

/* Evita que cualquier imagen de producto se salga de su contenedor. */
.product-card img,
.product-image img,
.item-icon img,
.detail-image img,
.product-thumbnail img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* La imagen principal mantiene un área estable aun con fotografías muy grandes. */
.product-gallery {
    min-width: 0;
}

.detail-image {
    overflow: hidden;
    min-height: 420px;
    max-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.detail-image img {
    max-height: 470px;
}

/* Miniaturas de imágenes adicionales. */
.product-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.product-thumbnail {
    height: 78px;
    padding: 6px;
    border: 1px solid #dce3ec;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.product-thumbnail:hover,
.product-thumbnail.active {
    border-color: var(--primary, #168bd2);
    box-shadow: 0 0 0 2px rgba(22, 139, 210, .12);
}

/* Selector de color. */
.product-variants {
    margin: 20px 0;
}

.product-variants label {
    display: block;
    margin-bottom: 7px;
}

.product-variants select {
    max-width: 340px;
}

.variant-help {
    display: block;
    margin-top: 6px;
    color: #6c757d;
}

/* Color seleccionado visible en carrito y cotización. */
.selected-variant {
    display: block;
    margin-top: 3px;
    color: #526273;
}

/* En pantallas pequeñas reducimos la altura para aprovechar el espacio. */
@media (max-width: 767.98px) {
    .detail-image {
        min-height: 300px;
        max-height: 380px;
        padding: 16px;
    }

    .detail-image img {
        max-height: 340px;
    }
}


/* ==========================================================================
   V15 - Selector visual de colores del producto
   ========================================================================== */
.variant-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.selected-color-label {
    font-size: .88rem;
    color: #64748b;
}

.variant-native-select {
    position: absolute !important;
    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;
}

.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.color-option {
    min-width: 105px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 7px 11px;
    border: 1px solid #d8e1eb;
    border-radius: 10px;
    background: #fff;
    color: #24364b;
    cursor: pointer;
    font: inherit;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.color-option:hover {
    border-color: var(--primary, #168bd2);
    transform: translateY(-1px);
}

.color-option.active {
    border-color: var(--primary, #168bd2);
    box-shadow: 0 0 0 3px rgba(22, 139, 210, .13);
}

.color-option img,
.color-swatch {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 7px;
    border: 1px solid #dbe3ec;
    background: #fff;
}

.color-option img {
    object-fit: contain;
}

.color-swatch {
    display: inline-block;
    background: var(--swatch-color);
}

.color-swatch-generic {
    background: linear-gradient(135deg, #0d6efd 0 50%, #15c6d9 50% 100%);
}

@media (max-width: 575.98px) {
    .variant-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .color-option {
        flex: 1 1 calc(50% - 10px);
    }
}
