/*
 * budget-builder activity styles.
 *
 * Top summary panel: cap, allocated, remaining + progress bar.
 * Below: a list of category rows, each with a label, a number input,
 * and a slider (synced). When over-cap, the progress bar turns red.
 */

.bb-mode-chip {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background: var(--maths-surface-alt);
    color: var(--maths-primary-dark);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bb-target-label { font-weight: 800; color: #8a5a00; font-size: 0.95rem; margin-right: 0.5rem; }
.bb-target-prompt { flex: 1 1 auto; color: #6b4500; font-weight: 700; font-size: 1rem; }

.bb-summary {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.6rem 1rem;
}

.bb-summary-row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.bb-summary-label {
    font-weight: 700;
    color: var(--maths-ink-muted);
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 0.05em;
}

.bb-summary-value {
    font-weight: 800;
    font-size: 1.85rem;
    color: var(--maths-primary-dark);
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: baseline;
}

.bb-cap-input {
    width: 5rem !important;
    text-align: left !important;
    background: transparent !important;
    border: 2px solid transparent !important;
    font-weight: 800 !important;
    font-size: 1.85rem !important;
    color: var(--maths-primary-dark) !important;
    padding: 0 !important;
    pointer-events: none;
}

.bb-summary-allocated { color: var(--maths-primary-dark); }
.bb-summary-remaining { color: var(--maths-success); }
.bb-summary-remaining.is-overage { color: var(--maths-danger); }
.bb-summary-remaining.is-exact { color: #166534; }

.bb-progress-bar {
    grid-column: 1 / 4;
    height: 22px;
    background: var(--maths-grid-line);
    border-radius: 999px;
    overflow: hidden;
}

.bb-progress-fill {
    height: 100%;
    background: var(--maths-primary);
    border-radius: 999px;
    transition: width 200ms ease, background-color 200ms ease;
    width: 0;
}

.bb-progress-fill.is-overage { background: var(--maths-danger); }
.bb-progress-fill.is-exact { background: var(--maths-success); }

.bb-categories {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.bb-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px dashed var(--maths-border);
}

.bb-row:last-child { border-bottom: none; }

.bb-row-label {
    font-weight: 700;
    color: var(--maths-ink);
    font-size: 1.1rem;
}

/* Stepper cluster: −€5 −€1 [€value] +€1 +€5. Replaces the slider+input
 * combo with primary-finger-friendly buttons that commit one euro per tap. */
.bb-row-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 2px solid var(--maths-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.bb-row-step-btn {
    min-width: 56px;
    min-height: 44px;
    border: 0;
    border-right: 1px solid var(--maths-border);
    background: var(--maths-surface-alt);
    color: var(--maths-primary-dark);
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.4rem;
    font-variant-numeric: tabular-nums;
}

.bb-row-step-btn:last-child { border-right: 0; }
.bb-row-step-btn:hover { background: var(--maths-surface); }
.bb-row-step-btn:active { background: var(--maths-primary); color: #fff; }
.bb-row-step-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.bb-row-step-btn.bb-row-step-down { color: #B04A3F; }

.bb-row-value {
    min-width: 4.5rem;
    text-align: center;
    align-self: center;
    padding: 0 0.6rem;
    background: #fff;
    color: var(--maths-primary-dark);
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    font-variant-numeric: tabular-nums;
    border-left: 1px solid var(--maths-border);
    border-right: 1px solid var(--maths-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bb-your-turn {
    background: #FFF7DE;
    border: 1px solid #F0C14B;
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
    margin-top: 1rem;
}

.bb-your-turn-label { font-weight: 800; color: #8a5a00; margin-bottom: 0.4rem; }
.bb-your-turn-list { margin: 0; padding-left: 1.2rem; color: #5e3c00; font-weight: 600; }

body.display-mode .bb-cap-input,
body.display-mode #resetButton,
body.display-mode .bb-row-step-btn {
    pointer-events: none;
}

body.display-mode .bb-row-step-btn { display: none; }
body.display-mode .bb-row-value {
    background: transparent;
    border: 0;
}
body.display-mode .bb-row-stepper {
    border: 2px solid transparent;
    background: transparent;
}

body.display-mode .bb-cap-input {
    border: 2px solid transparent !important;
    background: transparent !important;
}
