/**
 * Utop content tables — visual parity with TNC rich HTML tables.
 * Dedicated classes (not tnc-content-body__html / cmp-table selectors).
 *
 * Markup (enhanced by utop-content-table-enhance.js):
 *   <div class="utop-content-table">
 *     <div class="utop-content-table__viewport">
 *       <table class="utop-content-table__grid">…</table>
 *     </div>
 *   </div>
 *
 * AEM cmp-table: same classes added alongside existing cmp-table markup.
 */

.utop-content-table {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 18px 0;
    font-size: 1.125rem;
    text-align: left;
    box-sizing: border-box;
}

@media (max-width: 639px) {
    .utop-content-table {
        font-size: 0.875rem;
    }
}

.utop-content-table__viewport {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    cursor: grab;
    scrollbar-width: thin;
    scrollbar-color: #f48120 rgba(43, 43, 43, 0.2);
}

.utop-content-table__grid {
    border-collapse: separate;
    border-spacing: 0;
    border: 2px solid #ff7b00;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 3px 20px rgba(43, 43, 43, 0.1);
    width: auto;
    min-width: 100%;
    max-width: none;
    table-layout: auto;
    margin: 0;
}

.utop-content-table__grid p {
    font-size: inherit;
    margin: 0;
}

.utop-content-table__grid th {
    padding: 1rem 0.5rem;
    color: #fff;
    background-color: #ff7b00;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    border-left: 0.5px solid #ff7b00;
    border-right: 0.5px solid #ff7b00;
    border-bottom: 2px solid #ff7b00;
    word-break: normal;
    overflow-wrap: normal;
}

.utop-content-table__grid td {
    padding: 0.75rem 0.5rem;
    color: #2b2b2b;
    background-color: #fff;
    text-align: center;
    vertical-align: middle;
    border-left: 0.5px solid #ff7b00;
    border-right: 0.5px solid #ff7b00;
    word-break: normal;
    overflow-wrap: normal;
}

@media (min-width: 768px) {
    .utop-content-table__grid th,
    .utop-content-table__grid td {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .utop-content-table__grid.utop-content-table__grid--fluid {
        width: 100%;
        table-layout: auto;
    }
}

.utop-content-table__grid tr:nth-child(odd) td {
    background-color: #fff7ed;
}

.utop-content-table__grid tr > th:first-child,
.utop-content-table__grid tr > td:first-child {
    text-align: left;
}

/* AEM cmp-table: map existing scroll hosts to viewport */
.utop-content-table.cmp-table,
.utop-content-table.cms-table {
    overflow: visible;
}

.utop-content-table.cmp-table .table-content,
.utop-content-table.cmp-table .table-scroll-area,
.utop-content-table.cmp-table .table-scroll-wrapper,
.utop-content-table.cms-table .table-content,
.utop-content-table.cms-table .table-scroll-area,
.utop-content-table.cms-table .table-scroll-wrapper {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-right: 0 !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    cursor: grab;
}

.utop-content-table.cmp-table table,
.utop-content-table.cms-table table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 2px solid #ff7b00 !important;
    border-radius: 1rem !important;
    box-shadow: 0 3px 20px rgba(43, 43, 43, 0.1) !important;
    width: auto !important;
    min-width: 100% !important;
    max-width: none !important;
    table-layout: auto !important;
    overflow: hidden !important;
}

.utop-content-table.cmp-table table th,
.utop-content-table.cms-table table th {
    padding: 1rem 0.5rem !important;
    color: #fff !important;
    background-color: #ff7b00 !important;
    font-weight: 700 !important;
    text-align: center !important;
    border-bottom: 2px solid #ff7b00 !important;
    word-break: normal !important;
}

.utop-content-table.cmp-table table td,
.utop-content-table.cms-table table td {
    padding: 0.75rem 0.5rem !important;
    color: #2b2b2b !important;
    background-color: #fff !important;
    text-align: center !important;
    word-break: normal !important;
}

