/* CoCoAdmin-specific styles */
/* Uses MudBlazor components exclusively - add custom styles here only when MudBlazor doesn't provide what's needed */
/* All custom classes must use the coco- prefix */
/* Status chip CSS classes are in CoCoPlatform.Web.Components/wwwroot/coco-layout.css (shared) */

/* ── Brand Colors — Complementary Ventures navy ──────────
   Overrides the shared coco-layout.css defaults (orange) so custom CSS that
   reads var(--coco-primary) matches AdminCoCoTheme.cs. Loaded after
   coco-layout.css (see App.razor), so this :root wins. */
:root {
    --coco-primary: #1F3A5F;
    --coco-primary-dark: #192E4C;
    --coco-primary-light: #E7ECF2;
    --coco-primary-rgb: 31, 58, 95;
}

/* ── Health Bar ────────────────────────────────────────── */

.coco-health-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.coco-health-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 8px;
    border: 1px solid var(--mud-palette-lines-default);
    border-left: 4px solid var(--coco-success);
    background: var(--mud-palette-surface);
    min-width: 170px;
    flex: 1 1 170px;
}

/* Push the optional help-popover anchor to the far right of the card. */
.coco-health-card > .coco-help-popover-anchor {
    margin-left: auto;
}

.coco-health-card-error {
    border-left-color: var(--coco-error);
    background: rgba(220, 53, 69, 0.04);
}

.coco-health-card-ok .mud-icon-root {
    color: var(--coco-success);
    opacity: 0.7;
}

.coco-health-card-error .mud-icon-root {
    color: var(--coco-error);
}

.coco-health-card-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.coco-health-card-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.coco-health-card-value {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.2;
}

.coco-health-card-ok .coco-health-card-value {
    color: var(--coco-success);
}

/* Zero-state KPIs — inert gray, no alarm signal */
.coco-health-card-zero {
    border-left-color: var(--mud-palette-lines-default);
}

.coco-health-card-zero .mud-icon-root {
    color: var(--mud-palette-text-secondary);
    opacity: 0.5;
}

.coco-health-card-zero .coco-health-card-value {
    color: var(--mud-palette-text-secondary);
    font-weight: 500;
}

.coco-health-card-error .coco-health-card-value {
    color: var(--coco-error);
}

/* Warning-state KPIs — amber, issues that aren't critical */
.coco-health-card-warning {
    border-left-color: var(--mud-palette-warning);
    background: rgba(255, 152, 0, 0.04);
}

.coco-health-card-warning .mud-icon-root {
    color: var(--mud-palette-warning);
}

.coco-health-card-warning .coco-health-card-value {
    color: var(--mud-palette-warning);
}

.coco-health-card-running {
    border-left-color: var(--mud-palette-info);
    background: rgba(var(--coco-primary-rgb), 0.04);
}

.coco-health-card-running .mud-icon-root,
.coco-health-card-running .coco-health-card-value {
    color: var(--mud-palette-info);
}

/* ── Unified Activity Detail ──────────────────────────── */

.coco-grid-fill .mud-table-row.coco-row-selected > .mud-table-cell {
    background-color: color-mix(in srgb, rgb(var(--coco-primary-rgb)) 12%, var(--mud-palette-surface));
}

.coco-activity-timeline-event {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 18px;
}

.coco-activity-timeline-time {
    white-space: nowrap;
}

.coco-activity-timeline-body {
    min-width: 0;
}

.coco-activity-no-problems {
    color: var(--coco-success);
}

.coco-activity-technical-value,
.coco-activity-json {
    overflow-wrap: anywhere;
}

.coco-activity-json {
    white-space: pre-wrap;
    margin: 8px 0 0;
    padding: 12px;
    border-radius: 4px;
    background: var(--mud-palette-background-grey);
}

/* ── Problems Zone ─────────────────────────────────────── */

.coco-operations-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.coco-health-card-checked {
    color: var(--mud-palette-text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
}

.coco-health-card-checked-toggle {
    align-self: flex-start;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    line-height: inherit;
    text-align: left;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
}

.coco-health-card-checked-toggle:hover {
    color: var(--mud-palette-primary);
}

.coco-health-card-checked-toggle:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.coco-health-evidence-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 6px 0;
    min-width: 300px;
}

.coco-operations-panel {
    height: 100%;
}

.coco-healthy-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 76px;
    color: var(--coco-success);
}

.coco-attention-list {
    display: flex;
    flex-direction: column;
    max-height: 360px;
    overflow-y: auto;
}

.coco-attention-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.coco-attention-row:first-child {
    border-top: 0;
}

.coco-attention-row-content {
    flex: 1;
    min-width: 0;
}

.coco-attention-row-unavailable {
    background: rgba(255, 152, 0, 0.04);
}

.coco-log-counts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    overflow: hidden;
}

.coco-log-count {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    color: inherit;
    text-decoration: none;
    border-left: 1px solid var(--mud-palette-lines-default);
}

.coco-log-count:first-child {
    border-left: 0;
}

.coco-log-count:hover:not([aria-disabled="true"]) {
    background: var(--mud-palette-background-grey);
}

.coco-log-count[aria-disabled="true"] {
    cursor: default;
}

.coco-log-count-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 8px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.coco-log-count-error {
    color: var(--coco-error);
}

.coco-log-count-warning {
    color: var(--mud-palette-warning);
}

@media (max-width: 959px) {
    .coco-operations-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 599px) {
    .coco-log-counts {
        grid-template-columns: 1fr;
    }

    .coco-log-count {
        border-left: 0;
        border-top: 1px solid var(--mud-palette-lines-default);
    }

    .coco-log-count:first-child {
        border-top: 0;
    }
}

.coco-problems-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.coco-problem-card {
    border-radius: 8px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    overflow: hidden;
}

/* Section-level accent — single red border on the "Needs Attention" header */
.coco-attention-header {
    border-left: 4px solid var(--coco-error);
    padding-left: 12px;
    margin-bottom: 16px;
}

.coco-problem-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--mud-palette-background);
}

.coco-problem-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.coco-poison-group {
    margin-left: 24px;
    padding: 4px 0 8px;
    border-left: 2px solid var(--mud-palette-lines-default);
    padding-left: 12px;
}

.coco-poison-group-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}

.coco-poison-dialog-group {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    padding: 12px;
}

.coco-poison-dialog-group-header {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    margin-bottom: 8px;
}

.coco-poison-dialog-message {
    padding: 8px 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

    .coco-poison-dialog-message:last-child {
        border-bottom: none;
    }


/* ── Dashboard Cards & KPIs ────────────────────────────── */

.coco-dashboard-card {
    min-height: 100px;
}

.coco-dashboard-card-clickable {
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.coco-dashboard-card-clickable:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.coco-dashboard-card-alert {
    border-left: 4px solid var(--mud-palette-error);
}

/* kpi-number is defined in coco-layout.css (shared) */

/* ── Job Properties tab ────────────────────────────────── */

/* Reserve vertical space in view mode so the layout doesn't shift
   when the user clicks Edit and inputs replace caption+body text. */
.coco-job-property-cell {
    min-height: 64px;
}

/* ── Execution Detail summary grid ─────────────────────── */

.coco-execution-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px 24px;
}

/* Data Retention rule details: label/value fact rows. */
.coco-retention-facts td:first-child {
    width: 200px;
    color: var(--mud-palette-text-secondary);
    vertical-align: top;
}
.coco-retention-facts td {
    vertical-align: top;
}
