/* ════════════════════════════════════════════════════════════════
   site/components.css — shared, page-invariant idioms (defined once)
   ----------------------------------------------------------------
   Only idioms that are byte-identical everywhere they appear and whose
   class names are specific enough not to collide live here. Where two
   pages used the SAME name for DIFFERENT rules (.modal, .stat-card,
   .stat-value, .range-*, .donut, .loading), those stay page-scoped in
   site/pages/*.css behind a .page-* wrapper — merging them here would
   change rendering. Per-page numeric outliers on an otherwise-shared
   rule (e.g. .pop z-index, .tb-search min-width) are handled with a
   small override in the page file, noted at the rule below.

   Deferred to Task 4: stat tiles, data tables/lists and the two modal
   systems are still duplicated per page. Those are better unified as
   parameterised shared *components* (StatTile, DataTable, Modal) than
   as CSS, so they are intentionally left for the component-extraction
   task rather than force-merged here.

   SCSS-READY: becomes _components.scss.
   ════════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════
   Keyframes — de-duplicated from the page sheets (were repeated up to
   6×). Page CSS references these by name.
   ════════════════════════════════════════════════════════════════ */

@keyframes skel-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes wipe-right {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0 0 0); }
}

@keyframes tb-spin { to { transform: rotate(360deg); } }

@keyframes modal-in {
    from { opacity: 0; transform: translate(-50%, -48%) scale(.98); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fly-in {
    from { transform: translateX(60px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }

/* ════════════════════════════════════════════════════════════════
   Menu backdrop — full-viewport click-catch layer under open popovers.
   position:fixed so it works regardless of where it sits in the DOM.
   ════════════════════════════════════════════════════════════════ */

.menu-backdrop { position: fixed; inset: 0; z-index: 40; }

/* Vertical page-content stack used by every dashboard list page. */
.dash { display: flex; flex-direction: column; gap: 34px; }

/* ════════════════════════════════════════════════════════════════
   Toolbar (actions · count · search · range) — used by the list pages
   (Incidents, Requests, Assets, Vulnerabilities) and Security Bulletins.
   ════════════════════════════════════════════════════════════════ */

.tb-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.tb-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: none;
    background: transparent;
    color: var(--muted);
    font: 500 13px var(--font-body);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color .15s ease, background .15s ease;
}
.tb-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.tb-btn svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.tb-btn svg.spin {
    transform-box: fill-box;
    transform-origin: center;
    animation: tb-spin .7s linear infinite;
}

.tb-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* base min-width 210px; page overrides: Vulnerabilities 230, Bulletins 220 */
.tb-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    min-width: 210px;
}
.tb-search svg { width: 14px; height: 14px; color: var(--faint); flex: none; }
.tb-search input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text);
    font: 400 13px var(--font-body);
    width: 100%;
}
.tb-search input::placeholder { color: var(--faint); }

/* "last update time" range dropdown trigger (Incidents, Requests) */
.tb-rangebtn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font: 500 13px var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease;
}
.tb-rangebtn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.tb-rangebtn > svg { width: 15px; height: 15px; flex: none; }
.tb-rangebtn .tb-chev { width: 13px; height: 13px; opacity: 0.7; margin-left: 2px; }

/* ─── Filter row bits (save · add filter · chips) ─────────────── */

.tb-flabel { font-size: 13px; color: var(--muted); }

.tb-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: var(--accent);
    font: 500 13px var(--font-body);
    cursor: pointer;
}
.tb-link svg { width: 14px; height: 14px; }
.tb-link:disabled { color: var(--faint); opacity: 0.6; cursor: default; }

/* saved filter sets — click to re-apply */
.saved-chip {
    padding: 5px 12px;
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-2);
    font: 500 12.5px var(--font-body);
    cursor: pointer;
    transition: filter .15s ease;
}
.saved-chip:hover { filter: brightness(1.12); }

/* active filter chips (removable) */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px 4px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 12.5px;
    color: var(--muted);
}
.filter-chip button {
    border: none;
    background: transparent;
    color: var(--faint);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.filter-chip button:hover { color: var(--text); }

.tb-addfilter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border: 1px dashed var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: 500 12.5px var(--font-body);
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.tb-addfilter:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.28); }
.tb-addfilter svg { width: 13px; height: 13px; }

