/* ═══════════════════════════════════════════════════════════════
   Copilot Design Contract
   Site-wide CSS shared by HtmlContentSection (workspace) and
   DynamicBlock (chat). Both surfaces use the same visual language —
   metric grids, status badges, bar tracks, color palette — so
   Claude-authored HTML and structured-block markup look unified.

   Selectors target both:
     .html-content-section  (Pages/Shared/Components/HtmlContentSection.razor)
     .copilot-block         (NWCWebApp2022.Copilot DynamicBlock.razor)
   ═══════════════════════════════════════════════════════════════ */

.html-content-section,
.copilot-block {
    font-size: 0.875rem; /* off-scale — sits between --font-size-md (0.85) and --font-size-base (0.9) */
    line-height: var(--line-height-normal);
    color: var(--bs-body-color);
}

/* ─── Headings (HTML escape hatch) ─── */
.html-content-section h3,
.copilot-block h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 0 0 var(--space-sm);
}

.html-content-section h4,
.copilot-block h4 {
    font-size: 0.875rem; /* off-scale */
    font-weight: var(--font-weight-semibold);
    margin: var(--space-md) 0 var(--space-2xs);
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

/* ─── Tables ─── */
.html-content-section table,
.copilot-block table,
.copilot-block-data-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-sm) 0;
}

.html-content-section th,
.copilot-block th,
.copilot-block-data-table th {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em; /* off-scale, between --letter-spacing-wide and --letter-spacing-wider */
    color: var(--bs-secondary-color);
    padding: var(--space-2xs) var(--space-sm);
    border-bottom: 1px solid var(--bs-border-color);
    text-align: left;
}

.html-content-section td,
.copilot-block td,
.copilot-block-data-table td {
    padding: var(--space-xs) var(--space-sm);
    border-bottom: 1px solid var(--bs-border-color-translucent);
    vertical-align: top;
}

.html-content-section tr:last-child td,
.copilot-block tr:last-child td,
.copilot-block-data-table tr:last-child td {
    border-bottom: none;
}

.copilot-block-data-table-wrapper {
    overflow-x: auto;
    margin: 4px 0;
}

.copilot-block-row-actions {
    white-space: nowrap;
    text-align: right;
}

.copilot-block-row-btn {
    font-size: 10px; /* off-scale, finer than --font-size-2xs */
    font-weight: var(--font-weight-semibold);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #d1d5db; /* Tailwind gray-300 */
    background: var(--surface-default);
    color: #374151; /* Tailwind gray-700 */
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.copilot-block-row-btn:hover:not(:disabled) {
    background: #eff6ff; /* Tailwind blue-50 */
    border-color: #bfdbfe; /* Tailwind blue-200 */
    color: #1d4ed8; /* Tailwind blue-700 */
}

.copilot-block-row-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Metric grid (summary cards) ─── */
.html-content-section .metric-grid,
.copilot-block .metric-grid,
.copilot-block-summary-card .metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: var(--space-sm);
    margin: var(--space-sm) 0;
}

.html-content-section .metric-card,
.copilot-block .metric-card,
.copilot-block-summary-card .metric-card {
    background: var(--bs-tertiary-bg);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    text-align: center;
}

.html-content-section .metric-val,
.copilot-block .metric-val,
.copilot-block-summary-card .metric-val {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    display: block;
}

.html-content-section .metric-label,
.copilot-block .metric-label,
.copilot-block-summary-card .metric-label {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wider);
    color: var(--bs-secondary-color);
}

.copilot-block-summary-title {
    margin: 0 0 var(--space-2xs);
}

/* ─── Status badges ─── */
.html-content-section .status-badge,
.copilot-block .status-badge {
    display: inline-block;
    padding: var(--status-badge-padding);
    border-radius: var(--status-badge-radius);
    font-size: var(--status-badge-font-size);
    font-weight: var(--font-weight-medium);
}

