/* DS Coloris produits - front
 * front.js répartit les éléments :
 *  - .ds-pc-second-image -> dans .product-image (overlay sur la photo)
 *  - .ds-pc-colors        -> dans .product-meta  (overlay sur la zone SOUS la photo)
 */
.product-miniature .product-image {
    position: relative;
}

.product-miniature .product-meta {
    position: relative;
}

/* --- 2e image au survol (sur la photo) ------------------------------ */
.ds-pc-second-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff; /* masque l'image de couverture derrière */
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease;
    pointer-events: none;
    z-index: 1;
}

.product-miniature .thumbnail-container:hover .ds-pc-second-image {
    opacity: 1;
    visibility: visible;
}

/* Les flags (position:absolute z-index:1 dans le thème) doivent rester
   visibles par-dessus l'image secondaire. */
.product-miniature .product-flags {
    z-index: 5;
}

/* --- Bloc « autres coloris » (sur la zone sous la photo) ------------ */
.ds-pc-colors {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.97);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.product-miniature .thumbnail-container:hover .ds-pc-colors {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ds-pc-colors-title {
    display: block;
    margin-bottom: 6px;
    padding: 3px 0;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background: #1d6fb8;
    border-radius: 2px;
}

.ds-pc-colors-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.ds-pc-color {
    display: block;
    width: 44px;
    height: 44px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s ease;
}

.ds-pc-color:hover {
    border-color: #1d6fb8;
}

.ds-pc-color img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Conteneur technique : ne doit pas occuper d'espace en flux */
.ds-pc-overlay {
    display: none;
}

/* Sur tactile, pas de survol : on n'affiche pas les overlays */
@media (hover: none) {
    .ds-pc-second-image,
    .ds-pc-colors {
        display: none;
    }
}

/* =====================================================================
   Bloc « X coloris disponibles » sur la fiche produit (displayFooterProduct)
   ===================================================================== */
.ds-pc-product-colors {
    margin: 30px 0;
    padding: 25px 0;
    text-align: left;
}

/* Même style que le titre « Taille » de la fiche produit (.control-label). */
.ds-pc-product-colors-title {
    margin: 0 0 10px;
    font-size: 16px;
    line-height: 24px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: left;
}

/* Nombre de coloris par ligne et espacement, pilotables via variables CSS */
.ds-pc-product-colors-list {
    --ds-pc-per-row: 5;
    --ds-pc-gap: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: var(--ds-pc-gap);
}

.ds-pc-product-color {
    display: block;
    /* Largeur = part égale de la ligne, en retirant les gouttières,
       plafonnée par --ds-pc-max afin de ne pas devenir trop grande. */
    --ds-pc-max: 130px;
    flex: 0 1 calc((100% - (var(--ds-pc-per-row) - 1) * var(--ds-pc-gap)) / var(--ds-pc-per-row));
    width: calc((100% - (var(--ds-pc-per-row) - 1) * var(--ds-pc-gap)) / var(--ds-pc-per-row));
    max-width: var(--ds-pc-max);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.ds-pc-product-color:hover {
    transform: translateY(-3px);
}

.ds-pc-product-color img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.ds-pc-product-color-name {
    display: block;
    padding: 10px;
    font-size: 13px;
    color: #555;
}

/* Tablette : 4 par ligne */
@media (max-width: 991px) {
    .ds-pc-product-colors-list {
        --ds-pc-per-row: 4;
    }
}

/* Mobile : 3 par ligne */
@media (max-width: 575px) {
    .ds-pc-product-colors-list {
        --ds-pc-per-row: 3;
        --ds-pc-gap: 10px;
    }

    .ds-pc-product-colors-title {
        font-size: 17px;
    }
}
