/* assets/components/ai-polish.css — dismissable AI-polish button widget (P3 Phase 1A).
 *
 * Companion to assets/components/ai-polish.js. Renders a small ✨ Polish
 * button below a textarea; on click, calls a configured endpoint and shows
 * the polished text inline with an Undo affordance.
 *
 * Used by: trial-setup.html Step 3 (preferenceText textarea); profile-
 * update.html (capability textarea); future subscriber-portal.html.
 *
 * Per charter (Phase 0 dispatch): small, dismissable, never required.
 * Per CLAUDE.md SR #94: model resolved server-side via ANTHROPIC_MODEL_HAIKU;
 * widget never references model name.
 *
 * Palette: teal text #007A62 (button text); accent #00D4AA (active state).
 */

/* ── Toolbar — positioned just below the textarea ──────────────── */
.bc-ap-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
    min-height: 28px;
    font-family: 'DM Sans', sans-serif;
}

/* ── Polish button ─────────────────────────────────────────────── */
.bc-ap-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* 36px height keeps button compact without below 44px touch min-target
       breach — paired with 8px outside touch padding via container. */
    height: 36px;
    padding: 0 14px;
    background: rgba(0, 212, 170, 0.10);
    border: 1px solid rgba(0, 212, 170, 0.30);
    border-radius: 8px;
    color: #00D4AA;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease;
}

.bc-ap-button:hover {
    background: rgba(0, 212, 170, 0.18);
    border-color: rgba(0, 212, 170, 0.55);
}

.bc-ap-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.bc-ap-button .bc-ap-spark {
    font-size: 0.9rem;
    line-height: 1;
}

/* ── Status text (loading / error) ─────────────────────────────── */
.bc-ap-status {
    font-size: 0.78rem;
    color: #7A9CC0;
    font-style: italic;
    flex: 1;
    text-align: right;
    /* Hidden by default; revealed by JS while polishing or on error */
    display: none;
}

.bc-ap-status.is-visible {
    display: inline-block;
}

.bc-ap-status.is-error {
    color: #FFab00;
    font-style: normal;
}

/* ── Undo affordance (revealed after polish lands) ─────────────── */
.bc-ap-undo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 6px;
    color: #7A9CC0;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    cursor: pointer;
    transition: color 140ms ease, border-color 140ms ease;
}

.bc-ap-undo:hover {
    color: #F0F6FF;
    border-color: rgba(255, 255, 255, 0.25);
}

/* ── Focus rings — js-mouse-user pattern (canonical) ──────────── */
body.js-mouse-user .bc-ap-button:focus,
body.js-mouse-user .bc-ap-undo:focus {
    outline: none;
}

.bc-ap-button:focus-visible,
.bc-ap-undo:focus-visible {
    outline: 2px solid #00D4AA;
    outline-offset: 2px;
}

/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .bc-ap-toolbar {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .bc-ap-button {
        height: 40px;
        font-size: 0.88rem;
        padding: 0 16px;
    }

    .bc-ap-status {
        flex-basis: 100%;
        text-align: left;
        order: 3;
    }
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .bc-ap-button,
    .bc-ap-undo {
        transition: none;
    }
}
