/**
 * Shared Components — 3D Nexus Creations
 *
 * Reusable UI components that can be used across any page.
 * All values reference design tokens (--nx-*) from design-tokens.css.
 *
 * @package Nexus_Theme
 */


/* ══════════════════════════════════════════════════════════════
   A) BUTTONS
   ══════════════════════════════════════════════════════════════ */

.nx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nx-space-xs);
    font-family: var(--nx-font-heading);
    font-weight: var(--nx-weight-bold);
    font-size: var(--nx-text-base);
    padding: 12px 32px;
    border: none;
    border-radius: var(--nx-radius-pill);
    cursor: pointer;
    transition: transform var(--nx-ease-base), box-shadow var(--nx-ease-base), background var(--nx-ease-base), color var(--nx-ease-base), border-color var(--nx-ease-base);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}
.nx-btn:focus-visible {
    outline: 2px solid var(--nx-border-focus);
    outline-offset: 2px;
}

/* Primary — CTA gradient */
.nx-btn--primary {
    background: var(--nx-gradient-cta);
    color: var(--nx-text-on-cta);
    box-shadow: var(--nx-shadow-cta);
}
.nx-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--nx-shadow-cta-hover);
    color: var(--nx-text-on-cta);
}
.nx-btn--primary:active { transform: translateY(0); }

/* Secondary — Outline */
.nx-btn--secondary {
    background: transparent;
    color: var(--nx-color-primary);
    border: 2px solid var(--nx-border);
}
.nx-btn--secondary:hover {
    border-color: var(--nx-color-primary);
    background: var(--nx-color-primary);
    color: var(--nx-text-on-dark);
}

/* Ghost — For dark backgrounds */
.nx-btn--ghost {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
}
.nx-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

/* Sizes */
.nx-btn--sm { padding: 10px 20px; font-size: var(--nx-text-sm); }
.nx-btn--lg { padding: 18px 42px; font-size: 1.05rem; }

/* Full width */
.nx-btn--full { width: 100%; }

/* Disabled */
.nx-btn:disabled,
.nx-btn--disabled {
    opacity: 0.5;
    pointer-events: none;
}


/* ══════════════════════════════════════════════════════════════
   B) FORM CONTROLS
   ══════════════════════════════════════════════════════════════ */

.nx-field {
    margin-bottom: var(--nx-space-md);
}

.nx-field__label {
    display: block;
    font-family: var(--nx-font-heading);
    font-weight: var(--nx-weight-semibold);
    font-size: var(--nx-text-sm);
    color: var(--nx-text);
    margin-bottom: 8px;
}
.nx-field__label .required {
    color: var(--nx-status-error);
    text-decoration: none;
    border: none;
}

.nx-field__input,
.nx-field select,
.nx-field textarea {
    width: 100%;
    font-family: var(--nx-font-body);
    font-size: var(--nx-text-base);
    color: var(--nx-text);
    padding: 12px 16px;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-sm);
    background: var(--nx-surface-muted);
    transition: border-color var(--nx-ease-fast), box-shadow var(--nx-ease-fast);
    outline: none;
    box-sizing: border-box;
    -webkit-appearance: none;
}
.nx-field__input:focus,
.nx-field select:focus,
.nx-field textarea:focus {
    border-color: var(--nx-border-focus);
    box-shadow: var(--nx-focus-ring);
}
.nx-field__input:focus-visible,
.nx-field select:focus-visible,
.nx-field textarea:focus-visible {
    outline: 2px solid var(--nx-border-focus);
    outline-offset: 2px;
}
.nx-field textarea {
    resize: vertical;
    min-height: 90px;
}

/* Error state */
.nx-field--error .nx-field__input,
.nx-field--error select {
    border-color: var(--nx-status-error);
    box-shadow: var(--nx-focus-ring-error);
}
.nx-field__error-text {
    font-size: var(--nx-text-xs);
    color: var(--nx-status-error);
    margin-top: 4px;
}

/* Checkbox */
.nx-field--checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: var(--nx-font-body);
    font-size: var(--nx-text-base);
    color: var(--nx-text);
    margin-bottom: var(--nx-space-sm);
}
.nx-field--checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--nx-color-primary);
    border-radius: 4px;
    flex-shrink: 0;
}

