/* Enhanced Product Group Table — scoped with egt- prefix */

[x-cloak] {
    display: none !important;
}

/* Toolbar */
.egt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0;
    padding: 0.85rem 1.25rem 1.1rem;
    background-color: #37474f;
    border-radius: 4px 4px 0 0;
}

.egt-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.egt-toolbar-label {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    color: #fff;
}

/* Toggle buttons */
.egt-switcher {
    display: inline-flex;
    gap: 0.2rem;
}

.egt-pill {
    display: inline-block;
    padding: 0.4rem 1rem;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    border: 2px solid #cfd8dc;
    border-radius: 0.5rem;
    cursor: pointer;
    background-color: #fff;
    color: #607d8b;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.egt-pill:hover {
    background-color: #eceff1;
    color: #455a64;
}

.egt-pill-active {
    background-color: #ffebee;
    color: #d9534f;
    border-color: #d9534f;
}

.egt-pill-active:hover {
    background-color: #ffcdd2;
    color: #c9302c;
    border-color: #c9302c;
}

/* Table */
.egt-table {
    width: 100%;
    margin-bottom: 15px;
    border-collapse: collapse;
    border-spacing: 0;
}

.egt-table thead th {
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #000;
    background-color: #eceff1;
    padding: 1.15rem 1rem;
    vertical-align: middle;
    border-bottom: 4px solid #cfd8dc;
}

.egt-table tbody td {
    vertical-align: middle;
    font-size: 14px;
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
}

.egt-table .egt-col-code {
    min-width: 80px;
    text-align: left;
}

.egt-table .egt-col-desc {
    min-width: 150px;
    text-align: left;
}

.egt-table .egt-col-dim {
    white-space: nowrap;
    text-align: center;
}

.egt-table .egt-col-unitqty {
    text-align: center;
    min-width: 60px;
}

.egt-table .egt-col-price {
    text-align: center;
    white-space: nowrap;
    min-width: 70px;
}

.egt-table .egt-col-price-clickable {
    cursor: pointer;
}

.egt-table .egt-col-price-clickable:hover {
    background-color: #f5f5f5;
}

.egt-table .egt-price-active {
    background-color: #5cb85c;
    color: #fff;
    font-weight: bold;
    padding: 10px;
}

.egt-table .egt-price-active:hover {
    background-color: #3d913d;
}

/* Info icon */
.egt-info-icon {
    color: #337ab7;
    margin-left: 5px;
    font-size: 14px;
}

.egt-info-icon:hover {
    color: #23527c;
}

/* Product image in table */
.egt-product-image {
    max-width: 60px;
    height: auto;
}

/* Quantity input wrapper */
.egt-qty-wrapper {
    display: inline-flex;
    align-items: center;
}

.egt-qty-wrapper .egt-qty-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    text-align: center;
    line-height: 30px;
    font-size: 12px;
}

.egt-qty-input::-webkit-outer-spin-button,
.egt-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Description link styling */
.egt-table a.egt-product-link {
    color: inherit;
    text-decoration: none;
}

.egt-table a.egt-product-link:hover {
    text-decoration: underline;
}

/* Unit locked message */
.egt-unit-locked-message {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.4;
    max-width: 290px;
    white-space: normal;
}

.egt-unit-locked-message i {
    margin-right: 4px;
}

/* Price breaks header — hidden on desktop */
.egt-price-breaks-header {
    display: none;
}

/* Mobile expand toggle — hidden on desktop */
.egt-expand-toggle {
    display: none;
}

.egt-mobile-summary {
    display: none;
}

.egt-mobile-attributes {
    display: none;
}

.egt-mobile-details {
    display: none;
}

/* Mobile price cell — hidden on desktop (shown via card layout) */
.egt-mobile-price-cell {
    display: none;
}

.egt-mobile-price-ex {
    color: #666;
    font-size: 12px;
}
.egt-table > tbody > tr > td {
    vertical-align: middle;
}

@media (min-width: 768px) and (max-width: 1199px) {
    .thompsons-group-products-table > thead > tr > th.egt-col-code,
    .thompsons-group-products-table > thead > tr > th.egt-col-desc,
    .thompsons-group-products-table > tbody > tr > td.egt-col-code,
    .thompsons-group-products-table > tbody > tr > td.egt-col-desc {
        display: none;
    }
    th.egt-col-dim {
        text-align: center;
    }
}

/*
 * Mobile card layout — Thompsons style.css handles the base card
 * structure (display:block, hide thead, card borders, data-title labels).
 * We only add our enhancements on top.
 *
 * Our CSS loads after style.css (bottom of <body> vs <head>), so at
 * equal specificity we win by source order — no !important needed.
 */
