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

/* ─── Logic Gate toggle buttons ───────────────────────── */
.math-gate-toggle {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--math-border);
    border-radius: var(--math-radius-sm);
    background: var(--math-surface);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.math-gate-toggle .math-gate-toggle-val {
    font-size: 24px;
    font-weight: 800;
    color: var(--math-error);
    transition: all 0.2s ease;
}

.math-gate-toggle.active {
    border-color: var(--math-success);
    background: rgba(16, 185, 129, 0.1);
}

.math-gate-toggle.active .math-gate-toggle-val {
    color: var(--math-success);
}

.math-gate-toggle:hover {
    border-color: var(--math-primary);
    transform: scale(1.02);
}

/* ─── Logic Gate visual (IEEE schematic) ─────────────── */
.math-gate-visual {
    display: block;
}

.math-gate-svg .math-gate-wire {
    transition: stroke 0.25s ease;
}

.math-gate-svg .math-gate-wire--interactive {
    cursor: pointer;
}

.math-gate-svg .math-gate-wire--interactive:hover {
    stroke-width: 4.5;
}

.math-gate-svg .math-gate-wire--on {
    stroke-dasharray: 6 4;
    animation: mathGateDashflow 0.9s linear infinite;
}

@keyframes mathGateDashflow {
    from { stroke-dashoffset: 20; }
    to   { stroke-dashoffset: 0; }
}

.math-gate-svg .math-gate-body {
    transition: stroke 0.25s ease, fill 0.25s ease;
}

.math-gate-svg .math-gate-led--on {
    animation: mathGateLedPulse 1.4s ease-in-out infinite;
    transform-origin: 340px 90px;
}

@keyframes mathGateLedPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.82; }
}

/* ─── Gate formula line ──────────────────────────────── */
.math-gate-formula {
    margin: 14px auto 0;
    max-width: 420px;
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 15px;
    color: var(--math-text);
    background: var(--math-surface-alt);
    border-radius: var(--math-radius-sm);
    border: 1px solid var(--math-border);
}

.math-gate-formula:empty {
    display: none;
}

.math-gate-formula-expr {
    font-weight: 700;
    color: var(--math-primary);
}

.math-gate-formula-arrow {
    color: var(--math-primary);
    opacity: 0.55;
    font-weight: 700;
}

.math-gate-formula-calc {
    font-weight: 600;
}

.math-gate-formula-result {
    display: inline-block;
    min-width: 22px;
    padding: 2px 8px;
    border-radius: 6px;
    text-align: center;
    font-weight: 800;
    color: #fff;
    margin-left: 4px;
}

.math-gate-formula-result.on  { background: var(--math-success); }
.math-gate-formula-result.off { background: var(--math-error); }

.math-gate-overline {
    display: inline-block;
    border-top: 1.8px solid currentColor;
    padding-top: 1px;
    line-height: 1.1;
}

/* ─── Truth table active row (flash on change) ───────── */
.math-truth-table tr.math-truth-row--active {
    background: var(--math-primary-soft);
}

.math-truth-table tr.math-truth-row--active td {
    font-weight: 800;
}

.math-truth-table tr.math-truth-row--flash {
    animation: mathTruthFlash 0.5s ease-out;
}

@keyframes mathTruthFlash {
    0%   { background: var(--math-primary-glow); box-shadow: inset 0 0 0 2px var(--math-primary); }
    100% { background: var(--math-primary-soft); box-shadow: inset 0 0 0 0 transparent; }
}

/* ─── Logic Gate mobile-friendly input layout ────────── */
.math-gate-inputs-row {
    display: flex;
    flex-direction: row !important;
    gap: 12px;
}

.math-gate-inputs-row .math-field {
    flex: 1 1 0 !important;
    min-width: 0 !important;
}

.math-gate-type-row .math-field {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
}

/* ─── Gate hotkey hint ───────────────────────────────── */
.math-gate-hint {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 12px;
    color: var(--math-text);
    opacity: 0.65;
}

.math-gate-hint i {
    font-size: 14px;
    color: var(--math-primary);
    opacity: 0.7;
}

@media (max-width: 640px) {
    /* Hide hotkey hint on mobile (no keyboard) */
    .math-gate-hint { display: none; }
    .math-gate-formula { font-size: 13px; padding: 8px 10px; gap: 6px; }
    .math-gate-inputs-row { gap: 10px; }
    .math-gate-toggle { height: 44px; }
    .math-gate-toggle .math-gate-toggle-val { font-size: 20px; }
    /* logic-gates has 4 buttons — scale font down a touch */
    .math-tool-panel[data-tool="logic-gates"] .math-actions-row .math-btn {
        font-size: 13px;
        padding-left: 8px;
        padding-right: 8px;
    }
}