.html-content-section .status-draft,
.copilot-block .status-draft       { background: var(--state-warning-bg); color: var(--state-warning-fg); }
.html-content-section .status-complete,
.copilot-block .status-complete    { background: var(--state-success-bg); color: var(--state-success-fg); }
.html-content-section .status-pending,
.copilot-block .status-pending     { background: var(--state-neutral-bg); color: var(--state-neutral-fg); }

/* ─── Progress / composition bars ─── */
.html-content-section .bar-track,
.copilot-block .bar-track,
.copilot-block-composition .bar-track {
    display: flex;
    height: 8px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bs-tertiary-bg);
    margin: var(--space-2xs) 0;
}

.html-content-section .bar-fill,
.copilot-block .bar-fill,
.copilot-block-composition .bar-fill {
    height: 100%;
    transition: width 0.3s ease;
}

/* Tableau 10 chart palette — intentional chart-specific palette, leave alone */
.html-content-section .color-1,
.copilot-block .color-1 { background: #4e79a7; }
.html-content-section .color-2,
.copilot-block .color-2 { background: #f28e2b; }
.html-content-section .color-3,
.copilot-block .color-3 { background: #e15759; }
.html-content-section .color-4,
.copilot-block .color-4 { background: #76b7b2; }
.html-content-section .color-5,
.copilot-block .color-5 { background: #59a14f; }

/* ─── Composition legend ─── */
.copilot-block-composition {
    margin: 4px 0 6px;
}

.copilot-block-composition-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.copilot-block-legend-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.copilot-block-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 2px;
    vertical-align: middle;
}

/* ─── Action buttons (vertical full-width stack) ─── */
.copilot-block-action-buttons .copilot-block-actions,
.copilot-block-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 6px 0;
}

.copilot-block-action-buttons .copilot-chip,
.copilot-block-actions .copilot-chip {
    width: 100%;
    text-align: center;
    white-space: normal;
    max-width: 100%;
}

/* ─── Summary card bars ─── */
.copilot-block-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.copilot-block-bar-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.copilot-block-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px; /* off-scale */
    color: var(--bs-secondary-color);
}

/* ─── Plan-status block ─── */
.copilot-block-plan-status {
    background: #f9fafb; /* Tailwind gray-50 */
    border: 1px solid #e5e7eb; /* Tailwind gray-200 */
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    margin: 4px 0;
}

.copilot-block-plan-steps {
    display: flex;
    align-items: center;
    gap: 0;
}

.copilot-block-plan-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.copilot-block-plan-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #d1d5db; /* Tailwind gray-300 */
    background: var(--surface-default);
    color: #9ca3af; /* Tailwind gray-400 */
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.copilot-block-plan-step.active .copilot-block-plan-circle {
    border-color: #2563eb; /* Tailwind blue-600 */
    background: #2563eb;
    color: var(--white);
}

.copilot-block-plan-step.complete .copilot-block-plan-circle {
    border-color: var(--green-500);
    background: var(--green-500);
    color: var(--white);
    font-size: 12px;
}

.copilot-block-plan-label {
    font-size: 10px;
    font-weight: var(--font-weight-medium);
    color: #6b7280; /* Tailwind gray-500 */
    white-space: nowrap;
}

.copilot-block-plan-step.active .copilot-block-plan-label,
.copilot-block-plan-step.complete .copilot-block-plan-label {
    color: #111827; /* Tailwind gray-900 */
}

.copilot-block-plan-connector {
    flex: 1;
    height: 2px;
    background: #e5e7eb; /* Tailwind gray-200 */
    margin-bottom: 14px;
    min-width: 16px;
}

.copilot-block-plan-connector.filled {
    background: var(--green-500);
}

.copilot-block-plan-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

/* ─── Fallback (unknown type) ─── */
.copilot-block-fallback {
    background: var(--bs-tertiary-bg);
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    margin: 4px 0;
    font-size: 12px;
}

.copilot-block-fallback-title {
    font-weight: var(--font-weight-semibold);
    margin-bottom: 4px;
}

.copilot-block-fallback-json {
    font-size: 11px;
    margin: 0;
    padding: 0;
    background: transparent;
    color: var(--bs-secondary-color);
    white-space: pre-wrap;
    word-break: break-word;
}
