/* Statusword Calculator styles */

.sw-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.sw-word-toggle,
.sw-base-toggle {
    display: flex;
    gap: var(--space-xs);
}

.sw-input-row {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.sw-input-row .value-field {
    flex: 1;
}

.sw-values-display {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    flex-wrap: wrap;
}

.sw-val-label {
    color: var(--fg-muted);
    font-weight: 500;
}

/* Bit dots — fixed grid avoids the trailing-bit-on-its-own-row problem
   that flex-wrap caused at narrow widths. 16 columns on wide screens,
   collapsing to 8 on tablets and 4 on phones. */
.bit-dots {
    display: grid;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    gap: var(--space-xs);
    justify-items: center;
}
@media (max-width: 900px) {
    .bit-dots { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .bit-dots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.bit-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    min-width: 0;
    width: 100%;
}
.bit-dot:hover {
    background: var(--bg-elevated);
}

.bit-dot-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-card);
    transition: all 0.15s;
}
.bit-dot--active .bit-dot-indicator {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.bit-dot-label {
    font-size: 0.65rem;
    color: var(--fg-muted);
    font-family: var(--font-mono);
}

.bit-dot-name {
    font-size: 0.6rem;
    color: var(--fg-muted);
    max-width: 40px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Bits table state */
.bit-active {
    color: var(--success);
    font-weight: 600;
}
.bit-inactive {
    color: var(--fg-muted);
}

/* State machine */
.state-machine {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
}

.state-node {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--fg-secondary);
    transition: all 0.2s;
    text-align: center;
    min-width: 120px;
}

.state-node--active {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.state-node--fault {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

@media (max-width: 768px) {
    .sw-input-row {
        flex-direction: column;
    }
    .sw-values-display {
        font-size: 0.7rem;
    }
}
