/* AI Prompt-to-Launch onboarding (LTR / English baseline)
   Lives inside .sp-hero on service_providers.html.
   Brand colors: #086AD8 / #05dbcf, gradient (90deg, #05dbcf, #086AD8).
*/

/* Plan fix-up #3b §A: centered Lovable-style prompt hero. The prior
   2-column layout was cramped — this gives the prompt full-width breathing
   room with the headline above and the textarea as the single focal point. */
.ai-onboard-section {
    margin: 36px auto 12px;
    max-width: 880px;
    padding: 0 16px;
    text-align: center;
}
.ai-onboard-hero-head { margin-bottom: 22px; }
.ai-onboard-eyebrow-pill {
    display: inline-block;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.28);
    color: #e8f1ff;
    font-weight: 700; font-size: 12px; letter-spacing: .4px;
    padding: 5px 12px; border-radius: 999px;
    backdrop-filter: blur(4px);
}
.ai-onboard-hero-title {
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.15;
    margin: 14px 0 10px;
    color: #ffffff;
    font-weight: 800;
    letter-spacing: -.01em;
}
.ai-onboard-hero-sub {
    color: rgba(255,255,255,.78);
    font-size: clamp(15px, 1.6vw, 18px);
    line-height: 1.55;
    margin: 0 auto;
    max-width: 700px;
}

.ai-onboard-box {
    margin: 0 auto;
    padding: 18px;
    border-radius: 22px;
    background: #f8fafc;
    box-shadow: 0 24px 60px -20px rgba(8, 106, 216, 0.45), 0 1px 0 rgba(15,23,42,.04);
    border: 1px solid rgba(255,255,255,.18);
    position: relative;
    text-align: start;
}

/* Input wrap — Lovable-style: textarea fills the box, round icon-only
   submit pinned in the corner. */
.ai-onboard-input-wrap {
    position: relative;
    display: block;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 4px;
    transition: border-color .2s, box-shadow .2s;
}

.ai-onboard-input-wrap:focus-within {
    border-color: #086AD8;
    box-shadow: 0 0 0 4px rgba(8, 106, 216, 0.10);
}

.ai-onboard-input-wrap textarea,
.ai-onboard-input-wrap input[type="text"] {
    width: 100%;
    border: 0;
    outline: 0;
    resize: none;
    padding: 18px 60px 56px 60px;
    font-size: 16px;
    line-height: 1.55;
    color: #0f172a;
    background: transparent;
    font-family: inherit;
    min-height: 140px;
}

.ai-onboard-submit {
    position: absolute;
    bottom: 10px;
    inset-inline-end: 10px;
    width: 40px; height: 40px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: #086AD8;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, box-shadow .15s, opacity .15s, background .15s;
}

