/* =============================================================
   Nexus – Frontend Swatches CSS  v1.1
   ============================================================= */

/* Container */
.nexus-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
    align-items: center;
}

/* ---------------------------------------------------------------
   Base swatch
   ------------------------------------------------------------- */
.nexus-swatch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    box-sizing: border-box;
    outline: 3px solid transparent;
    outline-offset: 2px;

    /* Smooth transitions */
    transition:
        border-color   0.18s ease,
        outline-color  0.18s ease,
        transform      0.15s ease,
        box-shadow     0.18s ease,
        opacity        0.2s ease;
}

/* Hover */
.nexus-swatch:hover {
    border-color: #555;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

/* Selected */
.nexus-swatch.selected {
    border-color: #111;
    box-shadow: 0 0 0 2px #111;
    transform: scale(1.05);
}

/* Focus-visible (keyboard) */
.nexus-swatch:focus-visible,
.nexus-swatch.nexus-focus {
    outline-color: #005fcc;
    outline-style: solid;
    border-color: #005fcc;
}

/* ---------------------------------------------------------------
   Colour swatch
   ------------------------------------------------------------- */
.nexus-swatch__color {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    transition: transform 0.15s ease;
}

/* ---------------------------------------------------------------
   Image swatch
   ------------------------------------------------------------- */
.nexus-swatch img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.15s ease;
}

/* ---------------------------------------------------------------
   Label / Button swatch
   ------------------------------------------------------------- */
.nexus-swatches[data-type="label"] .nexus-swatch {
    width: auto !important;
    height: auto !important;
    border-radius: 4px;
    border: 1.5px solid #ccc;
    background: #fff;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.02em;
    transform: none;
    overflow: visible;
}

.nexus-swatches[data-type="label"] .nexus-swatch:hover {
    border-color: #333;
    background: #f5f5f5;
    transform: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

.nexus-swatches[data-type="label"] .nexus-swatch.selected {
    border-color: #111;
    background: #111;
    color: #fff;
    box-shadow: none;
    transform: none;
}

.nexus-swatch__label {
    pointer-events: none;
    white-space: nowrap;
}

/* ---------------------------------------------------------------
   Tooltip
   ------------------------------------------------------------- */
.nexus-swatches[data-tooltip="1"] .nexus-swatch::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(17, 17, 17, 0.88);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 9px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 200;
}

.nexus-swatches[data-tooltip="1"] .nexus-swatch:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------------------------------------------------------------
   Disabled states
   ------------------------------------------------------------- */

/* blur / fade */
body.nexus-disabled-blur .nexus-swatch.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

/* strikethrough */
body.nexus-disabled-strikethrough .nexus-swatch.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

body.nexus-disabled-strikethrough .nexus-swatch.disabled::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -8%;
    width: 116%;
    height: 2px;
    background: rgba(190, 0, 0, 0.7);
    transform: rotate(-45deg);
    z-index: 10;
}

/* hide */
body.nexus-disabled-hide .nexus-swatch.disabled {
    display: none !important;
}

/* ---------------------------------------------------------------
   Stock badge
   ------------------------------------------------------------- */
.nexus-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
    padding: 4px 11px;
    border-radius: 20px;
    margin-top: 10px;
    animation: nexusFadeIn 0.2s ease;
}

@keyframes nexusFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nexus-stock-badge::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nexus-stock-badge.in-stock    { background: #e9f5ee; color: #2d7a4c; }
.nexus-stock-badge.in-stock::before    { background: #2d7a4c; }

.nexus-stock-badge.low-stock   { background: #fff4e6; color: #c07030; }
.nexus-stock-badge.low-stock::before   { background: #c07030; }

.nexus-stock-badge.out-of-stock { background: #fdecea; color: #c0392b; }
.nexus-stock-badge.out-of-stock::before { background: #c0392b; }

/* =============================================================
   Phase 1 additions
   ============================================================= */

/* 1.2 — Gallery image transition */
.woocommerce-product-gallery__image {
    transition: opacity 0.2s ease;
}

.nexus-gallery-transitioning {
    opacity: 0.7;
}

/* 1.3 — Out-of-stock overlay badge on swatch */
.nexus-oos-overlay {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Diagonal strikethrough line */
.nexus-oos-overlay::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -5%;
    width: 110%;
    height: 2px;
    background: rgba(180, 0, 0, 0.65);
    transform: rotate(-45deg);
}

/* Blur style: no line, just opacity (already handled by .disabled) */
body.nexus-disabled-blur .nexus-oos-overlay::after {
    display: none;
}

/* Archive shop OOS badge overlay on card */
.nexus-oos-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
    animation: nexusFadeIn 0.2s ease;
}

/* Archive loading state */
.product.nexus-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* =============================================================
   Phase 3 — Dual colour swatch
   ============================================================= */
.nexus-swatch__dual {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

/* Dual swatch container must not clip gradient incorrectly */
.nexus-swatches[data-type="dual"] .nexus-swatch {
    overflow: hidden;
}
