﻿@media (min-width: 992px) {
    .dropdown:not(.dropdown-hover) .dropdown-menu {
        margin-top: 40px !important;
    }
}

@media (min-width: 992px) {
    :not(.main-content) .navbar .dropdown .dropdown-menu {
        top: 0.5rem !important;
    }
}

/* Default button width */
.btn {
    min-width: 120px;
}

.card {
    box-shadow: 0 20px 27px 0 rgba(0, 0, 0, 0.05);
    border: 0;
}

/* Fix excessive spacing for horizontal HR in cards - Argon Dashboard v2.1.0 */
.card hr.horizontal {
    margin-top: 0.50rem !important;
    margin-bottom: 0.50rem !important;
    opacity: 0.5;
}

/* Reduce card-header bottom padding to work better with HR */
.card .card-header {
    padding-bottom: 0.50rem !important;
}

/* Adjust card-body top padding when preceded by HR */
.card hr.horizontal + .card-body {
    padding-top: 1rem !important;
}

/* Sidebar flush to left edge, full height.
   No min-height: Argon already pins the aside with top/bottom, and 100vh overshoots the visible area on mobile
   browsers (it ignores the address bar), which pushed the user block below the fold. */
.sidenav.fixed-start {
    margin: 0 !important;
    border-radius: 0 !important;
    border-right: 1px solid #e9ecef;
    /* Column layout is what lets the user block claim the bottom with mt-auto. Turning the axis also turns
       .navbar's own align-items/justify-content, so both are restated for the vertical direction. */
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
    /* Chrome on Android pins fixed elements to the layout viewport, which runs behind the address bar, so
       Argon's top/bottom anchoring overshoots the visible area and buries the user block. dvh tracks the
       viewport that is actually on screen; vh stays as the fallback for browsers without dvh. */
    height: 100vh;
    height: 100dvh;
}

/* Argon hard-codes the menu to calc(100vh - 360px), sized for the promo footer its template shipped with.
   Letting it share the column instead keeps the user block on screen: the menu scrolls, the aside does not. */