/* Inline pair (first name / last name) */
.nx-field-row {
    display: flex;
    gap: var(--nx-space-md);
}
.nx-field-row > .nx-field { flex: 1; }
@media (max-width: 500px) {
    .nx-field-row { flex-direction: column; gap: 0; }
}


/* ══════════════════════════════════════════════════════════════
   C) CARDS
   ══════════════════════════════════════════════════════════════ */

.nx-card {
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-md);
    padding: var(--nx-space-lg) var(--nx-space-lg);
    box-shadow: var(--nx-shadow-sm);
}
.nx-card--soft {
    background: var(--nx-surface-muted);
    border-color: transparent;
}
.nx-card--sticky {
    position: sticky;
    top: 100px;
}

.nx-card__title {
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-lg);
    font-weight: var(--nx-weight-bold);
    color: var(--nx-text);
    margin: 0 0 var(--nx-space-lg);
    padding-bottom: var(--nx-space-md);
    border-bottom: 1px solid var(--nx-border);
}
.nx-card__title--center { text-align: center; }


/* ══════════════════════════════════════════════════════════════
   D) PILLS / CHIPS
   ══════════════════════════════════════════════════════════════ */

.nx-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-xs);
    font-weight: var(--nx-weight-semibold);
    color: var(--nx-text-muted);
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-pill);
    cursor: pointer;
    transition: border-color var(--nx-ease-fast), color var(--nx-ease-fast), background var(--nx-ease-fast);
    white-space: nowrap;
}
.nx-pill:hover {
    border-color: var(--nx-color-primary-light);
    color: var(--nx-color-primary);
}

.nx-pill--active {
    background: var(--nx-color-primary);
    color: var(--nx-text-on-dark);
    border-color: var(--nx-color-primary);
}
.nx-pill--active:hover {
    color: var(--nx-text-on-dark);
}

.nx-pill--muted {
    background: var(--nx-surface-muted);
    border-color: transparent;
    cursor: default;
}


/* ══════════════════════════════════════════════════════════════
   E) TRUST BADGES
   ══════════════════════════════════════════════════════════════ */

.nx-trust-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--nx-space-sm);
    flex-wrap: wrap;
    font-family: var(--nx-font-body);
    font-size: var(--nx-text-sm);
    font-weight: var(--nx-weight-medium);
    color: var(--nx-text-muted);
}
.nx-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.nx-trust-badge__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}
/* Compact modifier — no separators, smaller text, tighter gaps (for narrow containers) */
.nx-trust-group--compact {
    gap: var(--nx-space-xs) var(--nx-space-sm);
    font-size: var(--nx-text-xs);
    justify-content: center;
}
.nx-trust-group--compact .nx-trust-badge {
    gap: 4px;
}
.nx-trust-group--compact .nx-trust-badge__icon {
    width: 13px;
    height: 13px;
}
.nx-trust-sep {
    color: var(--nx-border);
    font-size: 0.6rem;
}


/* ══════════════════════════════════════════════════════════════
   F) STAR RATINGS
   ══════════════════════════════════════════════════════════════ */

.nx-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.nx-stars__star {
    color: var(--nx-color-star);
    font-size: 1.1rem;
    line-height: 1;
}
.nx-stars__star--empty {
    opacity: 0.25;
}
/* Size: small */
.nx-stars--sm .nx-stars__star {
    font-size: 0.85rem;
}
/* Size: large */
.nx-stars--lg .nx-stars__star {
    font-size: 1.5rem;
}

/* ══════════════════════════════════════════════════════════════
   G) SECTION HEADINGS
   ══════════════════════════════════════════════════════════════ */

.nx-section-heading {
    text-align: center;
    margin-bottom: var(--nx-space-2xl);
}
.nx-section-heading__title {
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-3xl);
    font-weight: var(--nx-weight-extrabold);
    color: var(--nx-text);
    margin: 0 0 var(--nx-space-xs);
}
.nx-section-heading__subtitle {
    font-family: var(--nx-font-body);
    font-size: var(--nx-text-md);
    color: var(--nx-text-muted);
    margin: 0;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}
