/* Общие компонентные и интеграционные стили.
   Foundation и каркас приложения вынесены в отдельные слои. */

@media (max-width: 768px) {
    nav ul:not(.pagination) {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .btn {
        min-height: var(--quag-control-min-size);
    }
}

/* Глобальный слой для всех Bootstrap-выпадающих меню:
   выше панелей и контента, но ниже модалок и popover. */
.dropdown-menu {
    z-index: 1045 !important;
}

.notifications-offcanvas {
    height: auto !important;
    max-height: 100vh !important;
}

@media (min-width: 576px) {
    .notifications-offcanvas {
        left: auto !important;
        width: min(560px, 50vw);
    }
}

.bi-star-fill {
    color: #ffc107;
}

.table-striped {
    --bs-table-striped-bg: rgba(0, 0, 0, 0.12);
}

.select2-container--bootstrap-5 .select2-results__option[aria-selected="true"]:not(.select2-results__option--highlighted) {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--bs-primary) !important;
    color: var(--bs-white) !important;
}

.select2-container--bootstrap-5 .select2-dropdown {
    z-index: 1060 !important;
    border: 1px solid var(--bs-primary, #0d6efd) !important;
    border-radius: 0.5rem !important;
    background-color: #e3f0ff !important;
    box-shadow: 0 12px 48px 0 rgba(13, 110, 253, 0.23), 0 4px 24px 0 rgba(0, 0, 0, 0.32) !important;
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--quag-control-min-size);
    height: var(--quag-control-min-size);
    padding: 0 !important;
    border: none !important;
    border-radius: 0.6rem;
    color: #fff;
    background: transparent !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.back-link i {
    color: inherit;
    font-size: 1.6rem;
    font-weight: bold;
    transition: color 0.15s;
}

.back-link:hover,
.back-link:focus-visible {
    color: #ffc107;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--quag-control-min-size);
    height: var(--quag-control-min-size);
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    font-size: 1.2em;
    font-weight: bold;
    transition: box-shadow 0.1s;
}

.user-avatar:focus-visible,
.user-avatar:hover {
    color: #ffc107 !important;
    filter: brightness(1.12);
    box-shadow: 0 4px 16px rgba(13, 110, 253, 0.14);
}

.header-action {
    display: flex !important;
    align-items: center;
    min-height: var(--quag-control-min-size);
    padding: 0 !important;
    border: none !important;
    color: #ffffff !important;
    background: transparent !important;
    box-shadow: none !important;
    font-weight: normal;
    text-decoration: none !important;
    cursor: pointer;
    opacity: 1 !important;
    transition: color 0.15s;
}

.header-action:hover,
.header-action:focus-visible {
    color: #ffc107 !important;
}

.header-left-controls {
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-menu-toggle,
.notifications-panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--quag-control-min-size);
    height: var(--quag-control-min-size);
}

.header-menu-toggle {
    margin-right: 0 !important;
}

.notifications-panel-toggle {
    color: #fff;
    box-shadow: none !important;
}

.favorite-toast-container {
    z-index: 1056;
}

@media (max-width: 991.98px) {
    .app-header-title {
        display: -webkit-box;
        flex: 1 1 0;
        min-width: 0;
        max-height: calc(1.2em * 3);
        overflow: hidden;
        font-size: 1.2rem;
        line-height: 1.2;
        text-overflow: ellipsis;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
}

.nav-tabs .nav-link.active {
    padding-bottom: 0.2rem !important;
    border-color: transparent !important;
    border-bottom: 4px solid #fd7e14 !important;
    color: #fd7e14 !important;
    background-color: #fff;
    font-weight: bold;
}

.tooltip-inner {
    max-width: 400px !important;
    font-size: 0.98em;
    text-align: left;
    white-space: pre-line;
}

.help-tooltip-btn {
    position: relative;
    display: inline-flex;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    width: var(--quag-control-min-size);
    height: var(--quag-control-min-size);
    padding: 0;
    border: 0;
    color: #6c757d;
    background: transparent;
    font-size: 0.75em;
    font-weight: 400;
    line-height: 1;
    text-align: center;
    cursor: help;
}

.help-tooltip-btn::before {
    position: absolute;
    width: 1.15em;
    height: 1.15em;
    border: 1px solid #bbb;
    border-radius: 50%;
    content: "";
}

.quag-file-preview {
    width: 3.2rem;
    height: 3.2rem;
    margin-right: 1rem;
}

.quag-file-name {
    min-width: 6.25rem;
}

.quag-toast-stack {
    z-index: 1080;
    width: min(25rem, 100vw);
    min-width: min(20rem, 100vw);
}

.params-help-disclosure {
    margin-top: 0.45rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(29, 108, 228, 0.28);
    border-radius: 0.65rem;
    color: #183153;
    background: #eef5ff;
    font-size: 0.84rem;
    font-weight: 400;
    line-height: 1.4;
}

.params-help-disclosure[hidden] {
    display: none !important;
}

.quag-popover {
    max-width: 600px !important;
    border: 2px solid #1d6ce4 !important;
    color: #183153 !important;
    background: #e8f1ff !important;
    box-shadow: 0 8px 24px 0 rgba(40, 91, 185, 0.16);
    font-size: 0.9em;
}

.quag-popover .popover-header {
    border-bottom: 1px solid #1d6ce4 !important;
    border-radius: 0.65em 0.65em 0 0;
    color: #fff !important;
    background: #1d6ce4 !important;
    font-size: 1em;
    font-weight: 600;
}
.quag-popover .popover-body {
    padding: 1em 1.2em;
}

.quag-popover .popover-arrow::before,
.quag-popover .popover-arrow::after {
    border-right-color: #1d6ce4 !important;
    border-left-color: #1d6ce4 !important;
    border-top-color: #1d6ce4 !important;
    border-bottom-color: #1d6ce4 !important;
}