/* =================================================================
   tools/truth-table.css
   Auto-extracted from math.css (2026-05-11).
   Loaded via config/js-manifest.php → templates/partials/head-styles.php.
   ================================================================= */

/* Base .math-truth-table styles (table layout, headers, cells, hover,
   .result-col, .math-truth-zero/-one) live in core/math-core.css —
   they are shared with logic-gates which also renders a mini truth
   table. The rest of this file is truth-table-tool-specific. */

/* =================================================================
   TRUTH TABLE — legend, color coding, summary
   ================================================================= */
/* .math-truth-description (and `strong` inside) moved to core/math-core.css
   — shared with ascii-table which uses the same callout. */

.math-truth-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--math-text-soft);
    align-items: center;
}

.math-truth-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--math-surface-alt);
    border: 1px solid var(--math-border-light);
    padding: 6px 12px;
    border-radius: var(--math-radius-full);
}

.math-truth-legend-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 12px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.math-truth-legend-cell.zero {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.math-truth-legend-cell.one {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* .math-truth-table td.math-truth-zero / .math-truth-one (incl. the
   result-col variants) — moved to core/math-core.css (shared with
   logic-gates). */

.math-truth-col-label {
    display: block;
    font-size: 10px;
    color: var(--math-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.math-truth-summary {
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--math-surface-alt);
    border-radius: var(--math-radius-sm);
    border: 1px solid var(--math-border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 13px;
    color: var(--math-text-soft);
}

.math-truth-summary-item strong {
    color: var(--math-text);
    font-weight: 700;
}

/* =================================================================
   TRUTH TABLE — sub-expression columns, summary head, trace panel
   ================================================================= */

/* .math-truth-ops-hint (and .math-truth-ops-label, .math-truth-ops-hint code)
   moved to core/math-core.css — shared with bool-simplify which uses the
   same operators-hint callout below its expression input. */

/* Summary head above the table */
.math-truth-summary-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(16, 185, 129, 0.06));
    border: 1px solid var(--math-border-light);
    border-radius: var(--math-radius-sm);
}
.math-truth-summary-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 280px;
}
.math-truth-summary-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--math-text-muted);
    font-weight: 600;
}
.math-truth-summary-value {
    font-size: 16px;
    color: var(--math-text);
    font-weight: 600;
    word-break: break-word;
}
.math-truth-summary-value code {
    background: transparent;
    padding: 0;
    color: #4338ca;
    font-size: 15px;
}
.math-truth-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.math-truth-class-badge,
.math-truth-count-chip,
.math-truth-vars-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--math-radius-full);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--math-border-light);
    background: #fff;
    color: var(--math-text-soft);
}
.math-truth-class-badge[data-class="tautology"] {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.3);
}
.math-truth-class-badge[data-class="contradiction"] {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.3);
}
.math-truth-class-badge[data-class="contingent"] {
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    border-color: rgba(99, 102, 241, 0.3);
}
.math-truth-count-chip[data-val="one"] {
    background: rgba(16, 185, 129, 0.08);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.22);
}
.math-truth-count-chip[data-val="zero"] {
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.22);
}
.math-truth-vars-chip {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #4338ca;
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.22);
}