/* ════════════════════════════════════════════════════════════════
   Popover menus (Add filter · Customize columns · Range)
   base .pop: z-index 5, min-width 214px.
   page overrides — Requests: z-index 50, min-width 210px;
                    Vulnerabilities: min-width 200px.
   ════════════════════════════════════════════════════════════════ */

.tb-pop { position: relative; }

.pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 5;
    min-width: 214px;
    padding: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.pop-right { left: auto; right: 0; }

.pop-title {
    margin: 9px 6px 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--faint);
}
.pop-title:first-child { margin-top: 2px; }

.pop-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.pop-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.pop-item input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.pop-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px 7px 8px;
    border: none;
    background: transparent;
    color: var(--muted);
    font: 500 13px var(--font-body);
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.pop-opt:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.pop-opt.is-sel { color: var(--text); }
.pop-check { width: 13px; flex: none; color: var(--accent); font-size: 12px; }

.pop-custom {
    display: grid;
    gap: 8px;
    margin-top: 5px;
    padding: 9px 8px 4px;
    border-top: 1px solid var(--line-soft);
}
.pop-custom label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12.5px;
    color: var(--muted);
}
.pop-custom input {
    padding: 5px 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font: 400 12.5px var(--font-body);
    color-scheme: dark;
}

/* ════════════════════════════════════════════════════════════════
   Modal form fields + toast — shared by the Incidents & Requests
   raise/request modals. (The .modal shell itself stays page-scoped:
   Incidents/Requests use a fixed translate-center shell while
   Assets/Documents use a centred .modal-overlay shell — same class
   name, different rules.)
   ════════════════════════════════════════════════════════════════ */

.fld { display: block; margin-bottom: 16px; }
.fld-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.req-star { color: var(--bad); }

.fld-input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font: 400 13.5px var(--font-body);
    outline: none;
    resize: vertical;
    color-scheme: dark;
    transition: border-color .15s ease;
}
.fld-input:focus { border-color: var(--accent-line); }
.fld-input::placeholder { color: var(--faint); }
select.fld-input { cursor: pointer; }

.req-toast {
    position: fixed;
    z-index: 220;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    padding: 11px 18px;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--accent-2);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.7);
    animation: toast-in .25s ease both;
}
@media (prefers-reduced-motion: reduce) { .req-toast { animation: none; } }

/* ════════════════════════════════════════════════════════════════
   Classification pill — shared by the Incidents list and the Incident
   detail page (colour set inline via currentColor).
   ════════════════════════════════════════════════════════════════ */

.cls-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid currentColor;
    background: transparent;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════
   Detail-page kit (.id-*) — shared verbatim by the Incident detail and
   Service-request detail pages. These names appear nowhere else, so
   they are safe to define globally without a page wrapper. Page-unique
   extras (report blocks, type tag, mini avatar, selects) live in the
   respective site/pages/*-detail.css.
   ════════════════════════════════════════════════════════════════ */

.id-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    width: fit-content;
    transition: color .15s ease;
}
.id-back:hover { color: var(--text); }
.id-back svg { width: 15px; height: 15px; }

.id-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.id-head h1 {
    margin: 2px 0 0;
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.id-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

.id-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}
.id-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; }

.id-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 18px;
    align-items: start;
}
.id-main, .id-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.id-h2 {
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}

