/* NS Woo Toolkit — Variation Swatches */

.ns-swatches-wrapper {
    margin: 0 0 12px;
}

.ns-swatch-selected-label {
    display: block;
    font-size: 0.85em;
    color: #777;
    margin-bottom: 4px;
    min-height: 1em;
}

.ns-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* ---- Individual swatch ---- */
.ns-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid transparent;
    outline: 1px solid #d0d0d0;
    transition: outline-color 0.15s, border-color 0.15s, transform 0.1s;
    overflow: hidden;
    box-sizing: border-box;
    user-select: none;
    position: relative;
}

.ns-swatch:hover {
    outline-color: #999;
    transform: scale(1.06);
}

.ns-swatch--selected {
    border-color: #333;
    outline-color: #333;
}

.ns-swatch--disabled,
.ns-swatch--unavailable {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Diagonal strike-through for out-of-stock colour swatches */
.ns-swatch--color.ns-swatch--unavailable::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top right, transparent calc(50% - 1px), #c00 calc(50% - 1px), #c00 calc(50% + 1px), transparent calc(50% + 1px));
}

/* ---- Shape variants ---- */
.ns-swatches--rounded .ns-swatch,
.ns-swatches--rounded .ns-swatch img {
    border-radius: 4px;
}
.ns-swatches--circle .ns-swatch,
.ns-swatches--circle .ns-swatch img {
    border-radius: 50%;
}
.ns-swatches--square .ns-swatch,
.ns-swatches--square .ns-swatch img {
    border-radius: 0;
}

/* ---- Size variants ---- */
.ns-swatches--small  .ns-swatch { width: 28px; height: 28px; }
.ns-swatches--medium .ns-swatch { width: 36px; height: 36px; }
.ns-swatches--large  .ns-swatch { width: 44px; height: 44px; }

/* ---- Swatch types ---- */
.ns-swatch--color  { /* background set inline */ }
.ns-swatch--image img {
    width:  100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.ns-swatch--button {
    width: auto !important;
    height: auto !important;
    padding: 4px 10px;
    font-size: 0.8em;
    white-space: nowrap;
    background: #fff;
}
.ns-swatch--button .ns-swatch-label {
    line-height: 1.4;
}
.ns-swatches--small  .ns-swatch--button { padding: 2px 8px; }
.ns-swatches--large  .ns-swatch--button { padding: 6px 14px; font-size: 0.9em; }

/* Porto theme compatibility: ensure swatches sit flush below label */
.variations .label + td .ns-swatches-wrapper {
    padding-top: 4px;
}
