/* Meyer Technologies Business Portal - Site Styles */

/* Header / Navbar logo alignment */
.logo-box {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.logo {
    display: flex !important;
    align-items: center;
    line-height: normal !important;
}

.logo span.logo-lg,
.logo span.logo-sm {
    align-items: center;
}

/* Application version footer */
.application-version {
    text-align: center;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Flex content layout */
.flex-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Card styling */
.card {
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Page title box.
   The Hyper theme bleeds this bar horizontally with margin:0 -30px and re-insets the text
   with padding:0 30px (the bleed is clipped by .content-page{overflow:hidden}). The horizontal
   padding MUST equal the negative horizontal margin or the title underlaps the sidebar on the
   left and overflows the viewport on the right (RMG/PCI keep the same padding==|margin| pairing). */
.page-title-box {
    padding: 1rem 30px;
    border-bottom: 1px solid #e9ecef;
    margin: 0 -30px 1.5rem -30px;
}

.page-title {
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
    color: #343a40;
}

/* Form styling */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Button styling */
.btn-toolbar {
    margin-bottom: 1rem;
}

/* Grid toolbar */
.grid-toolbar {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Status badges */
.badge-status {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
}

.badge-status-active {
    background-color: #28a745;
    color: white;
}

.badge-status-inactive {
    background-color: #6c757d;
    color: white;
}

.badge-status-pending {
    background-color: #ffc107;
    color: #212529;
}

.badge-status-approved {
    background-color: #28a745;
    color: white;
}

.badge-status-rejected {
    background-color: #dc3545;
    color: white;
}

/* Timecard specific styles */
.timecard-grid {
    border-collapse: collapse;
    width: 100%;
}

.timecard-grid th,
.timecard-grid td {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    text-align: center;
}

.timecard-grid .customer-header {
    background-color: #e9ecef;
    font-weight: 600;
    text-align: left;
}

.timecard-grid input[type="number"] {
    width: 60px;
    text-align: center;
}

/* Dashboard widgets */
.dashboard-widget {
    background-color: #fff;
    border-radius: 0.25rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.dashboard-widget-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.dashboard-widget-value {
    font-size: 2rem;
    font-weight: 700;
    color: #343a40;
}

/* Invoice/Quote styles */
.invoice-header {
    border-bottom: 2px solid #343a40;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.invoice-logo {
    max-height: 60px;
}

.invoice-title {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table th {
    background-color: #343a40;
    color: white;
    padding: 0.75rem;
    text-align: left;
}

.invoice-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.invoice-table .category-row {
    background-color: #e9ecef;
    font-weight: 600;
}

.invoice-total {
    text-align: right;
    font-size: 1.25rem;
    font-weight: 700;
}

/* Document folder styles */
.folder-tree {
    list-style: none;
    padding-left: 1rem;
}

.folder-item {
    padding: 0.25rem 0;
}

.folder-icon {
    color: #ffc107;
    margin-right: 0.5rem;
}

.file-icon {
    color: #6c757d;
    margin-right: 0.5rem;
}

/* Password strength indicator */
#PasswordStrength {
    position: absolute;
    right: 6px;
    top: 2px;
    font-size: .85714em;
}

div.PasswordStrengthContainer,
div.PasswordStrengthFrame {
    width: 75px;
}

div.PasswordStrengthFrame {
    border-left: 1px #d9d9d9 solid !important;
    border-top: 1px #d9d9d9 solid !important;
    border-right: 1px #d9d9d9 solid !important;
    border-bottom: 1px #d9d9d9 solid !important;
}

table.PasswordStrengthWrapper {
    margin-left: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .timecard-grid input[type="number"] {
        width: 45px;
        font-size: 0.875rem;
    }

    .page-title {
        font-size: 1rem;
    }

    /* Smaller horizontal bleed on mobile (matches RMG/PCI); padding still equals |margin|. */
    .page-title-box {
        padding-left: 10px;
        padding-right: 10px;
        margin-left: -10px;
        margin-right: -10px;
    }
}

/* Sidebar logo: show only the full wordmark (logo-lg) when the sidebar is expanded,
   and only the small icon (logo-sm) when it is collapsed (.enlarged). The base theme
   scopes the logo-sm hide inside a media query, so both were showing on desktop. */
.logo-box .logo span.logo-lg {
    display: flex !important;
}
.logo-box .logo span.logo-sm {
    display: none !important;
}
.enlarged .logo-box .logo span.logo-lg {
    display: none !important;
}
.enlarged .logo-box .logo span.logo-sm {
    display: flex !important;
}

/* Keep the sidebar title ("MEYER TECH BUSINESS PORTAL") on a single line. */
#sidebar-menu .menu-title {
    white-space: nowrap;
    font-size: 0.625rem;
    letter-spacing: 0;
    padding-left: 16px;
    padding-right: 8px;
}

/* ===== DataGrid styling (from RMG/PCI canonical) ===== */

.edit-column, .delete-column {
    width: 39px;
}

/* GRID STYLES */
div.DataGrid > table {
    border-left: 1px solid #d9d9d9;
    border-right: 1px solid #d9d9d9;
    border-bottom: 1px solid #d9d9d9;
    width: 100%;
}

    div.DataGrid > table > thead > tr,
    div.DataGrid > table > thead > tr > td > a {
        color: #495057;
        background-color: #f8f9fa;
        border-color: #e9ecef;
        border-bottom: 2px solid #e9ecef;
    }

    /* UI.Grid (>= .127) renders sortable column headers as a
       <button class="grid-sort-button"> instead of an <a> (for a11y:
       role="columnheader" / aria-sort). The old "thead td > a" styling no
       longer matches, so the buttons fall back to native chrome (a 2px outset
       border box). Reset them to read as plain, left-aligned header text. */
    .DataGrid .grid-sort-button {
        padding: 0;
        border: 0;
        background: transparent;
        font: inherit;
        color: #495057;
        cursor: pointer;
        text-align: inherit;
    }

        .DataGrid .grid-sort-button:hover {
            text-decoration: underline;
        }

.DataGrid > table > thead > tr > td,
.DataGrid > table > tbody > tr > td {
    position: relative;
}

.DataGrid.Editable > table > thead > tr > td {
    padding: 0.55rem 0.15rem;
}

.DataGrid.Editable > table > thead > tr.header-edit > td {
    background-color: #d4edda;
    padding: 0.18rem !important;
}

.DataGrid.Editable > table > thead > tr.header-edit > td,
.DataGrid.Editable > table > tbody > tr.edit-mode > td {
    vertical-align: middle;
    padding: 0 0.15rem;
}

    .DataGrid.Editable > table > thead > tr.header-edit > td > .form-control.ts-wrapper,
    .DataGrid.Editable > table > tbody > tr.edit-mode > td > .form-control.ts-wrapper {
        margin-top: 5px;
    }

        .DataGrid.Editable > table > thead > tr.header-edit > td > .form-control.ts-wrapper > .ts-control,
        .DataGrid.Editable > table > tbody > tr.edit-mode > td > .form-control.ts-wrapper > .ts-control {
            padding-top: 6px;
            padding-bottom: 6px;
        }

    .DataGrid.Editable > table > thead > tr.header-edit > td > .field-caret,
    .DataGrid.Editable > table > tbody > tr.edit-mode > td > .field-caret {
        position: absolute;
        top: 20%;
        right: 8px;
    }

        .DataGrid.Editable > table > thead > tr.header-edit > td > .field-caret > svg,
        .DataGrid.Editable > table > tbody > tr.edit-mode > td > .field-caret > svg {
            vertical-align: bottom;
        }

.DataGrid > table > thead > tr > td > .button-container,
.DataGrid > table > tbody > tr > td > .button-container {
    position: absolute;
    top: -22px;
    right: 8px;
    margin-top: 0;
}

    .DataGrid > table > thead > tr > td > .button-container > button,
    .DataGrid > table > tbody > tr > td > .button-container > button {
        height: 27px;
        width: 27px;
        font-size: 11px;
        margin-right: 2px;
        border: 1px #ccc solid;
        opacity: 0.75;
    }

div.DataGrid > table > tfoot > tr {
    background-color: #ddd;
    border-left: #ccc 1px solid;
    border-right: #ccc 1px solid;
    border-top: #ccc 1px solid;
    border-bottom: #ccc 1px solid;
}

    div.DataGrid > table > tfoot > tr > td {
        padding: 5px 5px;
        text-align: right;
        font-weight: bold;
        color: #696969;
    }

div.GridPager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

div.GridPager > span {
    display: inline-block;
    text-align: left;
}

    div.GridPager > span > span {
        float: left;
        line-height: 32px;
    }

        div.GridPager > span > span.row-count {
            padding-left: 10px;
            vertical-align: middle;
            line-height: 32px;
        }

div.GridPager > nav {
    margin-left: auto;
}

/* Pin the grid pager to the horizontal scroll viewport. The .DataGrid container
   is the horizontal scroll element, and the framework renders .GridPager as a
   block child of it — so by default the pager is anchored at the table's content
   origin (content-space left:0) and slides leftward, "floating" mid-grid, as the
   user scrolls right. A block child of an overflow-x:auto box is only as wide as
   the viewport (not the scroll width), so sticky left:0 keeps the pager's left
   edge at the scrollport: the right-aligned nav stays pinned right and the
   row-count stays left, at any horizontal scroll position. Harmless (no-op) for
   grids that don't scroll horizontally. */
.DataGrid > div.GridPager {
    position: sticky;
    left: 0;
}

.DataGrid {
    margin-top: 20px;
}

.DataGrid .btn-link {
    font-family: Verdana, Helvetica, sans-serif;
    background-color: transparent;
    margin: 0 !important;
    padding: 0 !important;
    border-width: 0 !important;
}

    .DataGrid .btn-link.disabled {
        color: #A9A9A9;
        margin-top: -3px !important;
    }

.DataGrid > table > tbody > tr > td.icon-column {
    width: 25px;
    padding-left: 7px;
    padding-right: 7px;
}

/* --- Mobile foundation: grid rules (<= 767.98px) --------------------------- */
@media (max-width: 767.98px) {

    /* Server-rendered wide tables scroll inside their own box, not the page. */
    .DataGrid.table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Per-row grid action buttons (edit/delete/print) — were 27x27 @ 11px */
    .DataGrid > table > thead > tr > td > .button-container > button,
    .DataGrid > table > tbody > tr > td > .button-container > button {
        width: 40px !important;
        height: 40px !important;
        font-size: 15px !important;
    }

    /* Per-row action icon links (edit / delete / info) */
    .DataGrid td.icon-column a,
    .DataGrid td.edit-column a,
    .DataGrid td.delete-column a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        min-height: 40px;
    }

    /* Grid pager links */
    .GridPager .page-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        min-height: 40px;
        padding: 0.4rem 0.6rem;
    }

    /* Empty/colspan message rows ("No rows to display.", loading) inherit the
       card value alignment (right); center them across the card. */
    .mt-grid-responsive tbody td[colspan] {
        text-align: center !important;
        justify-content: center !important;
    }

    /* Hide the grid's own outer frame once it has collapsed into cards — the
       per-card borders are the only frame wanted in card view. */
    .DataGrid.mt-grid-responsive > table {
        border: 0 !important;
    }

    /* Tighten the dead space around a card-collapsed grid. */
    .card-body:has(.mt-grid-responsive) {
        padding: 0.5rem;
    }

    .DataGrid.mt-grid-responsive {
        margin-top: 0;
    }

        .DataGrid.mt-grid-responsive > table {
            margin-bottom: 0;
        }

    /* Drop the last card's bottom margin so the stack is flush. */
    .mt-grid-responsive tbody tr:last-child {
        margin-bottom: 0;
    }

    /* Restore a gap above the pager after the last card is zeroed. */
    .mt-grid-responsive .GridPager {
        margin-top: 0.75rem;
    }
}

/* ==========================================================================
   GRID TOTALS FOOTER IN CARD VIEW
   Present the <tfoot> totals row as one compact, bold, right-aligned totals
   line: hide the empty colspan spacer cells, drop the data-label gutter, and
   set off the row with a top border so the totals stay visible but tidy.
   ========================================================================== */
@container (max-width: 600px) {
    .mt-grid-responsive tfoot {
        display: block;
    }

    .mt-grid-responsive tfoot tr {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        align-items: baseline;
        gap: 0.25rem 0.75rem;
        margin-top: 0.25rem;
        padding: 0.5rem 0.75rem;
        border-top: 2px solid var(--mt-grid-card-border, #dee2e6);
        font-weight: 600;
    }

    .mt-grid-responsive tfoot td {
        display: inline-block;
        min-height: 0;
        padding: 0;
        border: 0;
        text-align: right;
    }

        /* Empty alignment spacers (they carry colspan). */
        .mt-grid-responsive tfoot td[colspan] {
            display: none;
        }

        .mt-grid-responsive tfoot td::before {
            content: none;
        }
}

/* ==========================================================================
   GRID CARD CELL LAYOUT FIXES (card view)
   Corrects per-column width caps, frozen-column side borders, and the
   selection-checkbox / action-button cell placement once a grid collapses to
   cards. Generic framework fixes.
   ========================================================================== */
@container (max-width: 600px) {
    .mt-grid-responsive tbody td {
        max-width: none !important;
    }

    /* Frozen/sticky columns carry a vertical border-right for the freeze
       boundary in table view; strip side borders in card view. */
    .DataGrid.mt-grid-responsive tbody td {
        border-left: 0 !important;
        border-right: 0 !important;
    }

    /* Selection checkbox -> card top-left; action buttons stay top-right. */
    .mt-grid-responsive tbody td:not([data-label]):has(input[type='checkbox']),
    .mt-grid-responsive tbody td[data-label='']:has(input[type='checkbox']) {
        order: -1;
        flex: 0 0 auto;
        width: auto;
        min-height: 0;
        margin-right: auto;
        padding: 0.25rem 0.5rem;
        border-bottom: 0;
        justify-content: flex-start;
    }

    /* Action-button cell (edit/delete icon link): give the cell room to contain
       the 40px touch target and pin it to the card's right. */
    .DataGrid.mt-grid-responsive tbody td:not([data-label]):has(a, button),
    .DataGrid.mt-grid-responsive tbody td[data-label='']:has(a, button) {
        min-width: 2.75rem;
        justify-content: flex-end;
        padding-right: 0.75rem;
    }
}

/* Keep inline-edit grids tabular (don't collapse to cards while editing). */
.DataGrid.mt-grid-responsive.edit-mode-active {
    container-type: normal;
}

/* Cards only render at <= 600px, so only establish the size-query container
   there; at wider widths drop containment so sticky columns/header paint
   cleanly. */
@media (min-width: 601px) {
    .DataGrid.mt-grid-responsive {
        container-type: normal;
    }
}

/* Hide the grid's edit-mode header row from first paint in read-only so there
   is no duplicate-header flash; the JS shows it in edit mode. */
.DataGrid:not(.edit-mode-active) thead tr.header-edit {
    display: none;
}