/* Left-aligned variant */
.nx-section-heading--left { text-align: left; }
.nx-section-heading--left .nx-section-heading__subtitle {
    margin-left: 0;
    margin-right: 0;
}


/* ══════════════════════════════════════════════════════════════
   G) QUANTITY STEPPER
   ══════════════════════════════════════════════════════════════ */

.nx-qty {
    display: inline-flex;
    align-items: center;
    border: 2px solid var(--nx-border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--nx-surface);
}
.nx-qty__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: var(--nx-weight-bold);
    color: var(--nx-text);
    cursor: pointer;
    transition: background var(--nx-ease-fast);
    line-height: 1;
    padding: 0;
}
.nx-qty__btn:hover {
    background: var(--nx-surface-hover);
}
.nx-qty__input {
    width: 36px;
    text-align: center;
    border: none;
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-base);
    font-weight: var(--nx-weight-bold);
    color: var(--nx-text);
    background: transparent;
    padding: 4px 0;
    outline: none;
    -moz-appearance: textfield;
}
.nx-qty__input:focus-visible {
    outline: 2px solid var(--nx-border-focus);
    outline-offset: 2px;
}
.nx-qty__input::-webkit-outer-spin-button,
.nx-qty__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
@media (max-width: 768px) {
    .nx-qty__btn { width: 44px; height: 44px; font-size: 1.3rem; }
    .nx-qty__input { width: 40px; font-size: var(--nx-text-lg); }
}


/* ══════════════════════════════════════════════════════════════
   H) MODAL SHELL
   ══════════════════════════════════════════════════════════════ */

.nx-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
}
.nx-modal.is-open { display: flex; }

.nx-modal__overlay {
    position: absolute;
    inset: 0;
    background: var(--nx-bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nx-modal__dialog {
    position: relative;
    z-index: 1;
    margin: auto;
    background: var(--nx-surface);
    border-radius: var(--nx-radius-lg);
    box-shadow: var(--nx-shadow-lg);
    max-width: 700px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    animation: nxModalIn 0.3s ease;
}
@keyframes nxModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Size modifiers */
.nx-modal__dialog--wide   { max-width: 860px; }
.nx-modal__dialog--narrow { max-width: 500px; }

.nx-modal__header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px var(--nx-space-lg);
    background: var(--nx-surface);
    color: var(--nx-text);
    border-bottom: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-lg) var(--nx-radius-lg) 0 0;
    position: relative;
}
.nx-modal__header-title {
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-md);
    font-weight: var(--nx-weight-bold);
    margin: 0;
}

.nx-modal__close {
    position: absolute;
    right: var(--nx-space-md);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--nx-text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color var(--nx-ease-fast);
}
.nx-modal__close:hover {
    color: var(--nx-text);
}

.nx-modal__body {
    padding: var(--nx-space-lg);
}

.nx-modal__footer {
    padding: 0 var(--nx-space-lg) var(--nx-space-lg);
}


/* ══════════════════════════════════════════════════════════════
   I) TOAST SHELL
   ══════════════════════════════════════════════════════════════ */

/* Hide default WooCommerce notices (replaced by toast system) */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info,
.wc-block-components-notice-banner {
    display: none !important;
}

.nx-toast-stack {
    position: fixed;
    bottom: var(--nx-space-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: 11000;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--nx-space-sm);
    pointer-events: none;
    width: 100%;
    max-width: 420px;
    padding: 0 var(--nx-space-md);
    box-sizing: border-box;
}

.nx-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--nx-space-sm);
    background: var(--nx-surface);
    border-radius: var(--nx-radius-lg);
    box-shadow: var(--nx-shadow-lg), var(--nx-shadow-sm);
    padding: 16px 42px 16px 16px;
    pointer-events: all;
    overflow: hidden;
    animation: nxToastIn 0.3s ease;
}
@keyframes nxToastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Left accent bar */
.nx-toast::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
    border-radius: var(--nx-radius-lg) 0 0 var(--nx-radius-lg);
}

/* Type colours */
.nx-toast--success::before { background: var(--nx-status-success); }
.nx-toast--error::before   { background: var(--nx-status-error); }
.nx-toast--warning::before { background: var(--nx-status-warning); }
.nx-toast--info::before    { background: var(--nx-status-info); }

