/*
 * Estilo da listagem de notificações (padronizado com o componente
 * equivalente do Central de Recursos de Sistemas). Todas as regras ficam
 * aninhadas sob #dropdown-notifications de propósito: várias páginas do
 * acgovbr ainda carregam versões antigas de CSS que redefinem classes
 * genéricas como .badge, .list-group-item e .scrollable-container, então
 * um seletor mais específico evita que essas folhas antigas sobrescrevam
 * (ou sejam sobrescritas) sem depender de !important.
 */

#dropdown-notifications {
    position: relative;
}

#dropdown-notifications .dropdown-menu {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    overflow: hidden;
}

#dropdown-notifications .dropdown-menu-header {
    background-color: #fff;
}

#dropdown-notifications .dropdown-header {
    padding: 12px 16px;
}

#dropdown-notifications .list-group {
    margin: 0;
    padding: 0;
}

#dropdown-notifications .list-group-item {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    padding: 12px 16px;
}

#dropdown-notifications .list-group-item:last-child {
    border-bottom: 0;
}

#dropdown-notifications .dropdown-notifications-item a {
    color: inherit;
    text-decoration: none;
}

#dropdown-notifications .notificacoes {
    position: relative;
    display: inline-flex;
    align-items: center;
}

#dropdown-notifications .badge-notificacao {
    display: none;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    border-radius: 50%;
    position: absolute;
    top: -4px;
    right: -4px;
    z-index: 2;
    background-color: #dc3545;
    color: #fff;
}

.badge-notificacao.rounded-pill-notificacao {
    border-radius: 50rem;
}

.text-bg-danger-notificacao {
    color: #fff;
    background-color: #dc3545;
}

.text-bg-danger-notificacao:hover {
    background-color: #bb2d3b;
}

#dropdown-notifications .scrollable-container {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scrollbar-color: #ededed transparent;
    scrollbar-width: thin;
}

#dropdown-notifications .scrollable-container .ps__rail-y {
    z-index: 999;
    opacity: 1;
    display: block;
}

#dropdown-notifications .scrollable-container::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

#dropdown-notifications .scrollable-container::-webkit-scrollbar-thumb {
    background-color: #f6f6f6;
    border-radius: 4px;
}

#dropdown-notifications .scrollable-container::-webkit-scrollbar-track {
    background: transparent;
}

#dropdown-notifications .dropdown-notifications-item {
    cursor: pointer;
}

#dropdown-notifications .dropdown-notifications-item h6 {
    line-height: 1.35;
}

#dropdown-notifications .dropdown-notifications-item.marked-as-read {
    cursor: default;
}

#dropdown-notifications .dropdown-notifications-item.opacity-50 {
    opacity: 0.5;
}

#dropdown-notifications .notification-loading {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
    min-height: 132px;
    text-align: center;
}

#dropdown-notifications .notification-loading-more {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.75rem 0;
}

#dropdown-notifications .badge-noticacao {
    animation: central-notificacoes-blink 5s infinite ease-in-out;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    height: 8px;
    margin-right: 0.5rem;
    min-height: 8px;
    min-width: 8px;
    width: 8px;
}

#dropdown-notifications .badge-noticacao.bg-primary { background-color: #0d6efd; }
#dropdown-notifications .badge-noticacao.bg-secondary { background-color: #6c757d; }
#dropdown-notifications .badge-noticacao.bg-success { background-color: #198754; }
#dropdown-notifications .badge-noticacao.bg-danger { background-color: #dc3545; }
#dropdown-notifications .badge-noticacao.bg-warning { background-color: #ffc107; }
#dropdown-notifications .badge-noticacao.bg-info { background-color: #0dcaf0; }
#dropdown-notifications .badge-noticacao.bg-light { background-color: #f8f9fa; }
#dropdown-notifications .badge-noticacao.bg-dark { background-color: #212529; }

@keyframes central-notificacoes-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

/*
 * Toast de notificação em tempo real (equivalente ao ToastContainer.vue
 * do Central de Recursos de Sistemas).
 */

.central-toast-container {
    z-index: 1095;
}

.central-toast {
    border: 0;
    box-shadow: 0 12px 32px rgba(20, 32, 51, 0.18);
    overflow: hidden;
    width: min(360px, calc(100vw - 24px));
}

.central-toast .toast-header {
    border-bottom-color: #e8eef5;
    min-height: 44px;
}

