/* Notice Bell
 * --------------------------------------------------------------
 * Bell icon in the topnav + popover panel containing org-wide
 * notices (admin announcements, trial expiry, payment past-due,
 * email verify). Replaces the stacked banner stack AND the
 * short-lived ``notice_strip`` carousel.
 *
 * Spec: app/features/admin/docs/notices.md
 */

.notice-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* ------ Trigger button ------ */
.notice-bell__trigger {
    position: relative;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--fg-muted, #6b6b6b);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.notice-bell__trigger:hover,
.notice-bell__trigger:focus-visible {
    background: var(--surface-hover, #fafafa);
    color: var(--fg, #0a0a0a);
    border-color: var(--border, #ebebeb);
}

.notice-bell__trigger:focus-visible {
    outline: 2px solid var(--accent, #d8541a);
    outline-offset: 1px;
}

.notice-bell__trigger[aria-expanded="true"] {
    background: var(--surface-hover, #fafafa);
    color: var(--fg, #0a0a0a);
}

/* ------ Badge ------ */
.notice-bell__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent, #d8541a);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--surface, #ffffff);
    font-variant-numeric: tabular-nums;
}

.notice-bell__badge--danger {
    background: var(--danger, #dc2626);
}

/* ------ Panel ------ */
.notice-bell__panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 360px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #ebebeb);
    border-radius: 8px;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
    z-index: 1000;
}

.notice-bell__panel[hidden] {
    display: none;
}

.notice-bell__head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--divider, #f0f0f0);
}

.notice-bell__head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--fg, #0a0a0a);
    letter-spacing: 0.01em;
}

/* ------ List ------ */
.notice-bell__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.notice-bell__list:empty {
    display: none;
}

.notice-bell__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-left: 3px solid transparent;
    border-bottom: 1px solid var(--divider, #f0f0f0);
    transition: background 120ms ease;
}

.notice-bell__item:last-child {
    border-bottom: none;
}

.notice-bell__item:hover {
    background: var(--surface-hover, #fafafa);
}

/* Severity accents — mirror the tokens the retired notice strip
   used so an admin who picked banner_type=warning still sees the
   same orange/amber accent here. */
.notice-bell__item--info        { border-left-color: var(--info, #2563eb); }
.notice-bell__item--info .notice-bell__icon { color: var(--info, #2563eb); }

.notice-bell__item--success     { border-left-color: var(--good, #16a34a); }
.notice-bell__item--success .notice-bell__icon { color: var(--good, #16a34a); }

.notice-bell__item--warning     { border-left-color: var(--warn, #b45309); }
.notice-bell__item--warning .notice-bell__icon { color: var(--warn, #b45309); }

.notice-bell__item--danger      { border-left-color: var(--danger, #dc2626); }
.notice-bell__item--danger .notice-bell__icon { color: var(--danger, #dc2626); }

.notice-bell__icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    font-size: 16px;
    line-height: 1;
}

.notice-bell__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notice-bell__message {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--fg, #0a0a0a);
    word-wrap: break-word;
}

/* ------ CTA ------ */
.notice-bell__cta,
.notice-bell__cta-form {
    margin: 0;
}

.notice-bell__cta {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid var(--border-strong, #d4d4d4);
    background: var(--surface, #ffffff);
    color: var(--fg, #0a0a0a);
    text-decoration: none;
    cursor: pointer;
    align-self: flex-start;
    transition: background 120ms ease, border-color 120ms ease;
}

.notice-bell__cta:hover {
    background: var(--surface-hover, #fafafa);
    border-color: var(--fg-muted, #6b6b6b);
}

/* ------ Dismiss ------ */
.notice-bell__dismiss {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--fg-muted, #6b6b6b);
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 120ms ease, color 120ms ease;
}

.notice-bell__dismiss:hover {
    background: var(--surface-hover, #fafafa);
    color: var(--fg, #0a0a0a);
}

/* ------ Empty state ------ */
.notice-bell__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 16px;
    color: var(--fg-muted, #6b6b6b);
    text-align: center;
}

.notice-bell__empty[hidden] {
    display: none;
}

.notice-bell__empty i {
    font-size: 32px;
    color: var(--good, #16a34a);
}

.notice-bell__empty p {
    margin: 0;
    font-size: 13px;
}

/* ------ Mobile ------ */
@media (max-width: 540px) {
    .notice-bell__panel {
        position: fixed;
        top: 56px; /* below the linear-shell__mobile-bar */
        right: 8px;
        left: 8px;
        width: auto;
        max-height: calc(100vh - 72px);
    }
    .notice-bell__dismiss {
        width: 44px;
        height: 44px;
    }
}

/* Reduced motion — kill all transitions for users who asked. */
@media (prefers-reduced-motion: reduce) {
    .notice-bell__trigger,
    .notice-bell__item,
    .notice-bell__cta,
    .notice-bell__dismiss {
        transition: none;
    }
}
