/* Shared MudTable styling for the Cool Company WASM apps (CC.Web.Admin.WASM, CC.BusinessDashboard.WASM).
   Consumed via _content/CC.Core.ComponentsLibrary/css/mudTableStyles.css — see
   https://learn.microsoft.com/en-us/aspnet/core/razor-pages/ui-class#consume-content-from-a-referenced-rcl
   Relies on the --cc-* custom properties each consuming app already defines on :root. */

.mud-table-container {
    border: 1px solid var(--cc-gray-lighter);
    border-radius: 5px;
    margin: 25px;
    width: unset !important;
}

.mud-table-head {
    background: var(--cc-gray-lightest);
}

.mud-table-cell {
    padding: 3px 20px 3px 20px !important;
    height: 55px !important;
    font-size: 16px !important;
    color: var(--cc-gray-darker) !important;
}

.mud-table-head .mud-table-cell {
    padding: 0px 20px 0px 20px !important;
    height: 53px !important;
    font-size: 14px !important;
    color: var(--cc-black) !important;
}

.mud-table-sort-label {
    font-weight: bold;
}

/* Mobile behaviour for any table marked .mobile-table. These used to live in a <style> block
   inside CcTable.razor, which meant they were only in the DOM while a CcTable was rendered —
   pages built on a bare MudTable (invoice details tabs, team member details tabs) got no mobile
   layout at all. Both consuming apps link this file, so keep them here. */

/* Ensure the table fits the container in mobile view */
.mobile-table table {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.mobile-table td, .mobile-table th {
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 599.99px) {
    .mobile-table table {
        display: block;
    }

    /*
     * Needs !important: .mud-table-root .mud-table-head { display: table-header-group }
     * has specificity (0,2,0) which beats our thead rule at (0,1,1).
     */
    .mobile-table thead {
        display: none !important;
    }

    /*
     * Scoped to tbody/tbody tr (not plain tr) so the thead row is unaffected.
     * Needs !important: MudBlazor adds .mud-xs-table at xs which carries
     * .mud-xs-table .mud-table-row { display: revert } at (0,2,0), beating
     * our old (0,1,1) rule. !important wins regardless of specificity.
     */
    .mobile-table tbody,
    .mobile-table tbody tr {
        display: block !important;
        width: 100%;
    }

    /* Belt-and-suspenders: keep expansion panels full-width */
    .mobile-table tr > div,
    .mobile-table .mud-expansion-panels {
        width: 100% !important;
    }

    /* The container's fixed margin eats most of a phone viewport */
    .mud-table-container {
        margin: 12px;
    }
}
