/* ── Hide native WooCommerce attribute table when any gmrbw layout is active ── */
/* Adjacent-sibling rule (fast path — works when nothing sits between them)     */
.gmrbw-variations + table.variations { 
    display: none !important; 
}
/* Descendant rule via :has() (modern browsers) — survives theme wrapper nodes  */
.variations_form:has(.gmrbw-variations) table.variations { 
    display: none !important;
}
.variations_form .single_variation .woocommerce-variation-description { display: none !important; }
.variations_form .single_variation .woocommerce-variation-availability { display: none !important; }

/* ── Variations wrapper ──────────────────────────────────────── */
.gmrbw-variations {
    margin-bottom: 20px;
}



.gmrbw-variations-radio {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
/* column overrides — explicit, always win */
.gmrbw-variations-radio.gmrbw-cols-1 { grid-template-columns: 1fr !important; }
.gmrbw-variations-radio.gmrbw-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.gmrbw-variations-radio.gmrbw-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.gmrbw-variations-radio.gmrbw-cols-4 { grid-template-columns: repeat(4, 1fr) !important; }

/* ── Base radio item ─────────────────────────────────────────── */
.gmrbw-variation-radio {
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    transition: border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
    background: #fff;
    user-select: none;
}

/* ── STYLE: card (default) ───────────────────────────────────── */
.gmrbw-variations-radio:not(.gmrbw-style-pill):not(.gmrbw-style-minimal) .gmrbw-variation-radio {
    border: 1.5px solid #dde1e7;
    padding: 12px 14px;
}
.gmrbw-variations-radio:not(.gmrbw-style-pill):not(.gmrbw-style-minimal) .gmrbw-variation-radio:hover {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}
.gmrbw-variations-radio:not(.gmrbw-style-pill):not(.gmrbw-style-minimal) .gmrbw-variation-radio.gmrbw-variation-active {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px #2271b1;
    background: #f0f6fc;
}

/* ── STYLE: pill ─────────────────────────────────────────────── */
.gmrbw-style-pill .gmrbw-variation-radio {
    border: 1.5px solid #dde1e7;
    border-radius: 50px;
    padding: 8px 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.gmrbw-variations-radio.gmrbw-style-pill {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.gmrbw-style-pill .gmrbw-variation-radio:hover {
    border-color: #2271b1;
}
.gmrbw-style-pill .gmrbw-variation-radio.gmrbw-variation-active {
    border-color: #2271b1;
    background: #2271b1;
    color: #fff;
}
.gmrbw-style-pill .gmrbw-variation-radio.gmrbw-variation-active .gmrbw-variation-name,
.gmrbw-style-pill .gmrbw-variation-radio.gmrbw-variation-active .gmrbw-variation-price,
.gmrbw-style-pill .gmrbw-variation-radio.gmrbw-variation-active .gmrbw-variation-availability {
    color: #fff;
}

/* ── STYLE: minimal ──────────────────────────────────────────── */
.gmrbw-style-minimal .gmrbw-variation-radio {
    border: none;
    border-radius: 0;
    padding: 10px 14px;
    background: transparent;
}
.gmrbw-style-minimal .gmrbw-variation-radio:hover {
    background: #f9f9f9;
}
.gmrbw-style-minimal .gmrbw-variation-radio.gmrbw-variation-active {
    background: #f0f6fc;
}

/* ── Active indicator dot ────────────────────────────────────── */
.gmrbw-variation-radio.gmrbw-variation-active::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2271b1;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.gmrbw-style-pill .gmrbw-variation-radio.gmrbw-variation-active::after,
.gmrbw-style-minimal .gmrbw-variation-radio.gmrbw-variation-active::after {
    display: none;
}

/* ── Inner layout ────────────────────────────────────────────── */
.gmrbw-variation-parent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.gmrbw-variation-selector {
    flex-shrink: 0;
    padding-top: 2px;
}

/* Hide native radio — we style the wrapper instead */
.gmrbw-variation-selector input[type="radio"] {
    accent-color: #2271b1;
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.gmrbw-variation-image {
    flex-shrink: 0;
}

.gmrbw-variation-image img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    display: block;
}

.gmrbw-variation-info {
    flex: 1;
    min-width: 0;
}

.gmrbw-variation-info-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.gmrbw-variation-name {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.4;
}

.gmrbw-variation-price {
    font-size: 13px;
    font-weight: 600;
    color: #2271b1;
    white-space: nowrap;
}

.gmrbw-variation-price del {
    color: #a7aaad;
    font-weight: 400;
    font-size: 11px;
    margin-right: 3px;
}

.gmrbw-variation-availability {
    font-size: 11px;
    margin-top: 4px;
    font-weight: 500;
}

.gmrbw-instock .gmrbw-variation-availability { color: #00a32a; }
.gmrbw-outofstock .gmrbw-variation-availability { color: #d63638; }

.gmrbw-variation-description {
    display: none;
    font-size: 12px;
    color: #646970;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    line-height: 1.5;
}
.gmrbw-variation-active .gmrbw-variation-description { display: block; }

/* ── Out of stock states ─────────────────────────────────────── */
/* disable */
.gmrbw-oos-disable .gmrbw-outofstock {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* strikethrough */
.gmrbw-oos-strikethrough .gmrbw-outofstock .gmrbw-variation-name {
    text-decoration: line-through;
    color: #a7aaad;
}
.gmrbw-oos-strikethrough .gmrbw-outofstock {
    opacity: 0.65;
}

/* hide — done via PHP, no CSS needed */

/* ── Select layouts ──────────────────────────────────────────── */
.gmrbw-variation-html_select{
    width: 100%;
    max-width: 340px;
    padding: 8px 12px;
    border: 1.5px solid #dde1e7;
    border-radius: 6px;
    font-size: 13px;
    color: #1d2327;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s;
    appearance: auto;
}

.gmrbw-variation-select2 {
    width: 100%;
    max-width: 340px;
    font-size: 13px;
    color: #1d2327;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s;
    appearance: auto;
}
.gmrbw-variation-html_select:focus,
.gmrbw-variation-select2:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

/* ══════════════════════════════════════════════════════════════
   SWITCH BOX LAYOUT
   Each variation is a labelled toggle switch
   ══════════════════════════════════════════════════════════════ */

.gmrbw-variations-switchbox {
    display: block;
}

/* inner grid wrapper — only the items, not the desc panel */
.gmrbw-switchbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

/* column overrides on the inner grid */
.gmrbw-switchbox-grid.gmrbw-cols-1 { grid-template-columns: 1fr !important; }
.gmrbw-switchbox-grid.gmrbw-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.gmrbw-switchbox-grid.gmrbw-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.gmrbw-switchbox-grid.gmrbw-cols-4 { grid-template-columns: repeat(4, 1fr) !important; }

@media (max-width: 600px) {
    .gmrbw-switchbox-grid.gmrbw-mob-cols-1 { grid-template-columns: 1fr !important; }
    .gmrbw-switchbox-grid.gmrbw-mob-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
    .gmrbw-switchbox-grid.gmrbw-mob-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
}

/* outer wrapper — holds row + description */
.gmrbw-switchbox-wrap {
    display: flex;
    flex-direction: column;
}

/* clickable row */
.gmrbw-switchbox-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid #dde1e7;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    gap: 14px;
}

.gmrbw-switchbox-item:hover {
    border-color: #2271b1;
    background: #f9fbff;
}

.gmrbw-switchbox-wrap.gmrbw-variation-active .gmrbw-switchbox-item {
    border-color: #2271b1;
    background: #f0f6fc;
}

/* description panel — shared, sits below all switchbox items */
.gmrbw-variation-desc-panel {
    font-size: 13px;
    color: #3c434a;
    line-height: 1.6;
    padding: 12px 16px;
    margin-top: 4px;
    background: #f8fbff;
    border: 1px solid #c2d8f0;
    border-radius: 6px;
}

/* left side — image + info */
.gmrbw-switchbox-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.gmrbw-switchbox-image img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    display: block;
    flex-shrink: 0;
}

.gmrbw-switchbox-info {
    flex: 1;
    min-width: 0;
}

.gmrbw-switchbox-name {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.4;
    display: block;
}

.gmrbw-switchbox-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.gmrbw-switchbox-price {
    font-size: 13px;
    font-weight: 600;
    color: #2271b1;
}

.gmrbw-switchbox-price del {
    color: #a7aaad;
    font-weight: 400;
    font-size: 11px;
    margin-right: 3px;
}

.gmrbw-switchbox-stock {
    font-size: 11px;
    font-weight: 500;
}

.gmrbw-instock .gmrbw-switchbox-stock  { color: #00a32a; }
.gmrbw-outofstock .gmrbw-switchbox-stock { color: #d63638; }

/* out-of-stock states for switchbox */
.gmrbw-oos-disable .gmrbw-switchbox-wrap.gmrbw-outofstock {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.gmrbw-oos-strikethrough .gmrbw-switchbox-wrap.gmrbw-outofstock .gmrbw-switchbox-name {
    text-decoration: line-through;
    color: #a7aaad;
}
.gmrbw-oos-strikethrough .gmrbw-switchbox-wrap.gmrbw-outofstock {
    opacity: 0.65;
}

/* column classes now handled by .gmrbw-switchbox-grid — see above */

/* ── Image position: top ─────────────────────────────────────── */
.gmrbw-img-top .gmrbw-switchbox-item {
    flex-direction: column;
    align-items: stretch;
}

.gmrbw-switchbox-image--top {
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
}

.gmrbw-switchbox-image--top img {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

/* ── Image position: bottom ──────────────────────────────────── */
.gmrbw-img-bottom .gmrbw-switchbox-item {
    flex-direction: column;
    align-items: stretch;
}

.gmrbw-switchbox-image--bottom {
    width: 100%;
    text-align: center;
    margin-top: 10px;
}

.gmrbw-switchbox-image--bottom img {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

/* ── Price position: below name ──────────────────────────────── */
.gmrbw-switchbox-price-below {
    font-size: 14px;
    font-weight: 700;
    color: #2271b1;
    margin-top: 6px;
    display: block;
}

.gmrbw-switchbox-price-below del {
    color: #a7aaad;
    font-weight: 400;
    font-size: 12px;
    margin-right: 4px;
}

/* mobile column overrides handled by .gmrbw-switchbox-grid media query — see above */
