/* User-facing announcement banners and the dismissed-announcements section.
   Light by default; the panel switches themes by toggling a "dark" class on <html>, so dark styles follow that
   class (not the OS setting) and always match the rest of the panel. */

.announcement-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes announcement-spin {
    to { transform: rotate(360deg); }
}

.announcement-spin {
    display: inline-block;
    animation: announcement-spin .9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .announcement-spin { animation-duration: 2.5s; }
}

/* ---------- Layout ---------- */

/* A fixed strip above the scrolling page content. It matches the page background and scrolls on its own if
   several announcements would otherwise take over the screen. */
.announcement-banner-stack {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: .75rem;
    max-height: 40vh;
    overflow-y: auto;
    padding: .75rem 1rem;
    background: var(--color-gray-50, #f9fafb);
}

html.dark .announcement-banner-stack {
    background: var(--color-gray-950, #030712);
}

.announcement-banner-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: .75rem;
}

.announcement-banner {
    --announcement-accent: #1d4ed8;
    --announcement-icon-bg: #dbeafe;

    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .8rem .9rem;
    border: 1px solid;
    border-radius: .65rem;
}

.announcement-banner__icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: .5rem;
    background: var(--announcement-icon-bg);
    color: var(--announcement-accent);
    font-size: 1rem;
}

.announcement-banner__content {
    flex: 1;
    min-width: 0;
    padding-top: .1rem;
}

