/* =============================================
   Size Selector for CartFlows — sso.css v4.0
   Multi-select + clear checkmark on selection
   ============================================= */

/* ── Wrapper ── */
.sso-inline-wrap {
    display: inline-flex;
    flex-direction: column;
    gap: 7px;
    margin-right: 16px;
    vertical-align: middle;
}

/* ── Label ── */
.sso-inline-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #888;
    line-height: 1;
}
.sso-req { color: #e91e8c; margin-left: 2px; }

/* ── Size button row ── */
.sso-inline-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

/* ── Individual size button ── */
.sso-sz {
    position: relative;          /* for the checkmark badge */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 42px;
    padding: 0 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    color: #444;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s,
                box-shadow 0.15s, transform 0.15s;
    line-height: 1;
    box-shadow: none;
    text-decoration: none;
    overflow: visible;           /* let the badge poke out */
    user-select: none;
}

.sso-sz:hover {
    border-color: #e91e8c;
    color: #e91e8c;
    background: #fff5fb;
}

/* ── SELECTED state ── */
.sso-sz.sso-active {
    border-color: #e91e8c;
    background: linear-gradient(135deg, #e91e8c 0%, #c2185b 100%);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(233,30,140,0.40);
    transform: translateY(-2px);
}

/* ── Checkmark badge — top-right corner of button ── */
.sso-sz::after {
    content: '';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #16a34a;            /* green tick circle */
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Hidden by default */
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34,1.56,0.64,1);

    /* Checkmark drawn with SVG background */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-size: 10px 10px;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #16a34a;
}

/* Show badge only when active */
.sso-sz.sso-active::after {
    opacity: 1;
    transform: scale(1);
}

/* ── Selected sizes summary pill ── */
.sso-selected-summary {
    font-size: 11px;
    color: #16a34a;
    font-weight: 700;
    letter-spacing: 0.2px;
    min-height: 14px;
    transition: opacity 0.2s;
}
.sso-selected-summary:empty {
    opacity: 0;
}

/* ── Validation error ── */
.sso-size-error {
    font-size: 11px;
    font-weight: 600;
    color: #dc2626;
    margin-top: 1px;
    display: block;
}

/* ══════════════════════════════════════════════
   CartFlows table layout fixes
══════════════════════════════════════════════ */
.woocommerce-checkout-review-order-table td.product-name,
.cartflows-checkout .woocommerce-checkout-review-order-table td,
table.shop_table td {
    vertical-align: middle;
}
.woocommerce-checkout-review-order-table .product-quantity,
.cartflows-checkout .product-quantity {
    white-space: nowrap;
}
.woocommerce-checkout-review-order-table .product-quantity .quantity,
.quantity {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* ══════════════════════════════════════════════
   Mobile
══════════════════════════════════════════════ */
@media (max-width: 600px) {
    .sso-inline-wrap {
        display: flex;
        margin-right: 0;
        margin-bottom: 8px;
        width: 100%;
    }
    .sso-sz {
        min-width: 44px;
        height: 40px;
        font-size: 13px;
    }
    .woocommerce-checkout-review-order-table .product-quantity {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ══════════════════════════════════════════════
   Shake on error
══════════════════════════════════════════════ */
@keyframes sso-shake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-5px); }
    40%      { transform: translateX(5px); }
    60%      { transform: translateX(-5px); }
    80%      { transform: translateX(5px); }
}
.sso-inline-wrap.sso-has-error .sso-inline-sizes {
    animation: sso-shake 0.4s ease;
}
.sso-inline-wrap.sso-has-error .sso-sz:not(.sso-active) {
    border-color: #fca5a5;
}