.utop-content-table.cmp-table table tr:nth-child(odd) td,
.utop-content-table.cms-table table tr:nth-child(odd) td {
    background-color: #fff7ed !important;
}

.utop-content-table.cmp-table table tr > th:first-child,
.utop-content-table.cmp-table table tr > td:first-child,
.utop-content-table.cms-table table tr > th:first-child,
.utop-content-table.cms-table table tr > td:first-child {
    text-align: left !important;
}

@media (max-width: 767px) {
    .utop-content-table__grid,
    .utop-content-table.cmp-table table,
    .utop-content-table.cms-table table,
    .utop-content-table.cmp-table.ss-full-width-mobile-only table,
    .utop-content-table.cms-table.ss-full-width-mobile-only table {
        width: auto !important;
        min-width: 100% !important;
        table-layout: auto !important;
    }

    .utop-content-table__grid th,
    .utop-content-table__grid td,
    .utop-content-table.cmp-table table th,
    .utop-content-table.cmp-table table td,
    .utop-content-table.cms-table table th,
    .utop-content-table.cms-table table td {
        white-space: nowrap !important;
        min-width: 4.5rem;
    }

    .utop-content-table__grid tr > th:first-child,
    .utop-content-table__grid tr > td:first-child,
    .utop-content-table.cmp-table table tr > th:first-child,
    .utop-content-table.cmp-table table tr > td:first-child,
    .utop-content-table.cms-table table tr > th:first-child,
    .utop-content-table.cms-table table tr > td:first-child {
        white-space: normal !important;
        min-width: 6.5rem;
    }
}

.text .text-component .utop-content-table,
.faq-accordion .accordion-content .text-component .utop-content-table {
    display: block;
    width: 100%;
    text-align: left;
}

.utop-content-table__viewport::-webkit-scrollbar,
.utop-content-table.cmp-table .table-content::-webkit-scrollbar,
.utop-content-table.cmp-table .table-scroll-area::-webkit-scrollbar,
.utop-content-table.cmp-table .table-scroll-wrapper::-webkit-scrollbar,
.utop-content-table.cms-table .table-content::-webkit-scrollbar,
.utop-content-table.cms-table .table-scroll-area::-webkit-scrollbar,
.utop-content-table.cms-table .table-scroll-wrapper::-webkit-scrollbar {
    height: 6px;
}

.utop-content-table__viewport::-webkit-scrollbar-thumb,
.utop-content-table.cmp-table .table-content::-webkit-scrollbar-thumb,
.utop-content-table.cmp-table .table-scroll-area::-webkit-scrollbar-thumb,
.utop-content-table.cmp-table .table-scroll-wrapper::-webkit-scrollbar-thumb,
.utop-content-table.cms-table .table-content::-webkit-scrollbar-thumb,
.utop-content-table.cms-table .table-scroll-area::-webkit-scrollbar-thumb,
.utop-content-table.cms-table .table-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: #f48120;
    border-radius: 10px;
}

.utop-content-table__viewport::-webkit-scrollbar-track,
.utop-content-table.cmp-table .table-content::-webkit-scrollbar-track,
.utop-content-table.cmp-table .table-scroll-area::-webkit-scrollbar-track,
.utop-content-table.cmp-table .table-scroll-wrapper::-webkit-scrollbar-track,
.utop-content-table.cms-table .table-content::-webkit-scrollbar-track,
.utop-content-table.cms-table .table-scroll-area::-webkit-scrollbar-track,
.utop-content-table.cms-table .table-scroll-wrapper::-webkit-scrollbar-track {
    background-color: rgba(43, 43, 43, 0.2);
    border-radius: 10px;
}

.utop-content-table__viewport.utop-table-scroll-dragging,
.utop-content-table.cmp-table .table-content.utop-table-scroll-dragging,
.utop-content-table.cmp-table .table-scroll-area.utop-table-scroll-dragging,
.utop-content-table.cms-table .table-content.utop-table-scroll-dragging,
.utop-content-table.cms-table .table-scroll-area.utop-table-scroll-dragging {
    cursor: grabbing;
    user-select: none;
}
