/* =========================================================
   BCD Addition Visualiser Widget
   File: bcd_addition_widget.css
   ========================================================= */

.bcd-add-widget {
    margin: 1.5rem 0;
    padding: 1.25rem;
    border-radius: 22px;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.bcd-add-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.bcd-add-inputs label {
    display: block;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.35rem;
}

.bcd-add-inputs input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    background: white;
    color: #0f172a;
    font-size: 1rem;
}

.bcd-add-inputs input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.bcd-add-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 1rem 0;
}

.bcd-add-buttons button {
    border: none;
    cursor: pointer;
    padding: 0.7rem 1.05rem;
    border-radius: 999px;
    background: #0f172a;
    color: white;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.bcd-add-buttons button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.bcd-add-buttons button:active:not(:disabled) {
    transform: scale(0.98);
}

.bcd-add-buttons button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#bcdAddNext {
    background: #2563eb;
}

#bcdAddReset {
    background: white;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.bcd-add-display,
.bcd-add-working,
.bcd-add-final {
    margin-top: 1.25rem;
    padding: 1rem;
    border-radius: 18px;
    background: white;
    border: 1px solid #e2e8f0;
}

.bcd-add-display h3,
.bcd-add-working h3 {
    margin-top: 0;
    color: #0f172a;
}

.bcd-add-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    margin: 0.45rem 0;
}

.bcd-add-row span {
    color: #475569;
    font-weight: 700;
}

.bcd-add-row strong,
.bcd-add-final strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    color: #0f172a;
    word-break: break-word;
}

.bcd-nibble-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.bcd-nibble {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 0.55rem 0.65rem;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.bcd-nibble strong {
    font-size: 0.95rem;
    color: #0f172a;
}

.bcd-nibble span {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.bcd-nibble.active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.bcd-nibble.corrected {
    border-color: #f97316;
    background: #fff7ed;
}

.bcd-nibble.valid {
    border-color: #22c55e;
    background: #f0fdf4;
}

.bcd-add-step-card {
    margin: 0.85rem 0;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    animation: bcdStepIn 0.25s ease both;
}

.bcd-add-step-card h4 {
    margin: 0 0 0.5rem;
    color: #0f172a;
}

.bcd-add-step-card p {
    margin: 0.4rem 0;
    color: #334155;
}

.bcd-add-step-card code {
    padding: 0.1rem 0.35rem;
    border-radius: 8px;
    background: #e2e8f0;
    color: #0f172a;
    font-size: 0.92rem;
}

.bcd-step-equation {
    margin: 0.6rem 0;
    padding: 0.75rem;
    border-radius: 14px;
    background: white;
    border: 1px solid #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    color: #0f172a;
    overflow-x: auto;
}

.bcd-correction-box {
    margin-top: 0.7rem;
    padding: 0.85rem;
    border-radius: 16px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #7c2d12;
}

.bcd-valid-box {
    margin-top: 0.7rem;
    padding: 0.85rem;
    border-radius: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #14532d;
}

.bcd-current-message {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
}

.bcd-add-final {
    background: #faf5ff;
    border-color: #e9d5ff;
    color: #581c87;
    font-weight: 700;
}

.bcd-add-final strong {
    color: #581c87;
}

.bcd-add-mini-label {
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 800;
}

.bcd-add-warning {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #7c2d12;
}

@keyframes bcdStepIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    .bcd-add-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .bcd-nibble {
        min-width: 58px;
    }
}