/**
 * Sélecteur de variations en grille d'images — Frontend
 */

.nf-vargrid-wrap {
    margin: 16px 0;
}

.nf-vargrid-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.nf-vargrid-label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nf-vargrid-count {
    font-size: 12px;
    color: #777;
}

.nf-vargrid-scroller-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.nf-vargrid-scroller {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: smooth;
    padding: 7px 2px;
    flex: 1;
}

.nf-vargrid-scroller::-webkit-scrollbar {
    display: none;
}

.nf-vargrid-item {
    position: relative;
    flex: 0 0 88px;
    scroll-snap-align: start;
    cursor: pointer;
    text-align: center;
    user-select: none;
}

.nf-vargrid-img {
    width: 88px;
    height: 88px;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    background: #f5f5f5 center/cover no-repeat;
    transition: border-color 0.2s;
}

.nf-vargrid-item:hover .nf-vargrid-img {
    border-color: #1a472a;
}

.nf-vargrid-item-active .nf-vargrid-img {
    border-color: #1a472a;
    border-width: 3px;
}

.nf-vargrid-name {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 500;
    color: #333;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(2 * 1.3em);
}

.nf-vargrid-item-active .nf-vargrid-name {
    color: #1a472a;
    font-weight: 700;
}

.nf-vargrid-badge {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1;
    z-index: 2;
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Flèches navigation desktop */
.nf-vargrid-arrow {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
    flex-shrink: 0;
}

.nf-vargrid-arrow:hover {
    border-color: #1a472a;
    color: #1a472a;
}

.nf-vargrid-arrow.nf-vargrid-arrow-prev {
    margin-right: 6px;
}

.nf-vargrid-arrow.nf-vargrid-arrow-next {
    margin-left: 6px;
}

.nf-vargrid-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.nf-vargrid-arrow:disabled:hover {
    border-color: #ddd;
    color: #555;
}

/* Affichage des flèches uniquement sur desktop quand overflow */
@media (min-width: 769px) {
    .nf-vargrid-scroller-wrap.has-overflow .nf-vargrid-arrow {
        display: flex;
    }
}

/* Mobile : items légèrement plus petits */
@media (max-width: 600px) {
    .nf-vargrid-item {
        flex: 0 0 76px;
    }
    .nf-vargrid-img {
        width: 76px;
        height: 76px;
    }
    .nf-vargrid-name {
        font-size: 11px;
    }
}
