/* =========================================================================
   Baking Calculator Suite — public stylesheet (v1.0.13)

   All rules are scoped under `.bcs-app` or the `bcs-` BEM prefix.
   No global element selectors, no resets, no leak into the host theme.
   All text is at least 13px (1rem = 16px baseline assumption).

   Visual language matches the rest of the KnifeKettle plugin family
   (Kitchen Converters, BudgetFlow Pro):
     - accent:        #4f46e5  (indigo-600)
     - app max-width: 1180px
     - app padding:   32px 24px
     - body text:     16px
     - H1:            24px / 800
     - input:         16px / 48px min / 8px radius / slate-300
     - label:         14px / 600 / slate-800
     - button:        13px / 600 / 6px radius / 12px 16px
     - tabs:          segmented-control, text+pill (KC style)
   ========================================================================= */

/* ----- App container ------------------------------------------------------- */
.bcs-app {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: #0f172a;                            /* slate-900 */
    background: #f8fafc;                       /* slate-50 (page surface) */
    max-width: 1180px;
    margin: 0 auto 24px auto;
    padding: 32px 24px;
    border-radius: 12px;
    box-sizing: border-box;
}
.bcs-app *,
.bcs-app *::before,
.bcs-app *::after { box-sizing: border-box; }

/* ----- Header card -------------------------------------------------------- */
.bcs-app__header {
    margin: 0 0 24px 0;
    padding: 0 0 20px 0;
    border-bottom: 1px solid #e2e8f0;         /* slate-200 */
}
.bcs-app__eyebrow {
    margin: 0 0 6px 0;
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #4f46e5;                            /* indigo-600 (family accent) */
    font-weight: 700;
}
.bcs-app__title {
    margin: 0 0 8px 0;
    font-size: 24px;
    line-height: 1.25;
    color: #0f172a;                            /* slate-900 */
    font-weight: 800;
    letter-spacing: -0.01em;
}
.bcs-app__tagline {
    margin: 0 0 8px 0;
    color: #475569;                            /* slate-600 */
    font-size: 15px;
}
.bcs-app__meta {
    margin: 0;
    color: #64748b;                            /* slate-500 */
    font-size: 13px;
}
.bcs-app__version-label { font-weight: 600; color: #475569; }
.bcs-app__version { color: #0f172a; font-weight: 600; }

/* ----- Tool nav (segmented control, KC-style) --------------------------- */
.bcs-app__nav { margin: 0 0 24px 0; }
.bcs-tool-nav {
    list-style: none;
    margin: 0;
    padding: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: #ffffff;
    border: 1px solid #e5e7eb;                 /* slate-200-ish */
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.bcs-tool-nav__item { margin: 0; padding: 0; flex: 0 0 auto; }
.bcs-tool-nav__btn {
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;                            /* slate-600 */
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
    line-height: 1.3;
    white-space: nowrap;
    min-height: 32px;
}
.bcs-tool-nav__btn:hover {
    background: #f1f5f9;                       /* slate-100 */
    color: #0f172a;                            /* slate-900 */
}
.bcs-tool-nav__btn:focus-visible {
    outline: 3px solid #c7d2fe;                 /* indigo-200 */
    outline-offset: 2px;
}
.bcs-tool-nav__btn.is-active {
    background: #4f46e5;                        /* indigo-600 */
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}
.bcs-tool-nav__btn.is-active:hover {
    background: #4338ca;                        /* indigo-700 */
    color: #ffffff;
}

/* ----- Tool panel (white card on the soft surface) ----------------------- */
.bcs-app__panels { position: relative; }
.bcs-tool-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;                 /* slate-200 */
    border-radius: 12px;
    padding: 28px 28px 24px 28px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.bcs-tool-panel[hidden] { display: none !important; }
.bcs-tool-panel__header { margin: 0 0 20px 0; padding: 0 0 16px 0; border-bottom: 1px solid #e2e8f0; }
.bcs-tool-panel__title {
    margin: 0 0 4px 0;
    font-size: 20px;
    line-height: 1.3;
    color: #0f172a;
    font-weight: 700;
}
.bcs-tool-panel__description {
    margin: 0;
    color: #475569;
    font-size: 15px;
}

/* ----- Form fields ------------------------------------------------------- */
.bcs-form { margin: 0; }
.bcs-field {
    margin: 0 0 18px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bcs-field__label {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;                            /* slate-800 */
    line-height: 1.3;
}
.bcs-required {
    color: #dc2626;
    font-weight: 700;
    margin-left: 2px;
}
.bcs-form__hint {
    margin: 0;
    color: #64748b;                            /* slate-500 */
    font-size: 13px;
    line-height: 1.4;
}

/* Inputs and selects — higher specificity to beat the host theme. */
.bcs-app input.bcs-input,
.bcs-app select.bcs-input,
.bcs-app textarea.bcs-input,
.bcs-app input[type="number"].bcs-input,
.bcs-app input[type="text"].bcs-input,
.bcs-app select.bcs-input {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    font-size: 16px;
    line-height: 1.4;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #cbd5e1;                 /* slate-300 */
    border-radius: 8px;
    padding: 12px 14px;
    min-height: 48px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    box-shadow: none;
    background-image: none;
    margin: 0;
}
.bcs-app input.bcs-input:hover,
.bcs-app select.bcs-input:hover,
.bcs-app textarea.bcs-input:hover { border-color: #94a3b8; }
.bcs-app input.bcs-input:focus,
.bcs-app select.bcs-input:focus,
.bcs-app textarea.bcs-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}
.bcs-app input.bcs-input:disabled,
.bcs-app select.bcs-input:disabled { background: #f1f5f9; color: #64748b; cursor: not-allowed; }

/* Select arrow — uniform across browsers. */
.bcs-app select.bcs-input {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

/* ----- Checkbox & radio -------------------------------------------------- */
.bcs-app .bcs-checkbox,
.bcs-app .bcs-radio {
    font-size: 14px;
    color: #1f2937;
}
.bcs-app .bcs-checkbox__input,
.bcs-app .bcs-radio__input { cursor: pointer; accent-color: #4f46e5; }
.bcs-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.bcs-app .bcs-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    min-height: 40px;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.bcs-app .bcs-radio:hover { background: #f8fafc; }
.bcs-app .bcs-radio:has(.bcs-radio__input:checked) {
    background: #eef2ff;                       /* indigo-50 */
    border-color: #4f46e5;
    color: #4338ca;
    font-weight: 600;
}

/* ----- dynamic_rows ------------------------------------------------------ */
.bcs-dynrows { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.bcs-dynrows__rows { display: flex; flex-direction: column; gap: 8px; }
.bcs-dynrow {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 8px;
    align-items: end;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}
.bcs-dynrow__col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bcs-dynrow__label { font-size: 13px; font-weight: 600; color: #475569; }
.bcs-dynrow__col .bcs-input { min-height: 40px; padding: 8px 10px; font-size: 15px; }
.bcs-dynrow__actions { display: flex; align-items: end; }
.bcs-dynrows__actions { margin-top: 4px; }

/* ----- Buttons ----------------------------------------------------------- */
.bcs-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}
.bcs-app .bcs-btn,
.bcs-app button.bcs-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 6px;
    border: 1px solid transparent;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    min-height: 40px;
    text-decoration: none;
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
    background-image: none;
    box-shadow: none;
    text-shadow: none;
    letter-spacing: 0.01em;
}
.bcs-app .bcs-btn:focus-visible { outline: 3px solid #c7d2fe; outline-offset: 2px; }
.bcs-app .bcs-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.bcs-app .bcs-btn--primary,
.bcs-app button.bcs-btn--primary,
.bcs-app button[type="submit"].bcs-btn {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}
.bcs-app .bcs-btn--primary:hover:not(:disabled),
.bcs-app button.bcs-btn--primary:hover:not(:disabled),
.bcs-app button[type="submit"].bcs-btn:hover:not(:disabled) {
    background: #4338ca;
    border-color: #4338ca;
}

.bcs-app .bcs-btn--ghost,
.bcs-app button.bcs-btn--ghost,
.bcs-app button[type="reset"].bcs-btn {
    background: #ffffff;
    color: #1f2937;
    border-color: #cbd5e1;
}
.bcs-app .bcs-btn--ghost:hover:not(:disabled),
.bcs-app button.bcs-btn--ghost:hover:not(:disabled),
.bcs-app button[type="reset"].bcs-btn:hover:not(:disabled) {
    background: #f8fafc;
    color: #0f172a;
    border-color: #94a3b8;
}

.bcs-app .bcs-btn--small {
    min-height: 32px;
    min-width: 0;
    padding: 6px 10px;
    font-size: 13px;
}

/* ----- Back link (single-tool shortcode) --------------------------------- */
.bcs-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}
.bcs-back-link:hover { color: #0f172a; background: #f8fafc; }
.bcs-back-link__chevron { font-size: 16px; line-height: 1; }

/* ----- Result region ----------------------------------------------------- */
.bcs-result {
    margin-top: 20px;
    padding: 20px 22px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
.bcs-result[hidden] { display: none !important; }
.bcs-result__loading { margin: 0; color: #64748b; font-style: italic; font-size: 14px; }
.bcs-result__error {
    margin: 0;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
}
.bcs-result__empty {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}
.bcs-result__list {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 10px 18px;
}
.bcs-result__label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 0;
}
.bcs-result__value {
    margin: 0;
    font-size: 16px;
    color: #0f172a;
    font-weight: 700;
    padding: 4px 0;
}
.bcs-result__sublist {
    list-style: disc inside;
    margin: 0;
    padding: 0;
    font-size: 14px;
    color: #0f172a;
}
.bcs-result__sublist li { margin: 2px 0; }
.bcs-result__orig { color: #64748b; font-weight: 400; font-size: 13px; margin-left: 4px; }

/* ----- Error block (tool not found) ------------------------------------- */
.bcs-app--error {
    background: #fef2f2;
    border-color: #fecaca;
}
.bcs-app--error .bcs-error__message {
    margin: 0;
    color: #991b1b;
    font-size: 15px;
}

/* ----- Single-tool shortcode ------------------------------------------- */
.bcs-app--tool { padding: 28px 28px 24px 28px; }

/* ----- A11y: visually hidden -------------------------------------------- */
.bcs-sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* ----- Mobile ------------------------------------------------------------ */
@media (max-width: 768px) {
    .bcs-app { padding: 20px 16px; border-radius: 10px; max-width: 100%; }
    .bcs-app__title { font-size: 22px; }
    .bcs-tool-panel { padding: 20px 16px; }
    .bcs-tool-nav { gap: 3px; padding: 4px; }
    .bcs-tool-nav__btn { padding: 6px 10px; font-size: 13px; min-height: 30px; }
    .bcs-dynrow { grid-template-columns: 1fr; }
    .bcs-dynrow__actions { justify-content: flex-end; }
    .bcs-result__list { grid-template-columns: 1fr; gap: 4px 0; }
    .bcs-result__label { padding-bottom: 0; }
    .bcs-result__value { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .bcs-app *, .bcs-app *::before, .bcs-app *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
