/*-----------------------------------------------------------------------------
 Archivo: app.css
 Proposito: Estilos globales base para la app multi-tenant HMLR.
-----------------------------------------------------------------------------*/

:root {
    --hmlr-primary: #0d6efd;
    --hmlr-sidebar-bg: #102033;
    --hmlr-sidebar-text: #dbe7f3;
    --hmlr-sidebar-active: #ffffff;
    --hmlr-body-bg: #f5f7fb;
    --hmlr-border: #dee2e6;
    --hmlr-focus-ring: #ffbf47;
    --hmlr-sidebar-width: 270px;
    --hmlr-content-gutter: clamp(0.75rem, 2vw, 1.5rem);
}

html,
body {
    min-height: 100%;
    background: var(--hmlr-body-bg);
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 0.18rem solid var(--hmlr-focus-ring);
    outline-offset: 0.16rem;
    box-shadow: 0 0 0 0.22rem rgba(255, 191, 71, 0.22);
}

.page {
    display: flex;
    min-height: 100vh;
    background: var(--hmlr-body-bg);
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1100;
    transform: translateY(-150%);
    border-radius: 0.65rem;
    padding: 0.65rem 0.9rem;
    color: #ffffff;
    background: #0b5ed7;
    box-shadow: 0 0.75rem 1.5rem rgba(16, 32, 51, 0.2);
    transition: transform 0.15s ease-in-out;
}

    .skip-link:focus {
        transform: translateY(0);
        outline: 0.2rem solid rgba(13, 110, 253, 0.35);
        outline-offset: 0.15rem;
    }

.tenant-shell {
    position: relative;
}

.shell-mobile-header {
    display: none;
}

.shell-menu-toggle,
.shell-menu-close {
    min-height: 2.75rem;
    align-items: center;
    gap: 0.35rem;
}

.shell-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem;
}

.shell-menu-close {
    display: none;
    flex: 0 0 auto;
}

.shell-backdrop {
    display: none;
}

.sidebar {
    width: var(--hmlr-sidebar-width);
    flex: 0 0 var(--hmlr-sidebar-width);
    min-height: 100vh;
    color: var(--hmlr-sidebar-text);
    background: var(--hmlr-sidebar-bg);
    position: sticky;
    top: 0;
    align-self: flex-start;
    z-index: 1020;
}

    .sidebar .nav {
        padding: 1rem 0.75rem;
    }

    .sidebar .nav-link {
        color: var(--hmlr-sidebar-text);
        border-radius: 0.5rem;
        margin-bottom: 0.25rem;
        padding: 0.65rem 0.75rem;
    }

        .sidebar .nav-link:hover {
            color: var(--hmlr-sidebar-active);
            background: rgba(255, 255, 255, 0.08);
        }

        .sidebar .nav-link.active {
            color: var(--hmlr-sidebar-active);
            background: rgba(255, 255, 255, 0.16);
            font-weight: 600;
        }

    .sidebar .material-icons,
    .sidebar .material-symbols-outlined {
        font-size: 1.25rem;
    }

main {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.card {
    border-color: var(--hmlr-border);
}

.btn .material-icons,
.btn .material-symbols-outlined,
.nav-link .material-icons,
.nav-link .material-symbols-outlined {
    vertical-align: middle;
}

.hmlr-material-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}

.content .container,
.content .container-fluid {
    max-width: 100%;
}

.content .card,
.content .alert,
.content form {
    min-width: 0;
}

.content .table-responsive {
    border-radius: 0.85rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.content .hmlr-responsive-table {
    max-width: 100%;
    min-width: 0;
}

.content .hmlr-responsive-table__viewport {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.content .table {
    margin-bottom: 0;
    vertical-align: middle;
}

.content .table th {
    white-space: nowrap;
}

.content .table td {
    overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
    .tenant-shell {
        display: block;
        min-height: 100dvh;
    }

    .shell-mobile-header {
        position: sticky;
        top: 0;
        z-index: 1030;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        min-height: 4.25rem;
        padding: 0.75rem var(--hmlr-content-gutter);
        color: var(--hmlr-sidebar-active);
        background: var(--hmlr-sidebar-bg);
        box-shadow: 0 0.5rem 1.2rem rgba(16, 32, 51, 0.16);
    }

        .shell-mobile-header > div {
            min-width: 0;
        }

        .shell-mobile-header strong,
        .shell-mobile-header span {
            display: block;
        }

        .shell-mobile-header span {
            max-width: 13rem;
            overflow: hidden;
            color: rgba(255, 255, 255, 0.72);
            font-size: 0.8rem;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

    .shell-menu-toggle {
        display: inline-flex;
        flex: 0 0 auto;
    }

    .shell-menu-close {
        display: inline-flex;
    }

    .shell-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1040;
        display: block;
        border: 0;
        padding: 0;
        background: rgba(16, 32, 51, 0.56);
    }

        .shell-backdrop[hidden] {
            display: none;
        }

    .sidebar.shell-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(88vw, 22rem);
        max-width: calc(100vw - 1rem);
        height: 100dvh;
        min-height: 100dvh;
        transform: translateX(-105%);
        visibility: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        pointer-events: none;
        box-shadow: 1rem 0 2rem rgba(16, 32, 51, 0.24);
        transition: transform 0.18s ease-in-out, visibility 0.18s ease-in-out;
        z-index: 1050;
    }

    .sidebar.shell-sidebar.is-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

        .sidebar .nav {
            gap: 0.35rem;
            overflow-x: visible;
            overflow-y: visible;
            scrollbar-width: thin;
            padding: 0.75rem;
        }

        .sidebar .nav-link {
            margin-bottom: 0;
        }

    main {
        width: 100%;
    }

    .shell-main {
        overflow-x: auto;
        overscroll-behavior-x: contain;
    }

    .content {
        padding-left: var(--hmlr-content-gutter) !important;
        padding-right: var(--hmlr-content-gutter) !important;
    }

    .content .row {
        --bs-gutter-x: 0.85rem;
    }

    .content .card-body {
        padding: 1rem;
    }

    .content .d-flex:has(> .btn),
    .content .btn-toolbar,
    .content .btn-group {
        flex-wrap: wrap;
    }

    .content .table {
        min-width: 760px;
        font-size: 0.9rem;
    }

    .content .table-responsive {
        margin-inline: -0.15rem;
        padding-bottom: 0.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .skip-link,
    .sidebar.shell-sidebar {
        transition: none;
    }
}

@media (max-width: 575.98px) {
    .shell-mobile-header {
        gap: 0.5rem;
        padding-inline: 0.75rem;
    }

        .shell-mobile-header span {
            max-width: 9.5rem;
        }

    .shell-menu-toggle {
        padding-inline: 0.65rem;
    }

    .sidebar .border-bottom {
        padding: 0.85rem !important;
    }

        .sidebar .border-bottom h5 {
            font-size: 1rem;
        }

        .sidebar .border-bottom small {
            display: block;
            max-width: 18rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

    .content {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .content h1,
    .content .h1 {
        font-size: 1.65rem;
    }

    .content h2,
    .content .h2 {
        font-size: 1.35rem;
    }

    .content .card-header,
    .content .card-body {
        padding: 0.85rem;
    }

    .content .btn {
        max-width: 100%;
        white-space: normal;
    }

    .content .table {
        min-width: 680px;
        font-size: 0.85rem;
    }
}
