{# Wrappers #}
.rates-table__wrapper {
    width: 100%;
    overflow: hidden;
}

.rates-table__wrapper + .rates-table__wrapper {
    margin-top: 1.5rem;
}

@media (min-width: 768px) {
    .rates-table__wrapper + .rates-table__wrapper {
        margin-top: 3rem;
    }
}

.rates-table__scroller {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

{# Heading styles #}
.rates-tables__group-heading {
    margin-bottom: 1.5rem;
}

.rates-table__heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.rates-table__heading .heading-wrapper * {
    margin: 0;
}

{# General table styling #}
.rates-table__table {
    width: 100%;
    table-layout: fixed;
    border-spacing: 0;
    border-collapse: separate;
    border: none;
    margin: 0;
}

.rates-table__table :is(table, td, th) {
    border: none;
}

.rates-table__table th,
.rates-table__table td {
    text-align: left;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    vertical-align: middle;
}

.rates-table__table tbody td.first-col {
    /* text-align: left; */
}

.rates-table__table th *,
.rates-table__table td * {
    margin: 0;
}

.rates-table__table th *:not(li) + *,
.rates-table__table td *:not(li) + * {
    margin-top: 0.5rem;
}

.check-icon,
.x-icon {
    display: inline-flex;
    width: 1.25rem;
    height: 1.25rem;
    color: #214489; /* overrides currentColor if needed */
    vertical-align: middle;
}

.x-icon {
    color: red;
}

{# Mobile table element styling #}
.rates-table__table th.table__mobile-header,
.rates-table__table .table__mobile-detail-row,
.rates-table__table .table__mobile-detail-body {
    display: none;
}

.rates-table__table .table__mobile-detail-row {
    flex-grow: 1;
}

@media (max-width: 767px) {
    table.rates-table__table,
    .rates-table__table tbody,
    .rates-table__table tr,
    .rates-table__table td,
    .rates-table__table caption {
        display: flex;
        flex-direction: column;
        width: 100%;
        word-break: break-all;
    }

    .rates-table__table th.table__header,
    .rates-table__table .table__detail-row,
    .rates-table__table thead,
    .rates-table__table .table__detail-body {
        display: none;
    }

    .rates-table__table th.table__mobile-header,
    .rates-table__table tbody.transposed__mobile-body {
        display: block;
    }

    {# Comparison mobile body #}
    .rates-table__table .table__mobile-detail-row,
    .rates-table__table tbody.comparison__mobile-body {
        display: flex;
    }

    .rates-table__table tbody.comparison__mobile-body th + td {
        padding-top: 0;
    }

    /* Add in horizontal scrolling for mobile comparison chart */
    .rates-table__table tbody.comparison__mobile-body {
        flex-direction: row;
        gap: 0.5rem;
        overflow-x: scroll;
        scroll-snap-type: x mandatory;
        padding-bottom: 1rem;
    }
    
    .rates-table__table tr {
        width: 100%;
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    /* scrollbar styling */
    .rates-table__table tbody::-webkit-scrollbar-track,
    .rates-table__table tbody::-webkit-scrollbar-thumb {
        border-radius: 8px;
    }

    .rates-table__table tbody::-webkit-scrollbar {
        height: 8px;
    }


    {# Transposed mobile body #}
    .rates-table__table tbody.transposed__mobile-body .table__mobile-detail-row {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .rates-table__table tbody.transposed__mobile-body th.table__mobile-header--first {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        flex: 100%;
    }

    .rates-table__table tbody.transposed__mobile-body th.table__mobile-header--first > span {
        /* text-align: left; */
        margin: 0;
    }

    .rates-table__table tbody.transposed__mobile-body th.table__mobile-header--first > span.label {
        flex: 0 1 50%;
        padding-right: 1rem;
    }

    .rates-table__table tbody.transposed__mobile-body th.table__mobile-header--first > span.value {
        padding-left: 1rem;
    }

    .rates-table__table tbody.transposed__mobile-body th:not(.table__mobile-header--first),
    .rates-table__table tbody.transposed__mobile-body td {
        flex: 50%;
        /* text-align: left; */
    }
}