.nx-toast__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}
.nx-toast--success .nx-toast__icon { background: var(--nx-status-success); }
.nx-toast--error   .nx-toast__icon { background: var(--nx-status-error); }
.nx-toast--warning .nx-toast__icon { background: var(--nx-status-warning); }
.nx-toast--info    .nx-toast__icon { background: var(--nx-status-info); }

.nx-toast__content {
    flex: 1;
    min-width: 0;
}
.nx-toast__title {
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-base);
    font-weight: var(--nx-weight-bold);
    color: var(--nx-color-primary);
    display: block;
    line-height: var(--nx-leading-snug);
    margin-bottom: 2px;
}
.nx-toast--error   .nx-toast__title { color: #DC2626; }
.nx-toast--warning .nx-toast__title { color: #B45309; }

.nx-toast__message {
    font-size: var(--nx-text-sm);
    color: var(--nx-text-muted);
    margin: 0;
    line-height: var(--nx-leading-snug);
}

/* ── CTA Button ── */
.nx-toast__cta {
    display: inline-block;
    margin-top: var(--nx-space-xs);
    padding: 6px 18px;
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-xs);
    font-weight: var(--nx-weight-bold);
    color: var(--nx-text-on-cta);
    background: var(--nx-gradient-cta);
    border-radius: var(--nx-radius-pill);
    text-decoration: none;
    transition: transform var(--nx-ease-fast), box-shadow var(--nx-ease-fast);
    box-shadow: 0 2px 8px rgba(255, 107, 61, 0.3);
}
.nx-toast__cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 61, 0.4);
    color: var(--nx-text-on-cta);
}

/* ── Product Image ── */
.nx-toast__image {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: var(--nx-radius-sm);
    overflow: hidden;
    background: var(--nx-pastel-lavender);
    margin-top: 2px;
}
.nx-toast__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Close Button ── */
.nx-toast__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--nx-color-silver);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background var(--nx-ease-fast), color var(--nx-ease-fast);
    line-height: 1;
    padding: 0;
}
.nx-toast__close:hover {
    background: var(--nx-surface-muted);
    color: var(--nx-text-muted);
}

/* ── Toast Responsive ── */
@media (max-width: 480px) {
    .nx-toast-stack {
        max-width: 100%;
        width: calc(100% - 20px);
        bottom: 16px;
    }
    .nx-toast {
        padding: 14px 38px 14px 14px;
        border-radius: var(--nx-radius-md);
        gap: 10px;
    }
    .nx-toast__icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    .nx-toast__icon svg {
        width: 18px;
        height: 18px;
    }
    .nx-toast__image {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
    .nx-toast__close {
        width: 36px;
        height: 36px;
        font-size: 1.4rem;
    }
}


/* ══════════════════════════════════════════════════════════════
   J) ORDER SUMMARY
   ══════════════════════════════════════════════════════════════ */

.nx-order-summary { }

.nx-order-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--nx-font-body);
    font-size: var(--nx-text-base);
    color: var(--nx-text);
    padding: var(--nx-space-2xs) 0;
}
.nx-order-summary__value {
    font-family: var(--nx-font-heading);
    font-weight: var(--nx-weight-bold);
}
.nx-order-summary__value--muted {
    font-weight: var(--nx-weight-normal);
    font-family: var(--nx-font-body);
    color: var(--nx-text-muted);
}
.nx-order-summary__row--coupon .nx-order-summary__value {
    color: var(--nx-status-success);
}

.nx-order-summary__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--nx-space-md) 0 0;
    margin-top: var(--nx-space-xs);
    border-top: 2px solid var(--nx-color-primary);
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-md);
    font-weight: var(--nx-weight-bold);
    color: var(--nx-text);
}
.nx-order-summary__total-value {
    font-size: var(--nx-text-xl);
    font-weight: var(--nx-weight-extrabold);
}

