/* ============================================================
   Morning Brief widget
   ============================================================ */

.morning-brief {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.morning-brief__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 14px 16px 8px;
    gap: 10px;
}

.morning-brief__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    color: #1f1f1f;
}

.morning-brief__title-icon {
    color: var(--club-colour, #4a6cf7);
}

.morning-brief__count {
    font-size: 12px;
    color: #6b7280;
}

.morning-brief__list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 4px;
}

.morning-brief__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
    color: #6b7280;
    text-align: center;
    gap: 8px;
}

.morning-brief__empty-icon {
    color: #16a34a;
    font-size: 24px;
}

/* Rows */
.morning-brief__row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 3px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    overflow: hidden;
}

.morning-brief__row:last-child {
    margin-bottom: 0;
}

.morning-brief__severity {
    width: 3px;
    border-radius: 2px;
    background: #d1d5db;
    flex-shrink: 0;
}

.morning-brief__row--critical .morning-brief__severity { background: #dc2626; }
.morning-brief__row--high     .morning-brief__severity { background: #ea580c; }
.morning-brief__row--medium   .morning-brief__severity { background: #d97706; }
.morning-brief__row--low      .morning-brief__severity { background: #9ca3af; }

.morning-brief__main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.morning-brief__body {
    flex: 1 1 200px;
    min-width: 0;
}

.morning-brief__row-title {
    font-size: 13px;
    color: #1f1f1f;
    line-height: 1.3;
    word-break: break-word;
}

.morning-brief__row-subtitle {
    font-size: 11px;
    color: #6b7280;
    margin-top: 1px;
    line-height: 1.3;
}

.morning-brief__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex-shrink: 0;
}

/* Buttons */
.morning-brief__btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    background: #fff;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
}

.morning-brief__btn--primary {
    background: var(--club-colour, #4a6cf7);
    color: #fff;
    border-color: var(--club-colour, #4a6cf7);
}

.morning-brief__btn--primary:hover {
    filter: brightness(0.95);
    color: #fff;
}

.morning-brief__btn--secondary {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
}

.morning-brief__btn--secondary:hover {
    background: #f3f4f6;
    color: #1f1f1f;
}

.morning-brief__btn--danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.morning-brief__btn--danger:hover {
    background: #fee2e2;
}

.morning-brief__btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Footer */
.morning-brief__footer {
    padding: 8px 16px 12px;
    text-align: right;
}

.morning-brief__view-all {
    font-size: 12px;
    color: var(--club-colour, #4a6cf7);
    text-decoration: none;
}

.morning-brief__view-all:hover {
    text-decoration: underline;
}

/* Overflow hint — shown only when items exceed MaxItemsShown */
.morning-brief__overflow-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 6px 4px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f3f4f6;
    border: 1px dashed #d1d5db;
    font-size: 12.5px;
    color: #4b5563;
    text-decoration: none;
    transition: background-color 0.12s, border-color 0.12s;
}

.morning-brief__overflow-hint:hover {
    background: #e5e7eb;
    border-color: var(--club-colour, #4a6cf7);
    color: #1f1f1f;
}

.morning-brief__overflow-hint > span {
    flex: 1;
    line-height: 1.3;
}

.morning-brief__overflow-hint .fa-plus-circle {
    color: var(--club-colour, #4a6cf7);
    font-size: 14px;
}

.morning-brief__overflow-hint .fa-arrow-right {
    font-size: 11px;
    opacity: 0.6;
}

/* Variant: when embedded inside a /ClubOverview co-panel or co-graph card.
   The card chrome already provides title/subtitle/link, so skip our own header
   and let the rows fill the body. */
.morning-brief--co {
    background: transparent;
    border-radius: 0;
}

.morning-brief--co .morning-brief__list {
    padding: 0;
}

.co-graph__body--brief {
    padding-top: 4px;
}

/* Variant: when surfaced as a sibling block beneath an agent chat bubble.
   The card sits in .agents-messages (column flex) and must look like part of
   the agent's reply, indented past the avatar so it visually attaches to the
   bubble above it. */
.morning-brief--chat {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 12px;
    margin-left: 42px;
    max-width: calc(85% - 42px);
    align-self: flex-start;
    /* Override the base .morning-brief height: 100% / overflow: hidden, which
       are designed for the fixed-height dashboard widget. In a chat context the
       card needs to size to its content, otherwise it stretches to fill
       .agents-messages and clips its own rows. */
    height: auto;
    overflow: visible;
}

.morning-brief--chat .morning-brief__list {
    padding: 0;
    overflow: visible;
    flex: none;
}

.morning-brief--chat .morning-brief__row {
    background: rgba(0, 0, 0, 0.02);
}

.morning-brief__chat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
}

.morning-brief__chat-header i {
    color: var(--club-colour, #4a6cf7);
}

/* /ClubOverview middle column variant — sits in a .co-panel above LiveNow */
.co-panel--brief {
    margin-bottom: 12px;
}

.co-panel--brief .co-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.co-panel__link {
    font-size: 12px;
    color: var(--co-accent, #4f46e5);
    text-decoration: none;
    white-space: nowrap;
}

.co-panel__link:hover {
    text-decoration: underline;
}

.co-panel__link i {
    margin-left: 4px;
    font-size: 10px;
}

.co-panel__subtitle {
    margin: 4px 0 8px;
    font-size: 12px;
    color: #6b7280;
}

.co-panel--brief .morning-brief--co {
    margin-top: 4px;
}

.co-panel__empty {
    padding: 18px 10px;
    text-align: center;
    color: #6b7280;
}

.co-panel__empty-icon {
    color: #16a34a;
    font-size: 22px;
    margin-bottom: 6px;
}

.co-panel__empty-title {
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 4px;
}

.co-panel__empty-hint {
    font-size: 12px;
    line-height: 1.4;
}

/* /Briefing/Index — full-page layout */
.morning-brief-page__empty {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 48px 16px;
    text-align: center;
    margin: 16px 0;
}

.morning-brief-page__empty h5 {
    margin: 12px 0 6px;
}

.morning-brief-page__group {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.morning-brief-page__group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.morning-brief-page__group-header h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1f1f1f;
}

.morning-brief-page__group-header i {
    color: var(--club-colour, #4a6cf7);
}

.morning-brief-page__group-count {
    margin-left: auto;
    font-size: 12px;
    color: #6b7280;
}

.morning-brief__list--page {
    padding: 8px 12px 12px;
}

.morning-brief__list--page .morning-brief__row {
    background: #fff;
    border: 1px solid #f0f0f0;
}

/* ============================================================
   AI Summary box — wraps the LLM-narrated headline (compact)
   or full narrative (full) so it reads as a distinct "AI told us
   this" rather than blending into the items list. Used in three
   places: dashboard widget, ClubOverview brief panel, /Briefing page.
   ============================================================ */

.mb-ai-summary {
    margin: 0 16px 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f7f9ff, #eef2ff);
    border-left: 3px solid var(--club-colour, #4a6cf7);
    border-radius: 6px;
    position: relative;
}

.mb-ai-summary__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.mb-ai-summary__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--club-colour, #4a6cf7);
}

.mb-ai-summary__label-icon {
    font-size: 12px;
}

/* #44084 — Milo's mark as an inline icon (see _MiloMark.cshtml). Sized off the
   surrounding font so it sits on the text line wherever it is dropped in. */
.milo-mark {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.2em;
    flex-shrink: 0;
}

.mb-ai-summary__sparkle {
    font-size: 11px;
    color: var(--club-colour, #4a6cf7);
    opacity: 0.7;
}

.mb-ai-summary__body {
    color: #1f2937;
}

.mb-ai-summary__body p {
    margin: 0 0 8px;
    font-size: 13.5px;
    line-height: 1.55;
}

.mb-ai-summary__body p:last-child {
    margin-bottom: 0;
}

.mb-ai-summary__disclosure {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 10.5px;
    color: #6b7280;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Compact variant — dashboard widget. Single short paragraph; no disclosure
   in the widget since it's space-constrained (the /Briefing page carries it). */
.mb-ai-summary--compact {
    padding: 10px 14px;
    margin-bottom: 10px;
}

.mb-ai-summary--compact .mb-ai-summary__body p {
    font-size: 13px;
}

/* ClubOverview brief panel uses the same compact variant but the panel's
   own padding handles outer margin — drop the box's left/right offset. */
.co-panel--brief .mb-ai-summary {
    margin-left: 0;
    margin-right: 0;
}

/* Full variant — /Briefing dedicated page. Larger type, more breathing room,
   keeps the disclosure footer because operators read it more deliberately here. */
.mb-ai-summary--full {
    margin: 0 0 20px;
    padding: 18px 22px;
}

.mb-ai-summary--full .mb-ai-summary__body p {
    font-size: 14px;
    line-height: 1.6;
    color: #111827;
}

/* ============================================================
   /Briefing page — stats overview row + tightened category cards.
   ============================================================ */

.morning-brief-page__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.morning-brief-page__stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    font-size: 12.5px;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.morning-brief-page__stat-icon {
    color: var(--club-colour, #4a6cf7);
}

.morning-brief-page__stat-count {
    font-weight: 700;
    color: #111827;
}

.morning-brief-page__group {
    margin-bottom: 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.morning-brief-page__group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: linear-gradient(180deg, #fafafa, #f4f5f7);
    border-bottom: 1px solid #e5e7eb;
}

.morning-brief-page__group-header h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    flex: 1;
}

.morning-brief-page__group-header > i {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--club-colour, #4a6cf7);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.morning-brief-page__group-count {
    font-size: 11.5px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 999px;
}

.morning-brief-page__group .morning-brief {
    background: transparent;
    border-radius: 0;
}

.morning-brief-page__group .morning-brief__list {
    padding: 8px 12px 12px;
}

.morning-brief-page__empty {
    padding: 40px 20px;
    text-align: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.morning-brief-page__empty-icon {
    margin-bottom: 12px;
}


/* ============================================================
   AI summary — pending state.

   The narrative is written by an LLM, so the server no longer waits for it
   during the render (it used to, at a measured ~4s cost on a cold cache).
   The slot ships empty with data-brief-summary-pending and morning-brief.js
   fills it after paint. These rules are just the holding pattern: two grey
   bars at roughly the height of the real text, so nothing below jumps when
   the words arrive.
   ============================================================ */

.mb-ai-summary__skeleton {
    height: 11px;
    margin: 0 0 7px;
    border-radius: 3px;
    background: linear-gradient(90deg, #e5e7eb 25%, #f1f3f5 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: mb-ai-summary-shimmer 1.4s ease-in-out infinite;
}

.mb-ai-summary__skeleton--short {
    width: 62%;
    margin-bottom: 0;
}

.co-ai-rail__headline--loading {
    min-height: 34px;
    background: linear-gradient(90deg, #eef6fd 25%, #f7fbfe 50%, #eef6fd 75%);
    background-size: 200% 100%;
    animation: mb-ai-summary-shimmer 1.4s ease-in-out infinite;
}

@keyframes mb-ai-summary-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Respect a reduced-motion preference — hold a flat tone instead of pulsing. */
@media (prefers-reduced-motion: reduce) {
    .mb-ai-summary__skeleton,
    .co-ai-rail__headline--loading {
        animation: none;
    }
}

/* Announced to screen readers, invisible on screen. Namespaced rather than
   reusing a framework .sr-only so this partial can't be broken by a CSS
   bundle that doesn't ship one. */
.mb-ai-summary__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
