
:root {
    --scars-drawer-width: 510px;
    --scars-border: #d9d9d9;
    --scars-text: #0d0d0d;
    --scars-muted: #6e6e6e;
    --scars-overlay: rgba(0,0,0,.38);
}

/* ==========================
   SELECTOR EN LA FICHA
   ========================== */

.single-product form.variations_form tr.scars-size-row > th.label {
    display: none !important;
}

.single-product form.variations_form tr.scars-size-row > td.value {
    display: block;
    width: 100%;
    padding: 0 !important;
}

.single-product form.variations_form select.scars-native-size-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.single-product form.variations_form tr.scars-size-row .reset_variations {
    display: none !important;
}

.scars-size-open {
    width: 100%;
    min-height: 58px;
    border: 1px solid #111;
    border-radius: 0;
    background: #fff;
    color: #111;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    cursor: pointer;
    font: inherit;
    text-align: left;
    letter-spacing: .01em;
}

.scars-size-open:hover,
.scars-size-open:focus-visible {
    background: #fafafa;
    outline: none;
}

.scars-size-open__copy {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.scars-size-open__label {
    text-transform: uppercase;
    font-size: 14px;
}

.scars-size-open__value {
    font-size: 14px;
    font-weight: 600;
}

.scars-size-open__chevron {
    width: 9px;
    height: 9px;
    border-top: 1px solid #111;
    border-right: 1px solid #111;
    transform: rotate(45deg);
    flex: 0 0 auto;
}

/* ==========================
   OVERLAY + DRAWER
   ========================== */

body.scars-size-drawer-open {
    overflow: hidden !important;
}

.scars-size-overlay {
    position: fixed;
    inset: 0;
    z-index: 999990;
    background: var(--scars-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
}

.scars-size-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.scars-size-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(var(--scars-drawer-width), 92vw);
    height: 100dvh;
    z-index: 999999;
    background: #fff;
    color: var(--scars-text);
    transform: translateX(100%);
    transition: transform .34s cubic-bezier(.22,1,.36,1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 28px rgba(0,0,0,.08);
}

.scars-size-drawer.is-open {
    transform: translateX(0);
}

.scars-size-drawer__header {
    padding: 72px 70px 24px;
    position: relative;
    flex: 0 0 auto;
}

.scars-size-drawer__title {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: .04em;
}

.scars-size-drawer__close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: #000;
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
}

.scars-size-drawer__close::before,
.scars-size-drawer__close::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 1px;
    background: currentColor;
}

.scars-size-drawer__close::before {
    transform: rotate(45deg);
}

.scars-size-drawer__close::after {
    transform: rotate(-45deg);
}

.scars-size-drawer__close:hover {
    opacity: .86;
}

.scars-size-drawer__body {
    padding: 10px 70px 40px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.scars-size-guide {
    display: inline-block;
    margin: 0 0 42px;
    color: #111;
    font-size: 16px;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.scars-size-guide:hover {
    border-bottom-color: currentColor;
}

.scars-size-list {
    border-top: 1px solid var(--scars-border);
}

.scars-size-item {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-bottom: 1px solid var(--scars-border);
    background: #fff;
    color: #111;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.scars-size-item:hover,
.scars-size-item:focus-visible {
    background: #fafafa;
    outline: none;
}

.scars-size-item__name {
    font-size: 14px;
    line-height: 1.3;
}

.scars-size-item.is-selected .scars-size-item__name {
    font-weight: 600;
}

.scars-size-item.is-disabled,
.scars-size-item:disabled {
    cursor: not-allowed;
    color: #999;
    background: #fff;
}

.scars-size-item.is-disabled .scars-size-item__name,
.scars-size-item:disabled .scars-size-item__name {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.scars-size-item__status {
    color: #111;
    font-size: 12px;
    white-space: nowrap;
}

.scars-size-item.is-disabled .scars-size-item__status {
    color: #777;
}

.scars-size-item__check {
    width: 14px;
    height: 14px;
    border: 1px solid #111;
    border-radius: 50%;
    position: relative;
    opacity: 0;
}

.scars-size-item.is-selected .scars-size-item__check {
    opacity: 1;
}

.scars-size-item.is-selected .scars-size-item__check::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #111;
}

/* Error si intentan comprar sin talla */
.scars-size-open.has-error {
    border-color: #b3261e;
}

/* ==========================
   RESPONSIVE
   ========================== */

@media (max-width: 767px) {
    :root {
        --scars-drawer-width: 100vw;
    }

    .scars-size-drawer {
        width: 100vw;
    }

    .scars-size-drawer__header {
        padding: 70px 24px 22px;
    }

    .scars-size-drawer__body {
        padding: 8px 24px 28px;
    }

    .scars-size-drawer__close {
        top: 18px;
        right: 18px;
    }

    .scars-size-guide {
        margin-bottom: 28px;
    }
}


/* =========================================================
   v2.1 - OCULTAR COMPLETAMENTE EL SELECTOR VISUAL ANTERIOR
   Conservamos únicamente el <select> real, oculto, para que
   WooCommerce siga gestionando la variación internamente.
   ========================================================= */

/* Ocultar cualquier UI de swatches/botones generada junto al select nativo. */
.single-product form.variations_form tr.scars-size-row .variable-items-wrapper,
.single-product form.variations_form tr.scars-size-row .woo-variation-items-wrapper,
.single-product form.variations_form tr.scars-size-row .cfvsw-swatches-container,
.single-product form.variations_form tr.scars-size-row .thwvsf-wrapper-ul,
.single-product form.variations_form tr.scars-size-row .wvs-style-squared,
.single-product form.variations_form tr.scars-size-row .vi-wpvs-option-wrap,
.single-product form.variations_form tr.scars-size-row .rtwpvs-terms-wrapper,
.single-product form.variations_form tr.scars-size-row .ux-swatches,
.single-product form.variations_form tr.scars-size-row .wd-swatches-product,
.single-product form.variations_form tr.scars-size-row .swatchly-type-wrap {
    display: none !important;
}

/* Nuestro botón es la única interfaz visible dentro de la fila de talla. */
.single-product form.variations_form tr.scars-size-row > td.value > * {
    display: none !important;
}

.single-product form.variations_form tr.scars-size-row > td.value > .scars-size-open {
    display: flex !important;
}

/* El select original continúa existiendo y recibe los cambios por JS. */
.single-product form.variations_form tr.scars-size-row > td.value > select.scars-native-size-select {
    display: block !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 1px !important;
    min-height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    border: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    pointer-events: none !important;
}