/* Promo toggle (reusable in cart + checkout) */
.nx-promo { margin-top: var(--nx-space-md); }
.nx-promo__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    background: none;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-sm);
    padding: 10px var(--nx-space-md);
    font-family: var(--nx-font-body);
    font-size: var(--nx-text-sm);
    color: var(--nx-text-muted);
    cursor: pointer;
    transition: border-color var(--nx-ease-fast), color var(--nx-ease-fast);
}
.nx-promo__toggle:hover {
    border-color: var(--nx-border-focus);
    color: var(--nx-color-primary);
}
.nx-promo__arrow {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform var(--nx-ease-fast);
}
.nx-promo.is-open .nx-promo__arrow { transform: rotate(90deg); }
.nx-promo__form {
    display: none;
    margin-top: var(--nx-space-xs);
}
.nx-promo.is-open .nx-promo__form { display: block; }
.nx-promo__input-wrap {
    display: flex;
    gap: var(--nx-space-xs);
}
.nx-promo__input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-sm);
    font-family: var(--nx-font-body);
    font-size: var(--nx-text-sm);
    background: var(--nx-surface-muted);
    outline: none;
    transition: border-color var(--nx-ease-fast);
}
.nx-promo__input:focus { border-color: var(--nx-border-active); }
.nx-promo__input:focus-visible { outline: 2px solid var(--nx-border-focus); outline-offset: 2px; }


/* ══════════════════════════════════════════════════════════════
   K) PRODUCT & COLLECTION CARD BASES
   ══════════════════════════════════════════════════════════════ */

/* ── Product Card ── */
.nx-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-lg);
    overflow: hidden;
    transition: transform var(--nx-ease-base), box-shadow var(--nx-ease-base);
    cursor: pointer;
}
@media (hover: hover) {
    .nx-product-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--nx-shadow-md);
    }
}

.nx-product-card__image {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--nx-pastel-lavender);
}
.nx-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--nx-ease-slow);
}
@media (hover: hover) {
    .nx-product-card:hover .nx-product-card__image img {
        transform: scale(1.05);
    }
}

.nx-product-card__badge {
    position: absolute;
    top: var(--nx-space-sm);
    left: var(--nx-space-sm);
    background: var(--nx-status-error);
    color: #fff;
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-xs);
    font-weight: var(--nx-weight-bold);
    padding: 4px 10px;
    border-radius: var(--nx-radius-pill);
}

.nx-product-card__body {
    padding: var(--nx-space-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}
.nx-product-card__price {
    margin-top: auto;
}
.nx-product-card__name {
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-base);
    font-weight: var(--nx-weight-bold);
    color: var(--nx-text);
    margin: 0 0 var(--nx-space-2xs);
    line-height: var(--nx-leading-snug);
}
.nx-product-card__price {
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-md);
    font-weight: var(--nx-weight-bold);
    color: var(--nx-color-cta-start);
}
.nx-product-card__price del {
    color: var(--nx-text-muted);
    font-weight: var(--nx-weight-normal);
    font-size: var(--nx-text-sm);
    margin-right: 6px;
}

.nx-product-card__action {
    padding: 0 var(--nx-space-md) var(--nx-space-md);
}

/* Fade-in animation for dynamically loaded cards */
.nx-product-card--fadein {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.nx-product-card--visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Collection Card ── */
.nx-collection-card {
    position: relative;
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius-lg);
    overflow: hidden;
    transition: transform var(--nx-ease-base), box-shadow var(--nx-ease-base);
}
@media (hover: hover) {
    .nx-collection-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--nx-shadow-md);
    }
}

.nx-collection-card__image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--nx-pastel-purple);
}
.nx-collection-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--nx-ease-slow);
}
@media (hover: hover) {
    .nx-collection-card:hover .nx-collection-card__image img {
        transform: scale(1.05);
    }
}

.nx-collection-card__body {
    padding: var(--nx-space-md);
    text-align: center;
}
.nx-collection-card__name {
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-md);
    font-weight: var(--nx-weight-bold);
    color: var(--nx-text);
    margin: 0 0 var(--nx-space-2xs);
}
.nx-collection-card__count {
    font-size: var(--nx-text-sm);
    color: var(--nx-text-muted);
}


/* ══════════════════════════════════════════════════════════════
   L) VARIATION TILES
   Unified tile selector for WooCommerce product variations.
   Replaces dropdowns with image, colour, or text tiles.
   ══════════════════════════════════════════════════════════════ */

/* ── Hidden select (visually hidden, accessible) ── */
select.nx-hidden-select,
.variations td.value > select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
}