@media (max-width: 767px) {
    /* Toolbar: grid layout so labels and buttons align */
    .egt-toolbar {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 1.1rem 1rem;
        align-items: center;
    }

    .egt-toolbar-group {
        display: contents;
    }

    .egt-toolbar-label {
        text-align: left;
    }

    /* Remove Bootstrap .table-responsive border */
    .egt-container .table-responsive {
        border: 0;
    }

    /* Top margin on first card */
    .thompsons-group-products-table > tbody > tr:first-of-type {
        margin-top: 16px;
    }

    /* Cell borders and padding — overrides style.css border:0 by source order */
    .thompsons-group-products-table > tbody > tr > td {
        border-bottom: 1px solid #eee;
        padding: 12px 16px;
        text-align: left;
    }

    .thompsons-group-products-table > tbody > tr > td:last-child {
        border-bottom: 0;
    }

    /* Price breaks section header */
    .thompsons-group-products-table > tbody > tr > td.egt-price-breaks-header {
        font-size: 1.2rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #666;
        background-color: #f5f5f5;
        padding: 8px 16px;
    }

    .thompsons-group-products-table > tbody > tr > td.egt-price-breaks-header::before {
        display: none;
    }

    /* Reset desktop alignment for card layout */
    .egt-table .egt-col-price,
    .egt-table .egt-col-unitqty {
        text-align: left;
        white-space: normal;
    }

    /* Code cell: flex-wrap so label takes full row, code + toggle share second row */
    .egt-table .egt-col-code {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }

    .egt-table .egt-col-code::before {
        display: none;
    }

    .egt-table .egt-col-code > .egt-product-link {
        display: none;
    }

    .egt-mobile-summary {
        display: flex;
        align-items: center;
        gap: 14px;
        width: 100%;
    }

    .egt-mobile-summary-dim {
        color: #222;
        flex: 1 1 auto;
        font-size: 2rem;
        font-weight: 700;
        line-height: 1.2;
        text-decoration: none;
    }

    .egt-mobile-summary-dim:hover,
    .egt-mobile-summary-dim:focus {
        color: #222;
        text-decoration: none;
    }

    .egt-mobile-summary-price {
        color: #222;
        flex: 0 0 auto;
        font-size: 1.8rem;
        font-weight: 700;
        line-height: 1.2;
        text-align: right;
    }

    /* Show expand toggle */
    .egt-expand-toggle {
        align-items: center;
        background: #777;
        border: 2px solid #be1723;
        border-radius: 999px;
        color: #fff;
        cursor: pointer;
        display: inline-flex;
        flex: 0 0 38px;
        font-size: 22px;
        height: 38px;
        justify-content: center;
        margin-left: 0;
        padding: 0;
        width: 38px;
    }

    .egt-expand-toggle[aria-expanded="true"] {
        background: #be1723;
    }

    .egt-expand-toggle-desktop {
        display: none;
    }

    /* Show mobile price cell — needs higher specificity to beat desktop display:none */
    .egt-table .egt-mobile-price-cell {
        display: none;
    }

    .thompsons-group-products-table > tbody > tr > td.egt-col-desc,
    .thompsons-group-products-table > tbody > tr > td.egt-col-dim,
    .thompsons-group-products-table > tbody > tr > td.egt-col-unitqty,
    .thompsons-group-products-table > tbody > tr > td.egt-col-price,
    .thompsons-group-products-table > tbody > tr > td.thompsons-group-purchase-cell {
        display: none;
    }

    /* Hide expandable cells by default, show when row is expanded */
    .thompsons-group-products-table > tbody > tr > td.egt-expandable {
        display: none;
    }

    .thompsons-group-products-table > tbody > tr.egt-row-expanded > td.egt-col-desc,
    .thompsons-group-products-table > tbody > tr.egt-row-expanded > td.egt-mobile-details,
    .thompsons-group-products-table > tbody > tr.egt-row-expanded > td.thompsons-group-purchase-cell {
        display: block;
    }

    .egt-table .egt-col-desc,
    .egt-table .egt-col-dim,
    .egt-table .egt-col-unitqty,
    .egt-table .egt-col-price {
        text-align: left;
    }

    .egt-mobile-attributes {
        display: block;
        margin: 0;
    }

    .egt-mobile-details {
        padding-top: 0;
    }

    .egt-mobile-details::before {
        display: none;
    }

    .egt-mobile-details-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 18px;
    }

    .egt-mobile-details-title {
        color: #666;
        font-size: 1.2rem;
        font-weight: 700;
        margin-bottom: 10px;
        text-transform: uppercase;
    }

    .egt-mobile-breaks-list {
        margin: 0;
    }

    .egt-mobile-break-row,
    .egt-mobile-attribute-row {
        display: flex;
        gap: 8px;
        justify-content: space-between;
        margin-bottom: 8px;
    }

    .egt-mobile-break-row:last-child,
    .egt-mobile-attribute-row:last-child {
        margin-bottom: 0;
    }

    .egt-mobile-break-row dt,
    .egt-mobile-break-row dd,
    .egt-mobile-attribute-row dt,
    .egt-mobile-attribute-row dd {
        margin: 0;
    }

    .egt-mobile-break-row dt,
    .egt-mobile-attribute-row dt {
        font-weight: 700;
    }

    .egt-mobile-break-row dd,
    .egt-mobile-attribute-row dd {
        text-align: right;
    }

    .egt-mobile-break-row.egt-price-active {
        font-weight: 700;
        color:#fff;
    }

    .thompsons-group-products-table > tbody > tr.egt-row-expanded > td.egt-col-dim,
    .thompsons-group-products-table > tbody > tr.egt-row-expanded > td.egt-col-unitqty,
    .thompsons-group-products-table > tbody > tr.egt-row-expanded > td.egt-col-price,
    .thompsons-group-products-table > tbody > tr.egt-row-expanded > td.egt-price-breaks-header {
        display: none;
    }

    .egt-unit-locked-message {
        max-width: none;
    }
    .egt-mobile-break-row.egt-price-active .egt-mobile-break-row dt {
        color: #fff;
    }
}
@media (max-width: 420px) {
    .egt-mobile-details-grid {
        grid-template-columns: 1fr;
    }

    .egt-mobile-details-col {
        width: 100%;
    }
}