.sidenav.fixed-start .navbar-collapse {
    height: auto !important;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.sidenav-user .nav-link {
    cursor: pointer;
}

/* Brand name in the same grey as the menu items (Argon defaults it to #344767) */
.sidenav .navbar-brand {
    color: #67748e;
}

/* Adjust main-content left margin to match sidebar width without ms-4 gap */
@media (min-width: 1200px) {
    .sidenav.fixed-start + .main-content {
        margin-left: 15.625rem !important;
    }
}

/* Principal layout */
.main-content {
    flex: 1;
}

/* Footer */
.footer {
    background-color: #fff;
    border-top: 1px solid #e9ecef;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .footer * {
        margin: 0 !important;
        padding: 0 !important;
    }

    .footer .container-fluid {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        padding: 0 15px !important;
    }

    .footer .copyright {
        font-size: 0.75rem;
        text-align: center;
        color: #6c757d;
        white-space: nowrap;
    }

/* Mobile: smaller footer text */
@media (max-width: 767.98px) {
    .footer .container-fluid {
        padding: 0 10px !important;
    }

    .footer .copyright {
        font-size: 0.7rem;
    }
}

/* Valid and invalid input colors */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

hr.horizontal.solid {
    background-image: none !important;
    border-top: 1px solid rgba(0,0,0,.25);
    height: 0;
}

/* Skeleton loading placeholder with shimmer effect */
.image-skeleton {
    aspect-ratio: 3 / 4;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Page header bar: the heading keeps a comfortable basis so the actions only drop
   to their own line once the title and description would otherwise be squeezed. */
.page-header-heading {
    flex: 1 1 20rem;
    min-width: 0;
}

.page-header-actions {
    flex: 0 1 auto;
}

/* Round back arrow next to the title: navigating back must not look like a page action. */
.btn-back-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 50%;
    font-size: 0.875rem;
    line-height: 1;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    transition: background 0.15s ease;
}

.btn-back-icon:hover,
.btn-back-icon:focus-visible {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Theater favicon above the login: square, and a favicon with its own margins keeps its proportions */
.tenant-brand-icon {
    width: 3rem;
    height: 3rem;
    object-fit: contain;
}

/* Tables as stacked cards on phones. Opt in with .table-mobile-cards on the <table> and a data-label on each <td>;
   .cell-card-title is the card title, .cell-card-headline the value shown next to it, and a <td> with neither spans
   the card without a label (action buttons, empty-state rows). The !important declarations beat the Bootstrap
   utilities (text-center, ps-4, pt-0) and the inline widths that the cells carry for the desktop layout. */
@media (max-width: 767.98px) {
    table.table-mobile-cards,
    table.table-mobile-cards > tbody,
    table.table-mobile-cards > tfoot {
        display: block;
        width: 100%;
        min-width: 0;
    }

    /* Bootstrap draws a line above every table section but the first (".table > :not(:first-child)"). */
    table.table-mobile-cards > :not(:first-child) {
        border-top: 0;
    }

    /* For tables that sit flush against their card (card-body px-0), so the cards do not touch its edges. */
    table.table-mobile-cards.table-mobile-cards-inset {
        padding: 0 1rem;
    }

    table.table-mobile-cards > thead {
        display: none;
    }

    /* The headline and the chevron of clickable rows take the second and third columns, which collapse when unused. */
    table.table-mobile-cards > tbody > tr,
    table.table-mobile-cards > tfoot > tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        margin-bottom: 0.75rem;
        padding: 0.5rem 1rem;
        border: 1px solid #e9ecef;
        border-radius: 0.5rem;
        background-color: #fff;
    }

    /* flow-root keeps the floated label inside the cell. */
    table.table-mobile-cards > tbody > tr > td,
    table.table-mobile-cards > tfoot > tr > td {
        display: flow-root;
        grid-column: 1 / -1;
        width: auto !important;
        max-width: none !important;
        padding: 0.3rem 0 !important;
        border: 0;
        background: none;
        box-shadow: none;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* The label floats instead of using flex so that cells with two lines (name and date, amount and count) keep
       their lines stacked on the right. */
    table.table-mobile-cards > tbody > tr > td[data-label],
    table.table-mobile-cards > tfoot > tr > td[data-label] {
        text-align: right !important;
    }

    /* A value that does not fit stays on one line and ends in an ellipsis (long emails, comments, codes), whether its
       text sits in the cell itself or in a block inside it, such as the <p> most reports wrap their values in. */
    table.table-mobile-cards > tbody > tr > td[data-label],
    table.table-mobile-cards > tfoot > tr > td[data-label],
    table.table-mobile-cards td[data-label] > :is(p, div, .d-block):not(.form-check, .input-group, .d-flex) {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    /* Cells with form controls keep overflow visible, or the focus ring of a full-width input would be clipped. */
    table.table-mobile-cards > tbody > tr > td[data-label]:has(input, select, textarea) {
        overflow: visible;
    }

    table.table-mobile-cards td[data-label]::before {
        content: attr(data-label);
        float: left;
        margin-right: 1rem;
        font-size: 0.75rem;
        font-weight: 600;
        line-height: 1.5rem;
        color: #8392ab;
        text-align: left;
    }

    /* A block .form-check would sit on the left against the label; inline-block lets it follow the right alignment. */
    table.table-mobile-cards td[data-label] > .form-check {
        display: inline-block;
    }

    /* Only the placeholder cells without a label disappear, such as the blanks of a totals row. A labeled cell without a
       value keeps its line, so every card lists the same fields, as the columns of the desktop table do. */
    table.table-mobile-cards td:empty:not([data-label]) {
        display: none;
    }

    table.table-mobile-cards td.cell-card-title,
    table.table-mobile-cards td.cell-card-headline {
        grid-row: 1;
        font-weight: 600;
        color: #344767;
    }

    /* Same weight as the data-label rule above, so the title stays on the left when it also carries a label. */
    table.table-mobile-cards > tbody > tr > td.cell-card-title,
    table.table-mobile-cards > tfoot > tr > td.cell-card-title {
        grid-column: 1;
        text-align: left !important;
    }

    table.table-mobile-cards > tbody > tr > td.cell-card-headline,
    table.table-mobile-cards > tfoot > tr > td.cell-card-headline {
        grid-column: 2;
        padding-left: 1rem !important;
        text-align: right !important;
    }

    table.table-mobile-cards td.cell-card-title::before,
    table.table-mobile-cards td.cell-card-headline::before {
        content: none;
    }

    /* One rule under the title row: the title, the headline and the chevron share the same bottom border. The full
       path outranks Argon's ".table tbody tr:last-child td { border-width: 0 }", which would drop it on the last card. */
    table.table-mobile-cards > tbody > tr > td.cell-card-title,
    table.table-mobile-cards > tbody > tr > td.cell-card-headline,
    table.table-mobile-cards > tfoot > tr > td.cell-card-title,
    table.table-mobile-cards > tfoot > tr > td.cell-card-headline,
    table.table-mobile-cards > tbody > tr.row-card-clickable::after {
        margin-bottom: 0.25rem;
        border-bottom: 1px solid #e9ecef;
    }

    table.table-mobile-cards > tbody > tr.row-card-clickable {
        cursor: pointer;
    }

    table.table-mobile-cards > tbody > tr.row-card-clickable::after {
        content: "\203A";
        grid-column: 3;
        grid-row: 1;
        display: flex;
        align-items: center;
        padding-left: 0.75rem;
        font-size: 1.25rem;
        line-height: 1;
        color: #8392ab;
    }

    /* Some total rows carry an inline top border that separates them from the rows above on desktop. */
    table.table-mobile-cards > tfoot > tr,
    table.table-mobile-cards > tbody > tr.row-card-total {
        border-color: transparent !important;
        background-color: #f6f8fc;
    }

    table.table-mobile-cards > tfoot > tr > td,
    table.table-mobile-cards > tbody > tr.row-card-total > td {
        font-weight: 600;
        color: #344767;
    }
}