/* ── Variation group wrapper ── */
.nx-variation-group {
    margin-bottom: var(--nx-space-md);
}
.nx-variation-group__label {
    display: block;
    font-family: var(--nx-font-heading);
    font-weight: var(--nx-weight-semibold);
    font-size: var(--nx-text-sm);
    color: var(--nx-text-muted);
    margin-bottom: var(--nx-space-xs);
}

/* ── Tile container ── */
.nx-variation-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: var(--nx-space-md);
}
.nx-variation-tiles--scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-top: 8px;
    padding-bottom: 4px;
}
.nx-variation-tiles--scroll::-webkit-scrollbar { display: none; }
.nx-variation-tiles--scroll.is-scrollable {
    padding-right: var(--nx-space-xl);
}

/* ── Scroll arrow (for overflowing image tiles) ── */
.nx-variation-tiles__arrow {
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--nx-bg) 40%);
    border: none;
    font-size: 1.5rem;
    color: var(--nx-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
    transition: opacity var(--nx-ease-fast);
    z-index: 2;
}
.nx-variation-tiles__arrow:hover { color: var(--nx-color-primary); }
.nx-variation-tiles__arrow.is-hidden { opacity: 0; pointer-events: none; }

/* ── Base tile ── */
.nx-variation-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--nx-surface);
    border: 2px solid var(--nx-border);
    border-radius: var(--nx-radius-md);
    cursor: pointer;
    transition: border-color var(--nx-ease-fast), background var(--nx-ease-fast), box-shadow var(--nx-ease-fast);
    position: relative;
}
.nx-variation-tile:hover {
    border-color: var(--nx-color-primary-light);
}
.nx-variation-tile:focus-visible {
    outline: 2px solid var(--nx-border-focus);
    outline-offset: 2px;
}