/* Accent spans in the description */
.math-truth-accent-sub {
    color: #b45309;
    background: rgba(251, 191, 36, 0.14);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.math-truth-accent-result {
    color: #047857;
    background: rgba(16, 185, 129, 0.14);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Sub-expression evaluation chain (pedagogy) */
.math-truth-subchain {
    margin-bottom: 14px;
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: var(--math-radius-sm);
}
.math-truth-subchain-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #b45309;
    margin-bottom: 10px;
}
.math-truth-subchain-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.math-truth-subchain-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid rgba(251, 191, 36, 0.4);
    padding: 5px 10px 5px 5px;
    border-radius: var(--math-radius-full);
    font-size: 12px;
}
.math-truth-subchain-step.is-final {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
}
.math-truth-subchain-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fbbf24;
    color: #78350f;
    font-weight: 700;
    font-size: 11px;
}
.math-truth-subchain-step.is-final .math-truth-subchain-num {
    background: #10b981;
    color: #fff;
}
.math-truth-subchain-step code {
    background: transparent;
    padding: 0;
    color: #78350f;
    font-size: 12px;
    font-weight: 600;
}
.math-truth-subchain-step.is-final code {
    color: #047857;
}
.math-truth-subchain-op {
    background: rgba(251, 191, 36, 0.2);
    color: #92400e;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.math-truth-subchain-step.is-final .math-truth-subchain-op {
    background: rgba(16, 185, 129, 0.25);
    color: #047857;
}
.math-truth-subchain-arrow {
    color: #d97706;
    font-weight: 700;
    font-size: 14px;
}

/* Extra legend cells for var/sub/result */
.math-truth-legend-cell.var-col {
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.25);
}
.math-truth-legend-cell.sub-col {
    background: rgba(251, 191, 36, 0.15);
    color: #b45309;
    border: 1px solid rgba(251, 191, 36, 0.35);
}
.math-truth-legend-cell.result-cell {
    background: rgba(16, 185, 129, 0.18);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.math-truth-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    background: rgba(99, 102, 241, 0.06);
    border-left: 3px solid #6366f1;
    border-radius: 0 4px 4px 0;
    font-size: 12.5px;
    color: #4338ca;
}
.math-truth-hint i {
    color: #eab308;
}

/* Wrapper for horizontal scroll on wide tables */
.math-truth-table-wrap {
    overflow-x: auto;
    margin-bottom: 14px;
    border: 1px solid var(--math-border-light);
    border-radius: var(--math-radius-sm);
    -webkit-overflow-scrolling: touch;
}
.math-truth-table-wrap .math-truth-table {
    margin: 0;
    min-width: 100%;
}

/* Column kind styling */
.math-truth-table th.math-truth-idx-col,
.math-truth-table td.math-truth-idx-cell {
    width: 40px;
    text-align: center;
    background: var(--math-surface-alt);
    color: var(--math-text-muted);
    font-weight: 500;
    font-size: 11px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}
.math-truth-table td.math-truth-idx-cell {
    border-right: 2px solid var(--math-border-light);
}

.math-truth-table th.math-truth-col-var {
    background: rgba(99, 102, 241, 0.08);
    color: #4338ca;
}
.math-truth-table th.math-truth-col-sub {
    background: rgba(251, 191, 36, 0.12);
    color: #b45309;
}
.math-truth-table th.math-truth-col-result {
    background: rgba(16, 185, 129, 0.14);
    color: #047857;
}
.math-truth-table th .math-truth-col-main code {
    font-size: 12.5px;
    background: transparent;
    padding: 0;
    color: inherit;
    font-weight: 600;
    white-space: nowrap;
}

.math-truth-table td.math-truth-col-sub {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-weight: 600;
}
.math-truth-table td.math-truth-col-sub.math-truth-zero {
    background: rgba(239, 68, 68, 0.06);
    color: #b91c1c;
}
.math-truth-table td.math-truth-col-sub.math-truth-one {
    background: rgba(16, 185, 129, 0.08);
    color: #047857;
}
.math-truth-table td.math-truth-col-result.math-truth-zero {
    background: rgba(239, 68, 68, 0.16);
    font-weight: 700;
    border-left: 2px solid rgba(239, 68, 68, 0.35);
}
.math-truth-table td.math-truth-col-result.math-truth-one {
    background: rgba(16, 185, 129, 0.2);
    font-weight: 700;
    border-left: 2px solid rgba(16, 185, 129, 0.45);
}
.math-truth-table th.math-truth-col-result {
    border-left: 2px solid rgba(16, 185, 129, 0.35);
}