.announcement-banner__title {
    margin: 0;
    font-size: .9rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.announcement-banner__description {
    margin: .2rem 0 0;
    font-size: .82rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.announcement-banner__actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: .5rem;
}

.announcement-banner__action {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .8rem;
    border: 0;
    border-radius: .45rem;
    background: #1e293b;
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .12s;
}

.announcement-banner__action:hover:not(:disabled) {
    background: #0f172a;
    color: #fff;
}

.announcement-banner__action:disabled {
    cursor: progress;
    opacity: .7;
}

.announcement-banner__dismiss {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: .45rem;
    background: transparent;
    color: inherit;
    opacity: .75;
    cursor: pointer;
    transition: background-color .12s, opacity .12s;
}

.announcement-banner__dismiss:hover {
    background: rgba(0, 0, 0, .08);
    opacity: 1;
}

.announcement-banner__action:focus-visible,
.announcement-banner__dismiss:focus-visible,
.announcement-dismissed__restore:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ---------- Severity ---------- */

.announcement-banner--info { --announcement-accent: #1d4ed8; --announcement-icon-bg: #dbeafe; border-color: #93c5fd; background: #eff6ff; color: #1e3a8a; }
.announcement-banner--success { --announcement-accent: #15803d; --announcement-icon-bg: #dcfce7; border-color: #86efac; background: #f0fdf4; color: #14532d; }
.announcement-banner--warning { --announcement-accent: #b45309; --announcement-icon-bg: #fef3c7; border-color: #fcd34d; background: #fffbeb; color: #78350f; }
.announcement-banner--alert { --announcement-accent: #b91c1c; --announcement-icon-bg: #fee2e2; border-color: #fca5a5; background: #fef2f2; color: #7f1d1d; }

html.dark .announcement-banner--info { --announcement-accent: #93c5fd; --announcement-icon-bg: rgba(96, 165, 250, .16); border-color: rgba(96, 165, 250, .45); background: rgba(23, 37, 84, .75); color: #dbeafe; }
html.dark .announcement-banner--success { --announcement-accent: #86efac; --announcement-icon-bg: rgba(74, 222, 128, .14); border-color: rgba(74, 222, 128, .4); background: rgba(5, 46, 22, .75); color: #dcfce7; }
html.dark .announcement-banner--warning { --announcement-accent: #fcd34d; --announcement-icon-bg: rgba(251, 191, 36, .14); border-color: rgba(251, 191, 36, .4); background: rgba(69, 26, 3, .75); color: #fef3c7; }
html.dark .announcement-banner--alert { --announcement-accent: #fca5a5; --announcement-icon-bg: rgba(248, 113, 113, .14); border-color: rgba(248, 113, 113, .4); background: rgba(69, 10, 10, .75); color: #fee2e2; }

html.dark .announcement-banner__action {
    background: #e2e8f0;
    color: #0f172a;
}

html.dark .announcement-banner__action:hover:not(:disabled) {
    background: #fff;
    color: #0f172a;
}

html.dark .announcement-banner__dismiss:hover {
    background: rgba(255, 255, 255, .12);
}

/* ---------- Narrow screens: the button drops below the text, the dismiss stays top-right ---------- */

@media (max-width: 640px) {
    .announcement-banner {
        flex-wrap: wrap;
    }

    .announcement-banner__dismiss {
        order: 2;
    }

    .announcement-banner__actions {
        order: 3;
        flex-basis: 100%;
        padding-left: 2.75rem;
    }
}

/* ---------- Dismissed announcements (Notifications page) ---------- */

.announcement-dismissed {
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: .5rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    color: #111827;
}

html.dark .announcement-dismissed {
    border-color: #1f2937;
    background: #111827;
    color: #f3f4f6;
}

.announcement-dismissed__header {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

html.dark .announcement-dismissed__header {
    border-bottom-color: #1f2937;
}

.announcement-dismissed__header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
}

.announcement-dismissed__badge {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .5rem;
    background: #f3f4f6;
    color: #4b5563;
}

html.dark .announcement-dismissed__badge {
    background: #1f2937;
    color: #d1d5db;
}

.announcement-dismissed__count {
    display: inline-block;
    margin-left: .35rem;
    padding: 0 .5rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.4rem;
    vertical-align: middle;
}

html.dark .announcement-dismissed__count {
    background: #1f2937;
    color: #d1d5db;
}

.announcement-dismissed__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.announcement-dismissed__item {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.announcement-dismissed__item:last-child {
    border-bottom: 0;
}

html.dark .announcement-dismissed__item {
    border-bottom-color: #1f2937;
}

.announcement-dismissed__icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: .5rem;
    background: #dbeafe;
    color: #1d4ed8;
}

.announcement-dismissed__icon--success { background: #dcfce7; color: #15803d; }
.announcement-dismissed__icon--warning { background: #fef3c7; color: #b45309; }
.announcement-dismissed__icon--alert { background: #fee2e2; color: #b91c1c; }

html.dark .announcement-dismissed__icon { background: rgba(96, 165, 250, .16); color: #93c5fd; }
html.dark .announcement-dismissed__icon--success { background: rgba(74, 222, 128, .14); color: #86efac; }
html.dark .announcement-dismissed__icon--warning { background: rgba(251, 191, 36, .14); color: #fcd34d; }
html.dark .announcement-dismissed__icon--alert { background: rgba(248, 113, 113, .14); color: #fca5a5; }

.announcement-dismissed__body {
    flex: 1;
    min-width: 0;
}

.announcement-dismissed__title {
    margin: 0;
    font-size: .9rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.announcement-dismissed__description {
    display: -webkit-box;
    margin: .15rem 0 0;
    overflow: hidden;
    font-size: .82rem;
    line-height: 1.45;
    color: #4b5563;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

html.dark .announcement-dismissed__description {
    color: #d1d5db;
}

.announcement-dismissed__restore {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: .4rem;
    padding: .45rem .8rem;
    border: 1px solid #d1d5db;
    border-radius: .45rem;
    background: #fff;
    color: #374151;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
}

.announcement-dismissed__restore:hover:not(:disabled) {
    background: #f9fafb;
}

.announcement-dismissed__restore:disabled {
    cursor: progress;
    opacity: .6;
}

html.dark .announcement-dismissed__restore {
    border-color: #374151;
    background: #1f2937;
    color: #f3f4f6;
}

html.dark .announcement-dismissed__restore:hover:not(:disabled) {
    background: #374151;
}

@media (max-width: 640px) {
    .announcement-dismissed__item {
        flex-wrap: wrap;
    }

    .announcement-dismissed__restore {
        margin-left: 2.9rem;
    }
}