.id-comments { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.id-comment { display: flex; gap: 12px; }

.id-avatar {
    width: 32px;
    height: 32px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    color: #04201D;
    background: linear-gradient(140deg, #5EEAD9, #14B8A6);
}
.id-comment:not(.is-customer) .id-avatar { background: linear-gradient(140deg, #8AB4FF, #4D85F5); }

/* ── Reusable user avatar (photo or initials puck) — see Components/UserAvatar.razor ── */
.user-avatar {
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    overflow: hidden;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    color: #04201D;
    background: linear-gradient(140deg, #8AB4FF, #4D85F5);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-avatar.ua-sm { width: 24px; height: 24px; font-size: 9px; }
.user-avatar.ua-md { width: 32px; height: 32px; font-size: 11px; }
.user-avatar.ua-lg { width: 40px; height: 40px; font-size: 13px; }

/* Name + avatar pairing (roster rows, assignee display) */
.user-cell { display: inline-flex; align-items: center; gap: 10px; }
.user-photo-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.user-photo-controls { display: flex; flex-direction: column; gap: 8px; }

.id-comment-body {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 10px 14px 12px;
}
.id-comment.is-customer .id-comment-body { border-color: var(--accent-line); }

.id-comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.id-comment-head strong { font-size: 13.5px; }
.id-role {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
}
.id-role.cust { color: var(--accent-2); background: var(--accent-soft); }
.id-role.soc  { color: #8AB4FF; background: rgba(77, 133, 245, 0.14); }
.id-when { font-size: 12px; color: var(--faint); margin-left: auto; }
/* base comment body text; Incident detail adds pre-wrap/anywhere (see its page file) */
.id-comment-body p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }

.id-empty { margin: 0 0 18px; font-size: 13.5px; color: var(--faint); }

.id-addcomment {
    border-top: 1px solid var(--line-soft);
    padding-top: 16px;
}
.id-addcomment textarea {
    width: 100%;
    resize: vertical;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: 400 13.5px var(--font-body);
    outline: none;
    transition: border-color .15s ease;
}
.id-addcomment textarea:focus { border-color: var(--accent-line); }
.id-addcomment textarea::placeholder { color: var(--faint); }

.id-addcomment-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}
.id-hint { font-size: 12.5px; color: var(--faint); }
.id-hint strong { color: var(--muted); font-weight: 600; }

.idt-btn {
    padding: 8px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: 600 13px var(--font-body);
    cursor: pointer;
    text-decoration: none;
    transition: border-color .15s ease, filter .15s ease;
}
.idt-btn.primary { background: var(--accent); border-color: var(--accent); color: #04201D; }
.idt-btn.primary:hover { filter: brightness(1.08); }
.idt-btn.primary:disabled { opacity: 0.5; cursor: default; filter: none; }

.id-props { margin: 0; display: grid; gap: 14px; }
.id-props > div { display: grid; gap: 5px; }
.id-props dt {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--faint);
}
.id-props dd {
    margin: 0;
    font-size: 13.5px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.id-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.id-activity li { display: flex; gap: 11px; }
.id-adot {
    width: 8px; height: 8px;
    flex: none;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.id-activity li > div { display: grid; gap: 2px; }
.id-atext { font-size: 13px; color: var(--muted); }
.id-activity time { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.id-missing { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.id-missing h1 { margin: 0; font-family: var(--font-display); color: #fff; }
.id-missing p { margin: 0; color: var(--muted); }

@media (max-width: 1080px) {
    .id-grid { grid-template-columns: 1fr; }
}

/* ─── Rich-text editor (RichTextEditor.razor + js/richtext.js) ────────────────────
   Self-contained WYSIWYG for authoring free-form security bulletins. Class names are
   rte-* prefixed to stay clear of the Bootstrap / kit .btn·.modal collisions. */

.rte { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius, 8px); background: var(--surface-2); overflow: hidden; }
.rte-disabled { opacity: 0.6; pointer-events: none; }

.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface); }

.rte-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: 600 12.5px var(--font-body);
    cursor: pointer;
    transition: color .12s ease, background .12s ease, border-color .12s ease;
}
.rte-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); border-color: var(--line); }
.rte-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--line); }

.rte-surface {
    min-height: 220px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 14px 16px;
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text);
    outline: none;
}
.rte-surface:empty::before { content: attr(data-placeholder); color: var(--faint); }
.rte-surface h1, .rte-surface h2 { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 16px 0 8px; color: #fff; }
.rte-surface h3, .rte-surface h4 { font-size: 14px; font-weight: 700; margin: 14px 0 6px; }
.rte-surface p { margin: 0 0 10px; }
.rte-surface ul, .rte-surface ol { margin: 0 0 10px; padding-left: 22px; }
.rte-surface blockquote { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--accent); background: var(--surface); }
.rte-surface a { color: var(--accent-2); }
.rte-surface img { max-width: 100%; height: auto; display: block; margin: 10px 0; border: 1px solid var(--line); border-radius: 6px; }

.rte-file { display: none; }

.rte-status { padding: 6px 12px; font-size: 12px; color: var(--faint); border-top: 1px solid var(--line); }
.rte-status-error { color: var(--danger, #ef4444); }
