/* ======================================================================
   Product variations picker — Cohort 5
   Design: #5 Outlined + Check (from variation-designs-demo)
   Bootstrap-first: btn / badge / alert / d-flex / gap come from Bootstrap.
   Visual language: thicker 1.5px outline, explicit check mark on selected.
   Active = ink border + ✓ icon (right side for text, overlay for color,
   top-right badge for image). High-clarity selection signal.
   ====================================================================== */

/* ---------- Grid spacing ---------- */
.product-variations-5 .products-variations-grid {
    gap: 10px;
}

/* ---------- TEXT pill (default mode) — outlined with right-side check ---------- */
.product-variations-5-pill {
    cursor: pointer;
    user-select: none;
    background: var(--bs-body-bg);
    border: 1.5px solid var(--bs-border-color);
    border-radius: 10px;
    padding: 9px 16px;
    margin: 0;
    transition: border-color 0.15s ease, padding 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    font-size: 0.9375rem;
    color: var(--bs-body-color);
    line-height: 1.3;
    font-weight: 500;
}

.product-variations-5-pill:hover {
    border-color: var(--bs-body-color);
}

.product-variations-5-pill.active {
    border-color: var(--bs-body-color);
    font-weight: 600;
}

/* Unified check badge — same placement (top-right corner) across all 3 modes */
.product-variations-5-pill.active::after {
    content: "";
    position: absolute;
    top: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--bs-body-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M4 8.5l3 3L12 5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 11px;
    box-shadow: 0 0 0 2px var(--bs-body-bg);
    z-index: 3;
    pointer-events: none;
}

/* Hide the cohort-provided check span — we use ::after for clean positioning */
.product-variations-5-pill .product-variations-5-check {
    display: none !important;
}

/* Discount badge — top-LEFT to avoid collision with top-right check badge */
.product-variations-5-pill .product-variations-5-discount {
    position: absolute !important;
    top: -7px !important;
    left: 10px !important;
    right: auto !important;
    transform: none !important;
    background: var(--bs-danger) !important;
    color: var(--bs-body-bg) !important;
    border-radius: 999px;
    padding: 1px 7px !important;
    font-size: 0.625rem !important;
    line-height: 1.4;
    font-weight: 700;
    z-index: 2;
}

/* Meta block hidden */
.product-variations-5-pill .product-variations-5-meta {
    display: none;
}

/* ---------- COLOR mode — circular chip with check overlay on selected ---------- */
.product-variations-5-pill-color {
    padding: 0 !important;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border: 1.5px solid var(--bs-border-color);
    border-radius: 50% !important;
    background: var(--bs-body-bg);
    overflow: hidden;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
}

.product-variations-5-pill-color:hover {
    border-color: var(--bs-body-color);
}

.product-variations-5-pill-color .product-variations-5-swatch {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    border: 0 !important;
    box-shadow: none !important;
    display: block !important;
    flex-shrink: 0;
}

.product-variations-5-pill-color.active {
    border-color: var(--bs-body-color);
    overflow: visible;
}

/* Color uses SAME top-right badge — overflow:visible above lets it float outside */
.product-variations-5-pill-color.active::after {
    content: "";
    position: absolute;
    top: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--bs-body-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M4 8.5l3 3L12 5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 11px;
    box-shadow: 0 0 0 2px var(--bs-body-bg);
    inset: auto;
    z-index: 3;
    pointer-events: none;
    filter: none;
}

/* Color-mode label kept for screen readers only */
.product-variations-5-pill-color .product-variations-5-pill-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- IMAGE mode — square chip with check badge top-right ---------- */
.product-variations-5-pill-image {
    padding: 0 !important;
    width: 56px;
    height: 56px;
    min-width: 56px;
    border: 1.5px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--bs-body-bg);
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.product-variations-5-pill-image:hover {
    border-color: var(--bs-body-color);
}

.product-variations-5-pill-image .product-variations-5-thumb {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 0;
    border: 0;
    margin: 0;
    display: block;
}

.product-variations-5-pill-image.active {
    border-color: var(--bs-body-color);
    overflow: visible;
}

/* Image uses SAME top-right badge as text/color — consistent across all 3 modes */
.product-variations-5-pill-image.active::after {
    content: "";
    position: absolute;
    top: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--bs-body-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M4 8.5l3 3L12 5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 11px;
    box-shadow: 0 0 0 2px var(--bs-body-bg);
    z-index: 3;
    pointer-events: none;
}

/* Image-mode text label kept for screen readers only */
.product-variations-5-pill-image .product-variations-5-pill-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reset cohort-default column layouts */
.variation-layout-image .product-variations-5-pill {
    flex-direction: row;
    align-items: center;
}

.variation-layout-image .product-variations-5-thumb {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
}

.variation-layout-color .product-variations-5-pill {
    flex-direction: row;
    padding-top: 0;
    gap: 0;
}

/* ---------- DISABLED (out-of-stock / cross-axis impossible) ---------- */
.product-variations-5-pill.is-disabled,
.ic-single-row.is-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    position: relative;
}

.product-variations-5-pill-color.is-disabled,
.product-variations-5-pill-image.is-disabled {
    text-decoration: none;
}

.product-variations-5-pill-color.is-disabled::after,
.product-variations-5-pill-image.is-disabled::after {
    content: "";
    position: absolute;
    inset: 50% 4px auto 4px;
    height: 1px;
    background: var(--bs-secondary-color);
    transform: translateY(-50%);
    background-image: none;
    border-radius: 0;
}

.product-variations-5-pill.is-disabled:hover {
    border-color: var(--bs-border-color) !important;
}

/* ---------- SELECT mode — outlined dropdown ---------- */
.product-variations-5-select.form-select {
    max-width: 320px;
    border: 1.5px solid var(--bs-border-color);
    border-radius: 10px;
    padding: 9px 36px 9px 16px;
    font-size: 0.9375rem;
    line-height: 1.3;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23111418' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 9px;
    cursor: pointer;
    transition: border-color 0.15s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.product-variations-5-select.form-select:hover {
    border-color: var(--bs-body-color);
}

.product-variations-5-select.form-select:focus {
    border-color: var(--bs-body-color);
    box-shadow: none;
    outline: 0;
}

.product-variations-5-select.form-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- Axis head ---------- */
.product-variations-5-axis-head .products-variations-label-text {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--bs-body-color) !important;
}

.product-variations-5-axis-head .products-variations-count {
    font-size: 0.75rem !important;
    color: var(--bs-secondary-color) !important;
}

.product-variations-5-axis-selected.products-variations-axis-selected {
    font-size: 0.75rem !important;
    color: var(--bs-body-color) !important;
    font-weight: 600 !important;
}

/* ---------- BUNDLE pill (child-row variant) ---------- */
.bundle-pill.btn.btn-outline-secondary.active,
.bundle-pill.btn.btn-outline-secondary:has(.bundle-pill-input:checked) {
    background: var(--bs-body-color);
    border-color: var(--bs-body-color);
    color: var(--bs-body-bg);
}

/* Legacy alias kept for older partials still on disk */
.product-variations-5-visual {
    margin: 0;
}