/* Row hover + focus */
.math-truth-table tbody tr[data-row-idx] {
    cursor: pointer;
    transition: background 0.15s ease;
}
.math-truth-table tbody tr[data-row-idx]:hover td {
    background: rgba(99, 102, 241, 0.06);
}
.math-truth-table tbody tr.is-focused td {
    background: rgba(99, 102, 241, 0.12) !important;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.3);
}
.math-truth-table tbody tr.is-focused td.math-truth-col-result {
    background: rgba(16, 185, 129, 0.22) !important;
}

/* Trace panel */
.math-truth-trace-panel {
    margin-bottom: 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(251, 191, 36, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--math-radius-sm);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.math-truth-trace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}
.math-truth-trace-title {
    font-size: 13px;
    font-weight: 700;
    color: #4338ca;
    display: flex;
    align-items: center;
    gap: 8px;
}
.math-truth-trace-close {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--math-border-light);
    background: #fff;
    color: var(--math-text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}
.math-truth-trace-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #b91c1c;
}
.math-truth-trace-inputs {
    font-size: 13px;
    color: var(--math-text-soft);
    padding: 8px 12px;
    background: #fff;
    border-radius: var(--math-radius-sm);
    border: 1px solid var(--math-border-light);
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.math-truth-trace-inputs strong {
    color: var(--math-text);
    margin-right: 4px;
}
.math-truth-trace-var {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12.5px;
    font-weight: 600;
    color: #4338ca;
}
.math-truth-zero-pill,
.math-truth-one-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 12px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}
.math-truth-zero-pill {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.28);
}
.math-truth-one-pill {
    background: rgba(16, 185, 129, 0.16);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.32);
}

.math-truth-trace-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.math-truth-trace-step {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--math-border-light);
    border-left: 3px solid rgba(251, 191, 36, 0.5);
    border-radius: var(--math-radius-sm);
    font-size: 13px;
}
.math-truth-trace-step.is-result {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}
.math-truth-trace-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(251, 191, 36, 0.25);
    color: #92400e;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}
.math-truth-trace-step.is-result .math-truth-trace-num {
    background: #10b981;
    color: #fff;
}
.math-truth-trace-expr {
    background: rgba(99, 102, 241, 0.08);
    color: #4338ca;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}
.math-truth-trace-operands {
    background: rgba(251, 191, 36, 0.15);
    color: #b45309;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}
.math-truth-trace-step.is-result .math-truth-trace-operands {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}
.math-truth-trace-eq {
    color: var(--math-text-muted);
    font-weight: 700;
    font-size: 14px;
}
.math-truth-trace-badge {
    margin-left: auto;
    background: #10b981;
    color: #fff;
    padding: 2px 8px;
    border-radius: var(--math-radius-full);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.math-truth-trace-val {
    color: #047857;
    font-weight: 700;
}

/* Verdict row in outcome summary */
.math-truth-summary-verdict {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--math-radius-full);
    font-weight: 600;
}
.math-truth-summary-verdict[data-verdict="taut"] {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}
.math-truth-summary-verdict[data-verdict="contra"] {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}
.math-truth-summary-verdict[data-verdict="cont"] {
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
}

/* Mobile tweaks */
@media (max-width: 720px) {
    .math-truth-summary-head {
        flex-direction: column;
        align-items: stretch;
    }
    .math-truth-summary-main {
        flex: 0 0 auto;
    }
    .math-truth-summary-meta {
        gap: 6px;
    }
    .math-truth-class-badge,
    .math-truth-count-chip,
    .math-truth-vars-chip {
        font-size: 11.5px;
        padding: 4px 10px;
    }
    .math-truth-trace-step {
        font-size: 12px;
        padding: 7px 10px;
    }
    .math-truth-trace-expr,
    .math-truth-trace-operands {
        font-size: 11.5px;
    }
    .math-truth-subchain-list {
        gap: 4px;
    }
    .math-truth-table-wrap {
        border-radius: var(--math-radius-sm);
    }
}

