/* ================================================================
   Wazuh Discover view styling
   ================================================================
   Brand-neutral but recognisable as a security analytics dashboard.
   Uses AKONetwork's CSS variables (--ui-bg, --ui-border, --color-
   ochre, --color-terracotta, etc.) so the simulator follows the
   active theme (dark / light) without per-theme overrides.

   No vendor logos, no pixel-copy of upstream Wazuh chrome - we use
   the Wazuh name in product because GPLv2 permits, but the UI is
   our own.

   Severity colour mapping (Wazuh-aligned semantics, AKONetwork
   palette):
     info  (0-3)   ochre / muted yellow
     low   (4-6)   amber
     med   (7-9)   orange (terracotta-leaning)
     high  (10-11) red-orange
     crit  (12+)   deep crimson
   ================================================================ */

.wzh-root {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 480px;
    background: var(--ui-bg, #1a1410);
    color: var(--ui-text-primary, #e8dcc8);
    border: 1px solid var(--ui-border, #3a2a1a);
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wzh-header {
    padding: 14px 18px 10px;
    background: linear-gradient(180deg, rgba(212, 160, 60, 0.08), transparent);
    border-bottom: 1px solid var(--ui-border, #3a2a1a);
}

.wzh-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-ochre, #d4a03c);
    letter-spacing: 0.3px;
}

.wzh-subtitle {
    font-size: 12px;
    color: var(--ui-text-muted, #998a78);
    margin-top: 2px;
}

/* ---- toolbar (search bar + time picker) -------------------------- */

.wzh-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--ui-bg-elevated, #221610);
    border-bottom: 1px solid var(--ui-border, #3a2a1a);
}

.wzh-search-input {
    flex: 1;
    height: 34px;
    padding: 0 12px;
    background: var(--ui-input-bg, #1a1410);
    color: var(--ui-text-primary, #e8dcc8);
    border: 1px solid var(--ui-border, #3a2a1a);
    border-radius: 4px;
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
    font-size: 13px;
    outline: none;
}

.wzh-search-input:focus {
    border-color: var(--color-ochre, #d4a03c);
    box-shadow: 0 0 0 1px var(--color-ochre, #d4a03c);
}

.wzh-search-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wzh-search-btn {
    height: 34px;
    padding: 0 16px;
    background: var(--color-ochre, #d4a03c);
    color: #1a1410;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.wzh-search-btn:hover:not(:disabled) {
    background: #e0b04a;
}

.wzh-search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wzh-time-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ui-text-muted, #998a78);
    font-size: 13px;
}

.wzh-time-icon {
    font-size: 14px;
    opacity: 0.7;
}

.wzh-time-select {
    height: 34px;
    padding: 0 8px;
    background: var(--ui-input-bg, #1a1410);
    color: var(--ui-text-primary, #e8dcc8);
    border: 1px solid var(--ui-border, #3a2a1a);
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

/* ---- body (facets + main) ---------------------------------------- */

.wzh-body {
    display: flex;
    flex: 1;
    min-height: 360px;
}

.wzh-facets {
    width: 220px;
    padding: 14px 12px;
    background: var(--ui-bg, #1a1410);
    border-right: 1px solid var(--ui-border, #3a2a1a);
    overflow-y: auto;
}

.wzh-facet {
    margin-bottom: 18px;
}

.wzh-facet-title {
    margin: 0 0 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ui-text-muted, #998a78);
}

.wzh-facet-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wzh-facet-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 6px;
    font-size: 12px;
    border-radius: 3px;
}

.wzh-facet-item:hover {
    background: rgba(212, 160, 60, 0.08);
}

.wzh-facet-key {
    color: var(--ui-text-primary, #e8dcc8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.wzh-facet-count {
    color: var(--color-ochre, #d4a03c);
    font-weight: 600;
}

.wzh-main {
    flex: 1;
    padding: 14px;
    overflow: auto;
}

.wzh-results-meta {
    font-size: 12px;
    color: var(--ui-text-muted, #998a78);
    margin-bottom: 8px;
}

/* ---- results table ----------------------------------------------- */

.wzh-results-table {
    width: 100%;
    overflow-x: auto;
}

.wzh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.wzh-table thead th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--ui-border, #3a2a1a);
    color: var(--ui-text-muted, #998a78);
    font-weight: 500;
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
    background: var(--ui-bg-elevated, #221610);
}

.wzh-row {
    cursor: pointer;
    transition: background-color 80ms ease;
}

.wzh-row td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(58, 42, 26, 0.5);
    color: var(--ui-text-primary, #e8dcc8);
    vertical-align: top;
}

.wzh-row:hover {
    background: rgba(212, 160, 60, 0.05);
}

.wzh-row:focus-visible {
    outline: 2px solid var(--color-ochre, #d4a03c);
    outline-offset: -2px;
}

.wzh-row--highlight {
    background: rgba(212, 160, 60, 0.15);
    box-shadow: inset 3px 0 0 var(--color-ochre, #d4a03c);
}

.wzh-cell-time {
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
    color: var(--ui-text-muted, #998a78);
    white-space: nowrap;
}

/* ---- severity badges --------------------------------------------- */

.wzh-level {
    display: inline-block;
    min-width: 24px;
    padding: 2px 8px;
    border-radius: 3px;
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
}

.wzh-level-info { background: rgba(150, 150, 150, 0.2); color: #e8dcc8; }
.wzh-level-low  { background: rgba(212, 160, 60, 0.25); color: #f0c878; }
.wzh-level-med  { background: rgba(199, 91, 57, 0.25); color: #e88060; }
.wzh-level-high { background: rgba(220, 80, 50, 0.4); color: #ffaa92; }
.wzh-level-crit { background: rgba(180, 30, 30, 0.6); color: #ffd0d0; }

/* ---- inspector --------------------------------------------------- */

.wzh-inspector {
    margin-top: 14px;
}

.wzh-inspector-card {
    background: var(--ui-bg-elevated, #221610);
    border: 1px solid var(--ui-border, #3a2a1a);
    border-radius: 6px;
    padding: 12px;
}

.wzh-inspector-title {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--color-ochre, #d4a03c);
    font-weight: 600;
}

.wzh-inspector-json {
    margin: 0;
    padding: 10px;
    background: var(--ui-input-bg, #1a1410);
    color: var(--ui-text-primary, #e8dcc8);
    border-radius: 4px;
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
    font-size: 12px;
    line-height: 1.45;
    overflow-x: auto;
    max-height: 380px;
    overflow-y: auto;
    white-space: pre;
}

.wzh-empty {
    padding: 30px 18px;
    text-align: center;
    color: var(--ui-text-muted, #998a78);
    font-size: 13px;
    font-style: italic;
}

/* ---- ticket panel (Gate 27 extension, verify-task artifact) ------ */

.wzh-ticket {
    margin-top: 18px;
    background: var(--ui-bg-elevated, #221610);
    border: 1px solid var(--color-terracotta, #c75b39);
    border-radius: 6px;
    padding: 14px;
}

.wzh-ticket-title {
    margin: 0 0 10px;
    color: var(--color-terracotta, #c75b39);
    font-size: 14px;
    font-weight: 700;
}

.wzh-ticket-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--ui-text-muted, #998a78);
}

.wzh-ticket-row > span {
    font-weight: 600;
    color: var(--ui-text-primary, #e8dcc8);
}

.wzh-ticket-input {
    padding: 7px 10px;
    background: var(--ui-input-bg, #1a1410);
    color: var(--ui-text-primary, #e8dcc8);
    border: 1px solid var(--ui-border, #3a2a1a);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.wzh-ticket-input:focus {
    border-color: var(--color-terracotta, #c75b39);
    box-shadow: 0 0 0 1px var(--color-terracotta, #c75b39);
}

.wzh-ticket-submit {
    padding: 9px 18px;
    background: var(--color-terracotta, #c75b39);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    margin-top: 4px;
}

.wzh-ticket-submit:hover { background: #d96b48; }

.wzh-ticket-status {
    margin-top: 8px;
    font-size: 12px;
    color: var(--ui-success, #6fcf97);
    min-height: 16px;
}

/* ---- responsive: stack facets + main on narrow viewports --------- */

@media (max-width: 720px) {
    .wzh-body { flex-direction: column; }
    .wzh-facets { width: auto; border-right: none; border-bottom: 1px solid var(--ui-border, #3a2a1a); }
}

/* =================================================================
   CysaLabRunner task-list chrome (Arc 13 cysa_lab missions)
   ================================================================= */

.cysa-lab-tasks {
    margin-bottom: 14px;
    padding: 14px 16px;
    background: var(--ui-bg-elevated, #221610);
    border: 1px solid var(--ui-border, #3a2a1a);
    border-radius: 6px;
}

.cysa-lab-phase-title {
    margin: 0 0 4px;
    color: var(--color-ochre, #d4a03c);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.cysa-lab-intro {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--ui-text-muted, #998a78);
    font-style: italic;
}

.cysa-lab-task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: cysa-task;
}

.cysa-lab-task {
    counter-increment: cysa-task;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(58, 42, 26, 0.5);
    color: var(--ui-text-primary, #e8dcc8);
    font-size: 13px;
}

.cysa-lab-task:last-child { border-bottom: none; }

.cysa-lab-task::before {
    content: counter(cysa-task) '.';
    color: var(--ui-text-muted, #998a78);
    font-weight: 700;
    min-width: 22px;
}

.cysa-lab-task-status {
    color: var(--color-ochre, #d4a03c);
    font-size: 16px;
    line-height: 1.2;
    flex-shrink: 0;
}

.cysa-lab-task-goal { flex: 1; line-height: 1.45; }

.cysa-lab-task--done .cysa-lab-task-status { color: var(--ui-success, #6fcf97); }
.cysa-lab-task--done .cysa-lab-task-goal {
    color: var(--ui-text-muted, #998a78);
    text-decoration: line-through;
    text-decoration-color: rgba(111, 207, 151, 0.4);
}

.cysa-lab-task-hint {
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(199, 91, 57, 0.08);
    border-left: 3px solid var(--color-terracotta, #c75b39);
    font-size: 12px;
    color: var(--color-terracotta, #c75b39);
    border-radius: 3px;
    width: 100%;
}

.cysa-lab-sim-container {
    margin-top: 8px;
}

.cysa-lab-empty,
.cysa-lab-error {
    padding: 20px;
    text-align: center;
    color: var(--ui-text-muted, #998a78);
    font-style: italic;
}
.cysa-lab-error { color: #ff8060; }

/* When cysa-lab-active body class is set (phases 1-3), shrink the
   story panel like rhcsa-lab does, to give the simulator room. */
body.cysa-lab-active .story-panel { width: 24% !important; min-width: 240px; }
body.cysa-lab-active .terminal-panel { width: 76% !important; }
