/* ============================================================
   XALLENGER — Comments & Announcements dialog styling
   ADDITIVE, production-ready. Drop into wwwroot/css/ and add a
   <link> in index.html (or import it in your bundle).

   Backs: XalCommentsDialog.razor
   Tokens used: --xal-* from xal-tokens.css (already loaded).

   NOTE: The dialog shell/title/footer are provided by MudDialog.
   Below we (1) lightly theme the MudDialog so it matches the
   Xallenger surface, and (2) define the inner feed chrome
   (.xal-segment, .xal-feed*, .xal-composer).
   ============================================================ */

/* ---- 1. MudDialog theming so the generic dialog matches Xallenger ---- */
.xal-dialog-mud.mud-dialog {
    background: var(--xal-bg-primary);
    border: 1px solid var(--xal-border-card);
    border-radius: var(--xal-radius-xl);
    color: var(--xal-text-primary);
    box-shadow: var(--xal-shadow-lg);
    overflow: hidden;
}

.xal-dialog-mud .mud-dialog-title {
    border-bottom: 1px solid var(--xal-border);
    padding-block: 14px;
}

.xal-dialog-mud .mud-dialog-actions {
    border-top: 1px solid var(--xal-border);
    gap: 8px;
    padding: 14px 20px;
}

.xal-dialog__title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 950;
    letter-spacing: -.01em;
    font-size: var(--xal-font-lg);
    text-transform: uppercase;
}
.xal-dialog__title .ic { color: var(--xal-gold); }

/* ---- 2. Stream switcher (segmented control) ---- */
.xal-segment {
    display: inline-flex;
    padding: 4px;
    border-radius: var(--xal-radius-pill);
    border: 1px solid var(--xal-border-card);
    background: var(--xal-bg-surface);
    gap: 4px;
}

.xal-segment button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--xal-text-secondary);
    font: inherit;
    font-weight: 850;
    font-size: var(--xal-font-sm);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 7px 14px;
    border-radius: var(--xal-radius-pill);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--xal-transition-fast);
}

.xal-segment button:hover { color: var(--xal-text-primary); }
.xal-segment button.is-active { background: var(--xal-gold); color: #000; }

.xal-segment .count-badge {
    display: inline-grid; place-items: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px;
    background: var(--xal-red);
    color: #fff;
    font-size: 10px;
    font-weight: 950;
}
.xal-segment button.is-active .count-badge { background: rgba(0,0,0,.35); color: #fff; }

/* ---- 3. Feed (works for both Announcements + Comments) ---- */
.xal-feed { display: flex; flex-direction: column; gap: 10px; }

.xal-feed-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--xal-border);
    border-radius: var(--xal-radius-md);
    background: var(--xal-bg-surface);
}

.xal-feed-item--pinned {
    border-color: var(--xal-gold-border);
    background: linear-gradient(135deg, var(--xal-gold-muted), var(--xal-bg-surface) 60%);
}

.xal-feed-item--official { border-color: var(--xal-blue-border); }

.xal-feed-item__body { min-width: 0; }
.xal-feed-item__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.xal-feed-item__author { font-weight: 900; font-size: var(--xal-font-md); color: var(--xal-text-primary); }
.xal-feed-item__time { color: var(--xal-text-muted); font-size: var(--xal-font-sm); font-weight: 700; }
.xal-feed-item__text { margin: 6px 0 0; color: var(--xal-text-secondary); font-size: var(--xal-font-md); line-height: 1.5; word-break: break-word; }

/* ---- 4. Composer (comment + announce share the same chrome) ---- */
.xal-composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: stretch;
}

/* Live status dot inside the .xal-pill--green */
.xal-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--xal-success, #22c55e);
    box-shadow: 0 0 0 0 rgba(34,197,94,.6);
    animation: xal-pulse 1.8s ease-out infinite;
    display: inline-block;
}
@keyframes xal-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
    70%  { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ---- 4b. Login prompt (shown to anonymous users in place of the composer) ---- */
.xal-login-prompt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--xal-border-card);
    border-radius: var(--xal-radius-lg);
    background: var(--xal-bg-surface);
}
.xal-login-prompt__icon { font-size: var(--xal-font-lg); line-height: 1; }
.xal-login-prompt__text { color: var(--xal-text-secondary); font-size: var(--xal-font-md); }
.xal-login-prompt__link {
    color: var(--xal-gold);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}
.xal-login-prompt__link:hover { text-decoration: underline; }

/* ---- 5. Mobile: make the body scroll, keep composer reachable ---- */
@media (max-width: 599.98px) {
    .xal-segment { width: 100%; }
    .xal-segment button { flex: 1 1 0; justify-content: center; }
    .xal-composer { grid-template-columns: 1fr; }
    .xal-composer .xal-btn-ui { width: 100%; }
}
