/* System Action Alerts — topNav icon + toast panels */

.app-system-alerts-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--bs-warning, #ffc107);
    background: rgba(255, 193, 7, 0.12);
    transition: background 0.2s ease, transform 0.2s ease;
}

.app-system-alerts-toggle:hover {
    background: rgba(255, 193, 7, 0.22);
    transform: scale(1.04);
}

.app-system-alerts-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.45);
}

.sa-icon-pulse {
    animation: sa-icon-pulse 2s ease-in-out infinite;
}

@keyframes sa-icon-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.12); opacity: 0.85; }
}

.app-system-alerts .sa-dropdown-menu {
    width: 360px;
    max-width: min(360px, calc(100vw - 32px));
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    left: 0 !important;
    right: auto !important;
}

.sa-panel {
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg, #fff);
}

.sa-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.04) 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-weight: 700;
    font-size: 0.9375rem;
}

.sa-panel-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ffc107;
    color: #212529;
    font-size: 0.75rem;
    font-weight: 700;
}

.sa-panel-list {
    max-height: 320px;
    overflow-y: auto;
}

.sa-panel-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.15s ease;
}

.sa-panel-item:hover {
    background: rgba(13, 110, 253, 0.06);
}

.sa-panel-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sa-panel-item--warning .sa-panel-icon {
    background: rgba(255, 193, 7, 0.2);
    color: #b8860b;
}

.sa-panel-item--success .sa-panel-icon {
    background: rgba(25, 135, 84, 0.15);
    color: #198754;
}

.sa-panel-title {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.35;
}

.sa-panel-msg {
    font-size: 0.8125rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-top: 2px;
    line-height: 1.4;
}

.sa-panel-meta {
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-top: 4px;
}

/* Floating toast (non-blocking) */
.sa-toast-stack {
    position: fixed;
    top: 72px;
    left: 16px;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}

.sa-toast {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--bs-body-bg, #fff);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    animation: sa-toast-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.sa-toast--warning {
    border-left: 4px solid #ffc107;
}

.sa-toast--success {
    border-left: 4px solid #198754;
}

@keyframes sa-toast-in {
    from {
        opacity: 0;
        transform: translateX(-24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.sa-toast-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.sa-toast-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 193, 7, 0.2);
    color: #b8860b;
}

.sa-toast--success .sa-toast-icon {
    background: rgba(25, 135, 84, 0.15);
    color: #198754;
}

.sa-toast-title {
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.35;
}

.sa-toast-body {
    font-size: 0.8125rem;
    color: var(--bs-secondary-color, #6c757d);
    line-height: 1.45;
}

.sa-toast-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.sa-toast-btn {
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.sa-toast-btn:active {
    transform: scale(0.97);
}

.sa-toast-btn--ghost {
    background: rgba(0, 0, 0, 0.06);
    color: var(--bs-body-color, #212529);
}

.sa-toast-btn--ghost:hover {
    background: rgba(0, 0, 0, 0.1);
}

.sa-toast-btn--primary {
    background: #0d6efd;
    color: #fff;
}

.sa-toast-btn--primary:hover {
    background: #0b5ed7;
}

[data-theme="dark"] .sa-toast {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .sa-toast-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sa-toast-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.14);
}

@media (max-width: 575.98px) {
    .sa-toast-stack {
        top: 64px;
        left: 8px;
        right: 8px;
        max-width: none;
    }
}