/* ── Active state (all tile types) ── */
.nx-variation-tile--active {
    border-color: var(--nx-border-active, #bbb);
    background: var(--nx-surface-muted);
    box-shadow: var(--nx-shadow-sm);
}
/* Small check badge on active tile */
.nx-variation-tile--active::after {
    content: '\2713';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    background: var(--nx-color-primary);
    color: #fff;
    font-size: 0.6rem;
    font-weight: var(--nx-weight-bold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ── Disabled state (all tile types) ── */
.nx-variation-tile--disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── IMAGE TILE ── */
.nx-variation-tile--image {
    flex-direction: column;
    gap: 5px;
    padding: var(--nx-space-xs) var(--nx-space-xs) 6px;
    min-width: 60px;
    flex-shrink: 0;
}
.nx-variation-tile--image .nx-variation-tile__img {
    width: 48px;
    height: 48px;
    border-radius: var(--nx-radius-sm);
    object-fit: cover;
    border: 1px solid var(--nx-border);
}
.nx-variation-tile--image .nx-variation-tile__fallback {
    width: 48px;
    height: 48px;
    border-radius: var(--nx-radius-sm);
    background: var(--nx-pastel-lavender);
    border: 1px solid var(--nx-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--nx-font-heading);
    font-size: 1.2rem;
    font-weight: var(--nx-weight-bold);
    color: var(--nx-color-primary);
}
.nx-variation-tile--image .nx-variation-tile__label {
    font-size: 0.68rem;
    font-family: var(--nx-font-body);
    color: var(--nx-text-muted);
    text-align: center;
    line-height: var(--nx-leading-tight);
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nx-variation-tile--image.nx-variation-tile--active .nx-variation-tile__img,
.nx-variation-tile--image.nx-variation-tile--active .nx-variation-tile__fallback {
    border-color: var(--nx-border-active, #bbb);
}

/* ── COLOUR TILE ── */
.nx-variation-tile--colour {
    flex-direction: column;
    gap: 5px;
    padding: var(--nx-space-xs);
    min-width: 56px;
}
.nx-variation-tile--colour .nx-variation-tile__swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--nx-border);
    flex-shrink: 0;
}
.nx-variation-tile--colour .nx-variation-tile__swatch--light {
    border-color: #ccc;
}
.nx-variation-tile--colour .nx-variation-tile__swatch--text {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nx-pastel-lavender);
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-sm);
    font-weight: var(--nx-weight-bold);
    color: var(--nx-color-primary);
    border-color: var(--nx-border);
}
.nx-variation-tile--colour .nx-variation-tile__label {
    font-size: 0.68rem;
    font-family: var(--nx-font-body);
    color: var(--nx-text-muted);
    text-align: center;
    line-height: var(--nx-leading-tight);
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── TEXT TILE (pill) ── */
.nx-variation-tile--text {
    padding: 10px 28px;
    border-radius: var(--nx-radius-pill);
    font-family: var(--nx-font-heading);
    font-size: var(--nx-text-sm);
    font-weight: var(--nx-weight-semibold);
    color: var(--nx-text-muted);
}
.nx-variation-tile--text:hover {
    border-color: var(--nx-color-primary-light);
    color: var(--nx-color-primary);
}
.nx-variation-tile--text.nx-variation-tile--active {
    background: var(--nx-surface-muted);
    color: var(--nx-text);
    border-color: var(--nx-border-active, #bbb);
    font-weight: var(--nx-weight-bold);
}
/* Text pills use the check badge from the base active state */

/* ── Quick View context: slightly larger image tiles ── */
.nx-modal .nx-variation-tile--image {
    width: 80px;
    padding: 6px;
    gap: var(--nx-space-2xs);
    background: var(--nx-surface-muted);
    border-color: transparent;
}
.nx-modal .nx-variation-tile--image .nx-variation-tile__img {
    width: 60px;
    height: 60px;
}
.nx-modal .nx-variation-tile--image .nx-variation-tile__fallback {
    width: 60px;
    height: 60px;
}
.nx-modal .nx-variation-tile--image .nx-variation-tile__label {
    font-size: 0.72rem;
    font-weight: var(--nx-weight-semibold);
    max-width: 72px;
}
.nx-modal .nx-variation-tile--image:hover {
    border-color: var(--nx-pastel-purple);
    background: var(--nx-pastel-lavender);
}
.nx-modal .nx-variation-tile--image.nx-variation-tile--active {
    border-color: var(--nx-border-active, #bbb);
    background: var(--nx-surface);
    box-shadow: var(--nx-shadow-sm);
}

/* ── Quick View context: colour tiles (inline pill style) ── */
.nx-modal .nx-variation-tile--colour {
    flex-direction: row;
    gap: var(--nx-space-xs);
    padding: 6px 16px;
    border-radius: var(--nx-radius-pill);
    min-width: auto;
}
.nx-modal .nx-variation-tile--colour .nx-variation-tile__swatch {
    width: 18px;
    height: 18px;
    border-width: 1px;
    border-color: rgba(0,0,0,0.1);
}
.nx-modal .nx-variation-tile--colour .nx-variation-tile__label {
    font-size: var(--nx-text-xs);
    font-weight: var(--nx-weight-semibold);
    max-width: none;
}
.nx-modal .nx-variation-tile--colour:hover {
    border-color: var(--nx-border-active);
    background: var(--nx-surface-muted);
}
.nx-modal .nx-variation-tile--colour.nx-variation-tile--active {
    border-color: var(--nx-border-active, #bbb);
    background: var(--nx-surface);
    box-shadow: var(--nx-shadow-sm);
}

/* ── Quick View context: text tiles ── */
.nx-modal .nx-variation-tile--text {
    padding: 8px 20px;
    background: var(--nx-surface-muted);
}
.nx-modal .nx-variation-tile--text:hover {
    border-color: var(--nx-border-active);
    background: var(--nx-surface-hover);
}
.nx-modal .nx-variation-tile--text.nx-variation-tile--active {
    border-color: var(--nx-border-active, #bbb);
    color: var(--nx-text);
    background: var(--nx-surface-muted);
    font-weight: var(--nx-weight-bold);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .nx-variation-tile--colour .nx-variation-tile__swatch { width: 30px; height: 30px; }
    .nx-variation-tile--colour { min-width: 48px; }
}
@media (max-width: 480px) {
    .nx-variation-tile--text { padding: 8px 18px; font-size: var(--nx-text-xs); }
}


/* ══════════════════════════════════════════════════════════════
   UTILITY: VISUALLY HIDDEN (accessible)
   ══════════════════════════════════════════════════════════════ */
.nx-sr-only {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}
