/*
=========================================================
GLOBAL BOX SIZING
=========================================================
*/

.custom-variation-table-wrapper,
.custom-variation-table-wrapper *,
.custom-variation-table-wrapper *::before,
.custom-variation-table-wrapper *::after {
    box-sizing: border-box;
}

/*
=========================================================
HIDE DEFAULT WOOCOMMERCE VARIATION DROPDOWNS
=========================================================
*/

form.variations_form table.variations {
    display: none !important;
}

/*
=========================================================
MAIN WRAPPER
=========================================================
*/

.custom-variation-table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 28px 0;
    padding: 0;
    overflow: hidden !important;
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    box-shadow: 0 5px 20px rgba(16, 24, 40, 0.06);
}

/*
=========================================================
MAIN TABLE
=========================================================
*/

.custom-variation-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    table-layout: fixed !important;
    background: #ffffff;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

/*
=========================================================
TABLE HEADER
=========================================================
*/

.custom-variation-table thead th {
    box-sizing: border-box;
    padding: 17px 16px !important;
    background: #f7f8fa !important;
    color: #344054 !important;
    border: 0 !important;
    border-bottom: 1px solid #e4e7ec !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    letter-spacing: 0.2px;
    text-align: left !important;
    text-transform: none !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    vertical-align: middle !important;
}

/*
=========================================================
SELECT COLUMN
=========================================================
*/

.custom-variation-table thead th:first-child,
.custom-variation-table tbody td:first-child {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    text-align: center !important;
}

/*
=========================================================
PRICE COLUMN
=========================================================
*/

.custom-variation-table thead th:last-child,
.custom-variation-table tbody td:last-child {
    width: 125px !important;
    min-width: 125px !important;
    max-width: 125px !important;
    padding-left: 8px !important;
    padding-right: 16px !important;
    text-align: right !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
}

.custom-variation-table thead th:last-child {
    white-space: nowrap !important;
}

/*
=========================================================
HEADER CORNERS
=========================================================
*/

.custom-variation-table thead th:first-child {
    border-top-left-radius: 14px;
}

.custom-variation-table thead th:last-child {
    border-top-right-radius: 14px;
}

/*
=========================================================
TABLE BODY ROWS
=========================================================
*/

