/* Global responsive layer for the admin panel. Loaded last so it can normalize page-specific CSS. */
:root {
    --admin-header-height: var(--header-height, 80px);
    --admin-sidebar-width: 250px;
    --admin-content-gutter: clamp(0.75rem, 1.6vw, 1.5rem);
    --admin-control-height: 2.45rem;
}

html {
    font-size: 16px;
}

body {
    min-width: 320px;
    overflow-x: hidden;
    background: #f6f8fb;
}

.content {
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.content > .container-fluid {
    width: 100%;
    max-width: 2300px;
    margin-inline: auto;
    padding-inline: var(--admin-content-gutter);
}

.content .container,
.content .container-fluid {
    min-width: 0;
}

.content [style*="width: 1600px"],
.content [style*="width:1600px"],
.content [style*="max-width: 1600px"],
.content [style*="max-width:1600px"],
.content [style*="max-width: 1800px"],
.content [style*="max-width:1800px"],
.content [style*="max-width: 100%; overflow-x:hidden"],
.content [style*="max-width:100%; overflow-x:hidden"] {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
}

.content img,
.content svg,
.content canvas,
.content video {
    max-width: 100%;
}

.content .row {
    row-gap: 1rem;
}

.content .card,
.content .modal-content,
.content .dropdown-menu {
    max-width: 100%;
}

.content .card-body,
.content .modal-body {
    min-width: 0;
}

.content h1,
.content .h1 {
    font-size: clamp(1.75rem, 2.6vw, 2.55rem);
    line-height: 1.15;
}

.content h2,
.content .h2 {
    font-size: clamp(1.35rem, 2vw, 2rem);
}

.content h3,
.content .h3 {
    font-size: clamp(1.15rem, 1.5vw, 1.55rem);
}

.content .form-control,
.content .form-select,
.content .btn {
    min-height: var(--admin-control-height);
}

.content .btn {
    white-space: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.content .btn i,
.content .btn .fa,
.content .btn .fas,
.content .btn .bi {
    flex: 0 0 auto;
}

.content .table-responsive,
.content .dataTables_wrapper,
.content .table-container,
.content .grid-scroll,
.content .scroll-table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.content table {
    max-width: 100%;
}

.content .container > table,
.content .container-fluid > table,
.content form > table,
.content .card-body > table,
.content div > table {
    display: table;
}

.content table th,
.content table td {
    vertical-align: middle;
}

.content .table-responsive > table,
.content .dataTables_wrapper table,
.content .table-container table,
.content table.table {
    min-width: max-content;
}

.content .nav-tabs,
.content .nav-pills,
.content .action-bar,
.content .filter-actions,
.content .toolbar,
.content .page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    min-width: 0;
}

.content .nav-tabs,
.content .nav-pills {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.content .nav-tabs .nav-link,
.content .nav-pills .nav-link {
    white-space: nowrap;
}

.content .dropdown-menu {
    max-width: min(92vw, 28rem);
    overflow-wrap: anywhere;
}

header.navbar {
    min-height: var(--admin-header-height) !important;
}

.navbar-brand img {
    max-height: clamp(3rem, 6vw, 4.4rem);
    width: auto;
}

.profile-name {
    max-width: clamp(4.5rem, 10vw, 8.5rem);
}

@media (min-width: 1920px) {
    html {
        font-size: 16.5px;
    }

    .content > .container-fluid {
        max-width: 2440px;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    :root {
        --admin-sidebar-width: 220px;
    }

    html {
        font-size: 15px;
    }

    #sidebar.sidebar,
    .sidebar {
        width: var(--admin-sidebar-width) !important;
    }

    .content,
    .sidebar ~ .content {
        margin-left: var(--admin-sidebar-width) !important;
    }

    .sidebar .nav-link {
        font-size: 0.9rem;
        padding-inline: 0.8rem;
    }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
    html {
        font-size: 15.5px;
    }
}

@media (max-width: 991.98px) {
    html {
        font-size: 14.5px;
    }

    body {
        background: #f7f9fc;
    }

    .content,
    .sidebar ~ .content {
        margin-left: 0 !important;
        padding-top: var(--admin-header-height) !important;
    }

    .content.flex-grow-1.p-3 {
        padding: 0.85rem !important;
        padding-top: calc(var(--admin-header-height) + 0.85rem) !important;
    }

    .content > .container-fluid {
        padding-inline: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #sidebar.sidebar {
        width: min(88vw, 340px) !important;
        right: auto !important;
        box-shadow: 18px 0 44px rgba(15, 23, 42, 0.22);
    }

    .sidebar .nav-link {
        min-height: 2.75rem;
    }

    .profile-name {
        display: none;
    }

    .profile-menu-wrapper {
        padding: 0.25rem;
    }

    .profile-avatar {
        width: 34px;
        height: 34px;
        margin-right: 0;
    }

    .notif-trigger-icon-wrap {
        width: 34px;
        height: 34px;
    }

    .notif-dropdown,
    .profile-dropdown-menu {
        max-width: calc(100vw - 1rem);
    }

    .content [style*="height: 600px"],
    .content [style*="height:600px"],
    .content [style*="height: 500px"],
    .content [style*="height:500px"] {
        height: min(58vh, 420px) !important;
    }

    .content [style*="max-height: 600px"],
    .content [style*="max-height:600px"] {
        max-height: min(58vh, 420px) !important;
    }
}

@media (max-width: 767.98px) {
    html {
        font-size: 14px;
    }

    :root {
        --admin-control-height: 2.35rem;
    }

    header.navbar {
        min-height: 64px !important;
    }

    .content,
    .sidebar ~ .content {
        padding-top: 64px !important;
    }

    .content.flex-grow-1.p-3 {
        padding: 0.65rem !important;
        padding-top: calc(64px + 0.65rem) !important;
    }

    .navbar-brand img {
        max-height: 3.1rem;
    }

    .content .card-body,
    .content .modal-body {
        padding: 0.9rem;
    }

    .content .btn {
        padding-inline: 0.75rem;
    }

    .content table th,
    .content table td {
        padding: 0.55rem;
    }

    .content table {
        font-size: 0.9rem;
    }

    .content [style*="height: 450px"],
    .content [style*="height:450px"],
    .content [style*="height: 420px"],
    .content [style*="height:420px"] {
        height: min(54vh, 360px) !important;
    }
}

@media (max-width: 575.98px) {
    html {
        font-size: 13.5px;
    }

    .content h1,
    .content .h1 {
        font-size: 1.65rem;
    }

    .content .row {
        row-gap: 0.75rem;
    }

    .content .btn,
    .content .form-control,
    .content .form-select {
        width: 100%;
    }

    .content .btn.btn-sm {
        width: auto;
        min-width: 2.35rem;
    }

    .content .d-flex:not(.navbar .d-flex):not(.sidebar .d-flex) {
        flex-wrap: wrap;
    }

    .content .modal-dialog {
        margin: 0.5rem;
    }
}

@media (max-width: 400px) {
    html {
        font-size: 13px;
    }

    .navbar-brand img {
        max-height: 2.65rem;
    }

    .notif-trigger-icon-wrap,
    .profile-avatar {
        width: 30px;
        height: 30px;
    }
}
