/* =============================================================
   Nexus – Frontend Swatches CSS
   ============================================================= */

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

/* Base swatch */
.nexus-swatch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;          /* overridden via JS from settings */
    height: 36px;
    border-radius: 50%;   /* overridden via JS from settings */
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.nexus-swatch:hover {
    border-color: #555;
    transform: scale(1.08);
}

/* Selected state */
.nexus-swatch.selected {
    border-color: #111;
    box-shadow: 0 0 0 2px #111;
}

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

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

/* ---------------------------------------------------------------
   Label / Button swatch  (overrides size to auto)
   ------------------------------------------------------------- */
.nexus-swatches[data-type="label"] .nexus-swatch {
    width: auto !important;
    height: auto !important;
    border-radius: 4px;
    border: 1.5px solid #ccc;
    background: #fff;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.02em;
}

.nexus-swatches[data-type="label"] .nexus-swatch:hover {
    border-color: #333;
    background: #f5f5f5;
}

.nexus-swatches[data-type="label"] .nexus-swatch.selected {
    border-color: #111;
    background: #111;
    color: #fff;
    box-shadow: 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% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 200;
}

.nexus-swatches[data-tooltip="1"] .nexus-swatch:hover::after {
    opacity: 1;
}

/* ---------------------------------------------------------------
   Disabled / Out-of-stock states
   ------------------------------------------------------------- */

/* Style: blur (default) */
body.nexus-disabled-blur .nexus-swatch.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Style: strikethrough */
body.nexus-disabled-strikethrough .nexus-swatch.disabled {
    opacity: 0.5;
    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(180, 0, 0, 0.75);
    transform: rotate(-45deg);
    z-index: 10;
}

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

/* ---------------------------------------------------------------
   Stock badge
   ------------------------------------------------------------- */
.nexus-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.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; }