.custom-variation-table tbody tr {
    background: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/*
=========================================================
TABLE BODY CELLS
=========================================================
*/

.custom-variation-table tbody td {
    box-sizing: border-box;
    padding: 17px 16px !important;
    background: #ffffff;
    color: #475467;
    border: 0 !important;
    border-bottom: 1px solid #eef0f3 !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    text-align: left !important;
    vertical-align: middle !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/*
=========================================================
LAST ROW BORDER
=========================================================
*/

.custom-variation-table tbody tr:last-child td {
    border-bottom: 0 !important;
}

/*
=========================================================
PRODUCT NUMBER COLUMN
=========================================================
*/

.custom-variation-table tbody td:nth-child(2) {
    color: #101828 !important;
    font-weight: 600 !important;
}

/*
=========================================================
PRICE FONT SIZE — DESKTOP
=========================================================
*/

.custom-variation-table-wrapper .custom-variation-table tbody td.variation-price,
.custom-variation-table-wrapper .custom-variation-table tbody td.variation-price *,
.custom-variation-table-wrapper .custom-variation-table tbody td:last-child {
    color: #101828 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    text-align: right !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
}

/* WooCommerce price elements */

.custom-variation-table-wrapper .custom-variation-table td.variation-price .amount,
.custom-variation-table-wrapper .custom-variation-table td.variation-price bdi,
.custom-variation-table-wrapper .custom-variation-table td.variation-price .woocommerce-Price-currencySymbol {
    font-size: 14px !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
}

/* Sale price */

.custom-variation-table .variation-price del {
    display: block;
    margin-bottom: 2px;
    color: #98a2b3 !important;
    font-size: 12px !important;
    font-weight: 400 !important;
}

.custom-variation-table .variation-price ins {
    color: inherit !important;
    text-decoration: none !important;
}

/*
=========================================================
ROW HOVER
=========================================================
*/

.custom-variation-table tbody tr:hover td {
    background: #fffaf0 !important;
}

/*
=========================================================
SELECTED ROW
=========================================================
*/

.custom-variation-table tbody tr.selected td {
    background: #fff5d9 !important;
}

/*
=========================================================
SELECTED ROW INDICATOR
=========================================================
*/

.custom-variation-table tbody tr.selected td:first-child {
    box-shadow: inset 4px 0 0 #b98528;
}

/*
=========================================================
SELECTED PRODUCT NUMBER
=========================================================
*/

.custom-variation-table tbody tr.selected td:nth-child(2) {
    color: #956515 !important;
    font-weight: 700 !important;
}

/*
=========================================================
SELECTED PRICE
=========================================================
*/

.custom-variation-table-wrapper .custom-variation-table tbody tr.selected td.variation-price,
.custom-variation-table-wrapper .custom-variation-table tbody tr.selected td.variation-price *,
.custom-variation-table-wrapper .custom-variation-table tbody tr.selected td:last-child {
    color: #956515 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

/*
=========================================================
RADIO BUTTON
=========================================================
*/

.custom-variation-table input[type="radio"] {
    display: inline-block !important;
    width: 19px !important;
    height: 19px !important;
    min-width: 19px !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
    accent-color: #b17a22;
    vertical-align: middle;
}

/*
=========================================================
RADIO FOCUS
=========================================================
*/

.custom-variation-table input[type="radio"]:focus-visible {
    outline: 3px solid rgba(177, 122, 34, 0.25);
    outline-offset: 3px;
}

/*
=========================================================
VARIATION SIZE LABEL AND IMAGE
Image below the size label
=========================================================
*/

.custom-variation-table-wrapper .custom-variation-table .variation-size-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
}

.custom-variation-table-wrapper .custom-variation-table .variation-size-label {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    white-space: normal !important;
}

.custom-variation-table-wrapper .custom-variation-table .variation-size-image {
    display: block !important;
    width: 110px !important;
    height: 85px !important;
    max-width: 100% !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    float: none !important;
}

.custom-variation-table tbody td[data-label="Size"] {
    vertical-align: middle !important;
}

/*
=========================================================
TABLET / IPAD / NEST HUB
=========================================================
*/

@media (max-width: 1024px) {

    .custom-variation-table-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 24px 0 !important;
        padding: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        border-radius: 12px;
    }

    .custom-variation-table {
        width: auto !important;
        min-width: 650px !important;
        max-width: none !important;
        table-layout: auto !important;
    }

    .custom-variation-table thead th {
        padding: 15px 14px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        overflow-wrap: normal !important;
    }

    .custom-variation-table tbody td {
        padding: 15px 14px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        overflow-wrap: normal !important;
    }

    .custom-variation-table thead th:first-child,
    .custom-variation-table tbody td:first-child {
        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;
    }

    .custom-variation-table thead th:last-child,
    .custom-variation-table tbody td:last-child {
        width: 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
    }

    .custom-variation-table tbody td:nth-child(2) {
        min-width: 150px !important;
    }

    .custom-variation-table tbody td:nth-child(n + 3):not(:last-child) {
        min-width: 130px !important;
    }

    /* Smaller price on tablet */

    .custom-variation-table-wrapper .custom-variation-table tbody td.variation-price,
    .custom-variation-table-wrapper .custom-variation-table tbody td.variation-price *,
    .custom-variation-table-wrapper .custom-variation-table tbody td:last-child,
    .custom-variation-table-wrapper .custom-variation-table tbody tr.selected td:last-child {
        font-size: 13px !important;
        line-height: 1.4 !important;
        font-weight: 600 !important;
    }

    .custom-variation-table-wrapper .custom-variation-table .variation-size-content {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .custom-variation-table-wrapper .custom-variation-table .variation-size-image {
        width: 95px !important;
        height: 75px !important;
    }

    .custom-variation-table-wrapper .custom-variation-table .variation-size-label {
        text-align: center !important;
    }

    .custom-variation-table-wrapper::-webkit-scrollbar {
        height: 7px;
    }

    .custom-variation-table-wrapper::-webkit-scrollbar-track {
        background: #f2f4f7;
        border-radius: 10px;
    }

    .custom-variation-table-wrapper::-webkit-scrollbar-thumb {
        background: #c4c7cc;
        border-radius: 10px;
    }
}

/*
=========================================================
MOBILE
Table layout maintained with horizontal scroll
=========================================================
*/

@media (max-width: 767px) {

    .custom-variation-table-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 22px 0 !important;
        padding: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        border: 1px solid #e4e7ec !important;
        border-radius: 12px !important;
        background: #ffffff !important;
        box-shadow: 0 4px 16px rgba(16, 24, 40, 0.05) !important;
    }

    .custom-variation-table {
        display: table !important;
        width: auto !important;
        min-width: 620px !important;
        max-width: none !important;
        table-layout: auto !important;
    }

    .custom-variation-table thead {
        display: table-header-group !important;
    }

    .custom-variation-table tbody {
        display: table-row-group !important;
    }

    .custom-variation-table tr {
        display: table-row !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }

    .custom-variation-table th,
    .custom-variation-table td {
        display: table-cell !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 14px 12px !important;
        white-space: nowrap !important;
        text-align: left !important;
        border-radius: 0 !important;
    }

    .custom-variation-table thead th:first-child,
    .custom-variation-table tbody td:first-child {
        width: 70px !important;
        min-width: 70px !important;
        max-width: 70px !important;
        text-align: center !important;
    }

    .custom-variation-table thead th:last-child,
    .custom-variation-table tbody td:last-child {
        width: 115px !important;
        min-width: 115px !important;
        max-width: 115px !important;
        padding-right: 16px !important;
        text-align: right !important;
    }

    .custom-variation-table tbody td:nth-child(2) {
        min-width: 135px !important;
    }

    .custom-variation-table tbody td:nth-child(n + 3):not(:last-child) {
        min-width: 115px !important;
    }

    /* Smaller price on mobile */

    .custom-variation-table-wrapper .custom-variation-table tbody td.variation-price,
    .custom-variation-table-wrapper .custom-variation-table tbody td.variation-price *,
    .custom-variation-table-wrapper .custom-variation-table tbody td:last-child,
    .custom-variation-table-wrapper .custom-variation-table tbody tr.selected td:last-child {
        font-size: 13px !important;
        line-height: 1.4 !important;
        font-weight: 600 !important;
    }

    .custom-variation-table-wrapper .custom-variation-table .variation-size-content {
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .custom-variation-table-wrapper .custom-variation-table .variation-size-image {
        width: 95px !important;
        height: 75px !important;
    }

    .custom-variation-table-wrapper .custom-variation-table .variation-size-label {
        text-align: center !important;
    }

    .custom-variation-table tbody tr:hover td {
        background: #fffaf0 !important;
    }

    .custom-variation-table tbody tr.selected td {
        background: #fff5d9 !important;
    }
}

/*
=========================================================
SMALL MOBILE
=========================================================
*/

@media (max-width: 380px) {

    .custom-variation-table {
        min-width: 590px !important;
    }

    .custom-variation-table th,
    .custom-variation-table td {
        padding: 13px 10px !important;
        font-size: 12px !important;
    }

    .custom-variation-table thead th:first-child,
    .custom-variation-table tbody td:first-child {
        width: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
    }

    .custom-variation-table thead th:last-child,
    .custom-variation-table tbody td:last-child {
        width: 105px !important;
        min-width: 105px !important;
        max-width: 105px !important;
    }

    /* Keep price readable on small screens */

    .custom-variation-table-wrapper .custom-variation-table tbody td.variation-price,
    .custom-variation-table-wrapper .custom-variation-table tbody td.variation-price *,
    .custom-variation-table-wrapper .custom-variation-table tbody td:last-child {
        font-size: 12px !important;
        line-height: 1.4 !important;
        font-weight: 600 !important;
    }
}