.ai-onboard-submit:hover { transform: translateY(-1px); background: #0a5cbf; box-shadow: 0 8px 22px rgba(8, 106, 216, 0.32); }
.ai-onboard-submit:disabled { opacity: .55; cursor: progress; transform: none; box-shadow: none; }

/* "+" attach button — opposite side from submit. Auto-mirrors in RTL via inset-inline-start. */
.ai-onboard-attach {
    position: absolute;
    bottom: 10px;
    inset-inline-start: 10px;
    width: 40px; height: 40px;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: #f8fafc;
    color: #475569;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    z-index: 2;
}
.ai-onboard-attach:hover {
    border-color: #086AD8;
    color: #086AD8;
    background: #fff;
}
.ai-onboard-attach[aria-expanded="true"] {
    border-color: #086AD8;
    color: #086AD8;
    background: #e6f0fc;
}

.ai-onboard-attach-pop {
    position: absolute;
    bottom: 60px;
    inset-inline-start: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
    padding: 12px;
    width: 320px;
    max-width: calc(100vw - 32px);
    z-index: 30;
    animation: aiAttachPopIn .15s ease-out;
}
@keyframes aiAttachPopIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-onboard-attach-pop[hidden] { display: none; }
.ai-onboard-attach-close {
    position: absolute;
    top: 6px;
    inset-inline-end: 8px;
    border: 0; background: transparent;
    color: #94a3b8;
    font-size: 22px; line-height: 1;
    cursor: pointer; padding: 4px 8px;
}
.ai-onboard-attach-close:hover { color: #0f172a; }

.ai-onboard-attach-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
}
.ai-onboard-attach-row:hover { background: #f1f5f9; }
.ai-onboard-attach-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #e6f0fc;
    color: #086AD8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.ai-onboard-attach-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.ai-onboard-attach-text strong { color: #0f172a; font-size: 14px; font-weight: 600; }
.ai-onboard-attach-text em { color: #64748b; font-style: normal; font-size: 12px; }

.ai-onboard-attach-url-row { cursor: default; }
.ai-onboard-attach-url-row:hover { background: transparent; }

.ai-onboard-attach-url-input-wrap {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    padding: 0 8px 8px;
}
.ai-onboard-attach-url-input-wrap input[type="url"] {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    outline: 0;
    color: #0f172a;
    background: #fff;
    min-width: 0;
}
.ai-onboard-attach-url-input-wrap input[type="url"]:focus { border-color: #086AD8; }
.ai-onboard-attach-save {
    border: 0;
    background: #086AD8;
    color: #fff;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.ai-onboard-attach-save:hover { background: #0a5cbf; }

/* Attached chips strip — sits between input and pills. */
.ai-onboard-attached-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.ai-onboard-attached-chips[hidden] { display: none; }
.ai-onboard-attached-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 12px;
    background: #e6f0fc;
    border: 1px solid #b9d4f3;
    color: #086AD8;
    border-radius: 999px;
    font-size: 13px;
    max-width: 240px;
}
.ai-onboard-attached-chip .ai-onboard-chip-text {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-onboard-attached-chip-remove {
    border: 0; background: transparent;
    color: #086AD8;
    font-size: 16px; line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: .7;
}
.ai-onboard-attached-chip-remove:hover { opacity: 1; }

/* Suggestion pills — sit BELOW the box, centered. */
.ai-onboard-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.ai-suggest-pill {
    border: 1px solid #cbd5e1;
    background: rgba(255,255,255,.85);
    color: #475569;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    backdrop-filter: blur(4px);
}

.ai-suggest-pill:hover {
    border-color: #086AD8;
    color: #086AD8;
    background: #fff;
}

/* Status row */
.ai-onboard-status {
    margin-top: 12px;
    font-size: 14px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-onboard-status.is-error { color: #b91c1c; }
.ai-onboard-status.is-unsafe { color: #b45309; }

.ai-onboard-status .ai-spinner {
    width: 14px; height: 14px;
    border: 2px solid #cbd5e1;
    border-top-color: #086AD8;
    border-radius: 50%;
    display: inline-block;
    animation: ai-spin .8s linear infinite;
}

@keyframes ai-spin { to { transform: rotate(360deg); } }

/* Clarify */
.ai-onboard-clarify { margin-top: 14px; }

/* Clarify answer is a short reply, not the big prompt. Override the
   .ai-onboard-input-wrap defaults (140px min-height + 56px bottom padding
   reserved for an absolute-positioned round icon button) so it renders
   as a normal one-line input + inline text button. */
#ai-onboard-clarify .ai-onboard-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 12px;
}
#ai-onboard-clarify .ai-onboard-input-wrap input[type="text"],
#ai-onboard-clarify .ai-onboard-input-wrap textarea {
    min-height: 0;
    padding: 10px 14px;
    font-size: 15px;
    flex: 1 1 auto;
}
#ai-onboard-clarify .ai-onboard-submit {
    position: static;
    width: auto;
    height: 40px;
    border-radius: 999px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 600;
    flex: 0 0 auto;
}
.ai-clarify-q {
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 8px;
    font-size: 14.5px;
}

/* Preview card */
.ai-onboard-preview {
    margin-top: 14px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.ai-preview-eyebrow {
    display: inline-block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #086AD8;
    background: rgba(8, 106, 216, 0.08);
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ai-preview-header h4 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 4px 0 6px;
}

.ai-preview-header p {
    font-size: 14px;
    color: #475569;
    margin: 0 0 10px;
}

.ai-preview-benefits {
    list-style: none;
    padding: 0;
    margin: 8px 0 12px;
}

.ai-preview-benefits li {
    font-size: 13.5px;
    color: #334155;
    padding: 6px 0;
    border-top: 1px solid #f1f5f9;
}

.ai-preview-benefits li:first-child { border-top: 0; }

.ai-preview-benefits .ai-benefit-icon {
    display: inline-block;
    width: 22px;
    text-align: center;
    margin-right: 6px;
}

.ai-preview-cta { text-align: right; }

/* Brand gradient pill for the post-preview "Claim & sign up" button.
   The shared .btn-glow.primary on this page is too generic and renders
   flat — give the AI flow a CTA that visually matches the brand band. */
#ai-preview-claim {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(90deg, #05dbcf, #086AD8);
    color: #fff !important;
    border: 0;
    padding: 14px 28px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 12px 28px rgba(8, 106, 216, 0.35);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
#ai-preview-claim:hover,
#ai-preview-claim:focus {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(8, 106, 216, 0.42);
    filter: brightness(1.04);
    color: #fff !important;
    text-decoration: none;
}
#ai-preview-claim:focus-visible {
    outline: 3px solid rgba(5, 219, 207, 0.55);
    outline-offset: 3px;
}
#ai-preview-claim:active { transform: translateY(0); }

@media (max-width: 600px) {
    .ai-onboard-title { font-size: 19px; }
    /* Keep submit button circular on mobile — do NOT stretch to 100% width */
    .ai-onboard-submit { width: 40px; height: 40px; border-radius: 50%; padding: 0; flex-shrink: 0; }
}

/* ---- Live preview iframe + typing line (Phase 3) ---- */
.ai-preview-typing {
    font-size: 14px;
    color: #475569;
    margin: 0 0 12px;
    min-height: 20px;
    font-weight: 600;
    letter-spacing: .2px;
}
.ai-preview-typing::after {
    content: '';
    display: inline-block;
    width: 7px; height: 16px;
    background: var(--ai-accent, #086AD8);
    margin-inline-start: 4px;
    vertical-align: -2px;
    animation: aiBlink 1s steps(2) infinite;
    border-radius: 1px;
}
@keyframes aiBlink { 50% { opacity: 0; } }

.ai-preview-frame-wrap {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(8,106,216,.18);
    background: #f8fbff;
    box-shadow: 0 10px 28px rgba(8,106,216,.10);
    margin: 0 0 16px;
    aspect-ratio: 16 / 11;
}
.ai-preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #f8fbff;
    transition: opacity .25s ease;
}
/* CSS-only skeleton overlay shown until the iframe finishes loading. */
.ai-preview-frame-wrap::before,
.ai-preview-frame-wrap::after {
    content: '';
    position: absolute;
    left: 24px; right: 24px;
    border-radius: 8px;
    background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
    background-size: 200% 100%;
    animation: aiShimmer 1.4s infinite linear;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.ai-preview-frame-wrap::before { top: 36px; height: 28px; width: 60%; }
.ai-preview-frame-wrap::after  { top: 80px; height: 14px; width: 80%; }
.ai-preview-frame-wrap.is-loading::before,
.ai-preview-frame-wrap.is-loading::after { opacity: 1; }
.ai-preview-frame-wrap.is-loading .ai-preview-frame { opacity: .25; }
@keyframes aiShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.ai-preview-frame-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.55);
    backdrop-filter: blur(2px);
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
}
.ai-preview-frame-wrap.is-loading .ai-preview-frame-loader { opacity: 1; }
.ai-preview-frame-loader .ai-spinner {
    width: 28px; height: 28px;
    border: 3px solid rgba(8,106,216,.15);
    border-top-color: var(--ai-accent, #086AD8);
    border-radius: 50%;
    animation: aiSpin .9s linear infinite;
}
@keyframes aiSpin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
    .ai-preview-frame-wrap { aspect-ratio: 4 / 5; }
}

/* ── AI Help Button ──────────────────────────────────────────────────── */
.ai-help-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 16px;
    padding: 7px 16px 7px 10px;
    background: rgba(255,255,255,.12);
    border: 1.5px solid rgba(255,255,255,.28);
    border-radius: 999px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, border-color .2s, transform .15s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.ai-help-btn:hover {
    background: rgba(255,255,255,.22);
    border-color: rgba(255,255,255,.55);
    transform: translateY(-1px);
}
.ai-help-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    background: #086AD8;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    animation: ai-help-pulse 2.6s ease-in-out infinite;
}
@keyframes ai-help-pulse {
    0%, 100% { box-shadow: 0 0 0 0   rgba(8,106,216,.55); }
    50%       { box-shadow: 0 0 0 8px rgba(8,106,216,.0); }
}

/* ── AI Help Modal overlay ───────────────────────────────────────────── */
.ai-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,20,40,.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: ai-overlay-in .2s ease;
}
.ai-help-overlay[hidden] { display: none; }
@keyframes ai-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── AI Help Modal card ──────────────────────────────────────────────── */
.ai-help-modal {
    background: #fff;
    border-radius: 24px;
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 36px 32px 28px;
    position: relative;
    box-shadow: 0 32px 80px -20px rgba(8,106,216,.32), 0 4px 20px rgba(0,0,0,.1);
    animation: ai-modal-up .26s cubic-bezier(.22,.9,.45,1.1);
}
@keyframes ai-modal-up {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

.ai-help-modal-close {
    position: absolute;
    top: 14px;
    inset-inline-end: 16px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 32px; height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.ai-help-modal-close:hover { background: #e2e8f0; color: #1e293b; }

.ai-help-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e2e8f0;
}
.ai-help-modal-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    background: linear-gradient(90deg, #05dbcf, #086AD8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}
.ai-help-modal-header h3 {
    margin: 0 0 5px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}
.ai-help-modal-header p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

/* ── Steps ───────────────────────────────────────────────────────────── */
.ai-help-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}
.ai-help-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.ai-help-step-num {
    flex-shrink: 0;
    width: 30px; height: 30px;
    background: linear-gradient(90deg, #05dbcf, #086AD8);
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ai-help-step strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}
.ai-help-step p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

/* ── FAQ accordion ───────────────────────────────────────────────────── */
.ai-help-faq { margin-bottom: 24px; }
.ai-help-faq h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #94a3b8;
    margin: 0 0 8px;
}
.ai-help-faq-item { border-bottom: 1px solid #f1f5f9; }
.ai-help-faq-q {
    width: 100%;
    background: none;
    border: none;
    text-align: start;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    padding: 11px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-help-faq-q::after {
    content: '+';
    font-size: 20px;
    font-weight: 300;
    color: #086AD8;
    flex-shrink: 0;
    margin-inline-start: 8px;
    transition: transform .2s;
    line-height: 1;
}
.ai-help-faq-item.open .ai-help-faq-q::after { transform: rotate(45deg); }
.ai-help-faq-a {
    display: none;
    font-size: 13px;
    color: #64748b;
    line-height: 1.65;
    padding: 0 0 12px;
}
.ai-help-faq-item.open .ai-help-faq-a { display: block; }

/* ── CTA button ──────────────────────────────────────────────────────── */
.ai-help-cta {
    display: block;
    width: 100%;
    padding: 13px;
    background: linear-gradient(90deg, #05dbcf, #086AD8);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    text-align: center;
}
.ai-help-cta:hover { opacity: .9; transform: translateY(-1px); }

@media (max-width: 560px) {
    .ai-help-modal { padding: 28px 20px 22px; }
    .ai-help-modal-header { flex-direction: column; gap: 10px; }
}

/* ── RTL: dir="rtl" on the modal card makes flex row go right-to-left ── */
/* DO NOT add row-reverse here — direction:rtl already reverses flex row,  */
/* adding row-reverse would double-reverse back to LTR.                   */
.ai-help-modal[dir="rtl"] {
    text-align: right;
}
.ai-help-modal[dir="rtl"] .ai-help-modal-header h3,
.ai-help-modal[dir="rtl"] .ai-help-modal-header p { text-align: right; }
.ai-help-modal[dir="rtl"] .ai-help-step div { text-align: right; }
.ai-help-modal[dir="rtl"] .ai-help-step strong { text-align: right; }
.ai-help-modal[dir="rtl"] .ai-help-step p { text-align: right; }
.ai-help-modal[dir="rtl"] .ai-help-faq h4 { text-align: right; }
.ai-help-modal[dir="rtl"] .ai-help-faq-q { text-align: right; }
.ai-help-modal[dir="rtl"] .ai-help-faq-a { text-align: right; }
.ai-help-modal[dir="rtl"] .ai-help-modal-close {
    right: auto;
    left: 16px;
}