.central-toast .toast-header .central-toast-title {
    color: #142033;
    font-weight: 800;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.central-toast .toast-header small {
    color: #647286;
    margin-left: 8px;
    white-space: nowrap;
}

.central-toast-icon {
    align-items: center;
    border-radius: 6px;
    color: #fff;
    display: inline-flex;
    height: 24px;
    justify-content: center;
    margin-right: 8px;
    min-width: 24px;
    width: 24px;
}

.central-toast-icon.central-toast-primary,
.central-toast-icon.central-toast-info {
    background: #0d6efd;
}

.central-toast-icon.central-toast-success {
    background: #198754;
}

.central-toast-icon.central-toast-danger {
    background: #dc3545;
}

.central-toast-icon.central-toast-warning {
    background: #f0ad00;
}

.central-toast-icon.central-toast-secondary,
.central-toast-icon.central-toast-light,
.central-toast-icon.central-toast-dark {
    background: #647286;
}

.central-toast .toast-body {
    background: #fff;
    padding: 0;
}

.central-toast-content {
    background: transparent;
    border: 0;
    color: #142033;
    display: block;
    line-height: 1.45;
    padding: 12px 14px;
    text-align: left;
    width: 100%;
}

button.central-toast-content:hover {
    background: #f6f8fb;
}

.central-toast-message {
    color: #3d4c60;
    display: block;
}

.central-toast-origin {
    color: #8c98a8;
    display: block;
    font-size: 0.72rem;
    margin-top: 8px;
    text-align: right;
}

/* Theme restricted to the notification bell dialog. */
.swal2-container.notification-bell-alert .swal2-popup {
    font-family: var(--bs-body-font-family, system-ui, sans-serif);
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgb(15 23 42 / 18%);
}

.swal2-container.notification-bell-alert .swal2-popup:not(.swal2-toast) {
    width: 32rem;
    max-width: 100%;
    padding: 28px;
}

.swal2-container.notification-bell-alert .swal2-title {
    margin: 0;
    padding: 0;
    color: #172b4d;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: start;
    line-height: 1.4;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
}

.swal2-container.notification-bell-alert .swal2-popup:not(.swal2-toast):has(.swal2-close[style*="flex"]) .swal2-title {
    padding-right: 36px;
}

.swal2-container.notification-bell-alert .swal2-html-container {
    margin: 14px 0 0;
    padding: 0;
    color: #526176;
    font-size: 0.9375rem;
    line-height: 1.75;
    text-align: start;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.swal2-container.notification-bell-alert .swal2-popup:not(.swal2-toast) .swal2-html-container {
    max-height: min(24rem, 45vh);
    max-height: min(24rem, 45dvh);
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    scrollbar-color: #b8c4d3 #f1f5f9;
    scrollbar-gutter: stable;
    padding-right: 8px;
}

.swal2-container.notification-bell-alert .swal2-html-container::-webkit-scrollbar {
    width: 6px;
}

.swal2-container.notification-bell-alert .swal2-html-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 8px;
}

.swal2-container.notification-bell-alert .swal2-html-container::-webkit-scrollbar-thumb {
    background: #b8c4d3;
    border-radius: 8px;
}

.swal2-container.notification-bell-alert .swal2-html-container::-webkit-scrollbar-thumb:hover {
    background: #8799ae;
}

.swal2-container.notification-bell-alert .swal2-icon {
    margin: 0 auto 24px;
}

.swal2-container.notification-bell-alert .swal2-actions {
    gap: 10px;
    width: 100%;
    margin: 28px 0 0;
}

.swal2-container.notification-bell-alert .swal2-popup:not(.swal2-toast) .swal2-actions {
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #edf1f5;
}

.swal2-container.notification-bell-alert .swal2-popup:not(.swal2-toast) .swal2-cancel {
    order: -1;
}

.swal2-container.notification-bell-alert .swal2-close:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
    box-shadow: none;
}

.swal2-container.notification-bell-alert .swal2-close {
    position: absolute;
    top: 18px;
    right: 18px;
    margin: 0;
    z-index: 1;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 1.75rem;
    line-height: 1;
    transition: color 180ms ease, background-color 180ms ease;
}

.swal2-container.notification-bell-alert .swal2-close:hover {
    background: #f1f5f9;
    color: #334155;
}

.swal2-container.notification-bell-alert.swal2-backdrop-show {
    background: rgb(15 23 42 / 38%);
    animation: central-swal-backdrop-in 280ms ease both;
}

.swal2-container.notification-bell-alert.swal2-backdrop-hide {
    animation: central-swal-backdrop-out 200ms ease both;
}

.swal2-container.notification-bell-alert .swal2-popup.swal2-show {
    animation: central-swal-in 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.swal2-container.notification-bell-alert .swal2-popup.swal2-hide {
    animation: central-swal-out 200ms ease both;
}

@keyframes central-swal-in {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes central-swal-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

@keyframes central-swal-backdrop-in {
    from { background-color: transparent; }
    to { background-color: rgb(15 23 42 / 38%); }
}

@keyframes central-swal-backdrop-out {
    from { background-color: rgb(15 23 42 / 38%); }
    to { background-color: transparent; }
}

@media (max-width: 480px) {
    .swal2-container.notification-bell-alert .swal2-popup:not(.swal2-toast) {
        padding: 28px 20px 20px;
        border-radius: 16px;
    }

    .swal2-container.notification-bell-alert .swal2-title { font-size: 1.25rem; }
    .swal2-container.notification-bell-alert .swal2-actions { flex-wrap: wrap; }
    .swal2-container.notification-bell-alert .swal2-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    .swal2-container.notification-bell-alert.swal2-backdrop-show,
    .swal2-container.notification-bell-alert.swal2-backdrop-hide,
    .swal2-container.notification-bell-alert .swal2-popup.swal2-show,
    .swal2-container.notification-bell-alert .swal2-popup.swal2-hide,
    .swal2-container.notification-bell-alert .swal2-icon,
    .swal2-container.notification-bell-alert .swal2-icon * {
        animation: none !important;
    }

    .swal2-container.notification-bell-alert .swal2-close {
        transition: none;
        transform: none;
    }
}
