/* ذكاء برزنتا — the smart builder as three clear steps: your content, the design at work, the preview.
 * Loaded after ai-builder.css; only the look and the steps change, never the behaviour. */
#ai-builder-modal { --ai-a: var(--brand-primary, #0085ff); --ai-b: #01cbfb; --ai-ink: #0f1a22; --ai-muted: #6b7984; --ai-line: #e6ebef; background: rgba(8, 14, 20, .55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
#ai-builder-modal .ai-studio { width: min(860px, 100%); max-width: 860px; border: 0; border-radius: 30px; background: radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--ai-a) 10%, #fff) 0%, #fff 55%); box-shadow: 0 50px 140px #0b1a2a55, 0 0 0 1px #ffffff40; }
#ai-builder-modal .ai-studio-topbar { min-height: 68px; padding: 14px 24px; background: #ffffffcc; border-bottom: 1px solid #eef2f5; display: grid; grid-template-columns: 1fr auto 1fr; }
#ai-builder-modal .ai-studio-wordmark { justify-self: start; }
#ai-builder-modal .ai-modal-close { justify-self: end; }
#ai-builder-modal .ai-studio-mark { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(135deg, var(--ai-a), var(--ai-b)); box-shadow: 0 6px 18px color-mix(in srgb, var(--ai-a) 35%, transparent); }
#ai-builder-modal .ai-studio-wordmark strong { font-size: 15.5px; font-weight: 800; color: var(--ai-ink); }

/* the steps */
#ai-builder-modal .ai-phases { display: flex; align-items: center; gap: 6px; margin: 0; padding: 5px; list-style: none; border-radius: 999px; background: #f2f5f8; }
#ai-builder-modal .ai-phases li { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #8592a0; transition: background .3s, color .3s; white-space: nowrap; }
#ai-builder-modal .ai-phases li span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: #fff; color: #8592a0; box-shadow: inset 0 0 0 1px #dfe5ea; }
#ai-builder-modal .ai-phases li.is-current { background: #fff; color: var(--ai-ink); box-shadow: 0 4px 14px #0b1a2a14; }
#ai-builder-modal .ai-phases li.is-current span { background: linear-gradient(135deg, var(--ai-a), var(--ai-b)); color: #fff; box-shadow: none; }
#ai-builder-modal .ai-phases li.is-done { color: #3d4b56; }
#ai-builder-modal .ai-phases li.is-done span { background: color-mix(in srgb, var(--ai-a) 14%, #fff); color: var(--ai-a); box-shadow: none; }

#ai-builder-modal .ai-modal-body { padding: 26px 40px 18px; gap: 16px; }
#ai-builder-modal .ai-studio-intro { margin: 4px 0 2px; }
#ai-builder-modal h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.6px; color: var(--ai-ink); margin: 0 0 6px; }
#ai-builder-modal #ai-studio-description { font-size: 13.5px; color: var(--ai-muted); }
#ai-builder-modal .ai-brand-summary { min-height: 0; padding: 8px 12px; border-radius: 14px; background: #f6f8fa; border-color: #edf1f4; }
#ai-builder-modal .ai-brand-summary small { display: none; }
#ai-builder-modal .ai-brand-icon { color: var(--ai-a); }
#ai-builder-modal .ai-brand-connected>span { background: #12a150; }

/* the prompt: the hero of the first step */
#ai-builder-modal .ai-prompt-shell { position: relative; border: 0; border-radius: 22px; background: #fff; box-shadow: 0 0 0 1px #dfe6ec, 0 14px 40px #0b1a2a0d; overflow: visible; isolation: isolate; }
#ai-builder-modal .ai-prompt-shell::before { content: ''; position: absolute; inset: -2px; border-radius: 24px; z-index: -1; background: conic-gradient(from var(--ai-turn, 0deg), var(--ai-a), var(--ai-b), #7c5cff, var(--ai-a)); opacity: 0; transition: opacity .35s; }
#ai-builder-modal .ai-prompt-shell::after { content: ''; position: absolute; inset: 0; border-radius: 22px; background: #fff; z-index: -1; }
#ai-builder-modal .ai-prompt-shell:focus-within { box-shadow: 0 18px 50px color-mix(in srgb, var(--ai-a) 18%, transparent); }
#ai-builder-modal .ai-prompt-shell:focus-within::before { opacity: 1; animation: ai-turn 6s linear infinite; }
@property --ai-turn { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes ai-turn { to { --ai-turn: 360deg; } }
#ai-builder-modal .ai-prompt-label { padding: 18px 22px 0; font-size: 14px; color: var(--ai-ink); }
#ai-builder-modal .ai-textarea { min-height: 168px; padding: 10px 22px 18px; font-size: 15px; color: #1d2b35; }
#ai-builder-modal .ai-prompt-meta { border-radius: 0 0 22px 22px; background: #fafbfc; border-top-color: #f0f3f6; padding: 10px 20px; font-size: 11px; }
#ai-builder-modal .ai-intent-shell { border-radius: 16px; border: 1px solid #e3e9ee; background: #fff; }
#ai-builder-modal .ai-intent-label { color: #3d4b56; }

/* options: quiet pills; one opens to full width */
#ai-builder-modal .ai-options { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
#ai-builder-modal .ai-options > details { flex: 0 0 auto; border-radius: 999px; transition: border-radius .2s; }
#ai-builder-modal .ai-options > details > summary { gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid #e3e9ee; background: #fff; color: #3d4b56; font-size: 12.5px; font-weight: 600; transition: border-color .2s, background .2s; }
#ai-builder-modal .ai-options > details > summary:hover { border-color: #cbd5dd; }
#ai-builder-modal .ai-options > details > summary svg { width: 15px; height: 15px; color: var(--ai-a); margin: 0; }
#ai-builder-modal .ai-options > details > summary svg:last-child { color: #9aa6b0; margin-inline-start: 2px; width: 13px; }
#ai-builder-modal .ai-options > details[open] { flex: 1 1 100%; border-radius: 20px; padding: 6px; background: #f6f8fa; }
#ai-builder-modal .ai-options > details[open] > summary { background: #fff; border-color: color-mix(in srgb, var(--ai-a) 40%, #fff); width: fit-content; }
#ai-builder-modal .ai-options > details[open] > :not(summary) { padding: 14px 10px 8px; }
#ai-builder-modal .ai-options .ai-assets-body { padding: 12px 10px 6px; }

/* understanding: a soft note under the prompt */
#ai-builder-modal .ai-understanding { border-radius: 16px; background: #f6f9fc; border: 1px solid #e8eef3; }

/* buttons */
#ai-builder-modal .ai-btn-primary { height: 50px; padding: 0 24px; border-radius: 15px; border: 0; background: linear-gradient(135deg, var(--ai-a), color-mix(in srgb, var(--ai-a) 60%, var(--ai-b))); color: #fff; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; gap: 9px; box-shadow: 0 12px 30px color-mix(in srgb, var(--ai-a) 32%, transparent); cursor: pointer; transition: transform .15s, box-shadow .2s, opacity .2s; }
#ai-builder-modal .ai-btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 16px 36px color-mix(in srgb, var(--ai-a) 40%, transparent); }
#ai-builder-modal .ai-btn-primary svg { width: 18px; height: 18px; }
#ai-builder-modal .ai-btn-ghost { display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 14px; border: 0; border-radius: 13px; background: transparent; color: #4b5a66; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
#ai-builder-modal .ai-btn-ghost:hover { background: #f2f5f8; }
#ai-builder-modal .ai-btn-ghost svg { width: 16px; height: 16px; }
#ai-builder-modal .ai-modal-foot { padding: 14px 24px; gap: 10px; border-top: 1px solid #eef2f5; background: #ffffffe6; }
#ai-builder-modal .ai-credit-wrap { margin-inline-end: auto; }
#ai-builder-modal .ai-usage-line { font-size: 12px; color: var(--ai-muted); }
#ai-builder-modal .ai-privacy-note { text-align: center; font-size: 11px; color: #9aa6b0; margin: 0; }

/* step 2: the design at work */
#ai-builder-modal[data-phase="working"] .ai-studio-intro,
#ai-builder-modal[data-phase="working"] .ai-brand-summary,
#ai-builder-modal[data-phase="working"] .ai-resource-warning,
#ai-builder-modal[data-phase="working"] .ai-prompt-shell,
#ai-builder-modal[data-phase="working"] .ai-intent-shell,
#ai-builder-modal[data-phase="working"] .ai-understanding,
#ai-builder-modal[data-phase="working"] .ai-options,
#ai-builder-modal[data-phase="working"] .ai-privacy-note,
#ai-builder-modal[data-phase="working"] #ai-generate-btn,
#ai-builder-modal[data-phase="working"] #ai-builder-status.loading { display: none !important; }
#ai-builder-modal[data-phase="working"] .ai-workflow { display: grid; justify-items: center; text-align: center; gap: 22px; padding: 34px 10px 10px; border: 0; background: none; }
#ai-builder-modal .ai-workflow-head { flex-direction: column; align-items: center; gap: 16px; }
#ai-builder-modal .ai-workflow-head strong { font-size: 22px; color: var(--ai-ink); display: block; }
#ai-builder-modal .ai-workflow-head p { font-size: 13.5px; color: var(--ai-muted); margin: 6px 0 0; }
#ai-builder-modal .ai-orbit { position: relative; width: 92px; height: 92px; display: grid; place-items: center; background: none; border-radius: 50%; }
#ai-builder-modal .ai-orbit i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--ai-a); border-left-color: var(--ai-b); animation: ai-spin 2.4s linear infinite; }
#ai-builder-modal .ai-orbit i:nth-child(2) { inset: 10px; border-top-color: var(--ai-b); border-left-color: #7c5cff; animation-duration: 3.2s; animation-direction: reverse; }
#ai-builder-modal .ai-orbit i:nth-child(3) { inset: -10px; border-color: transparent; border-top-color: color-mix(in srgb, var(--ai-a) 30%, transparent); animation-duration: 5s; }
#ai-builder-modal .ai-orbit b { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--ai-a), var(--ai-b)); box-shadow: 0 0 40px color-mix(in srgb, var(--ai-a) 50%, transparent); animation: ai-breathe 2.4s ease-in-out infinite; }
#ai-builder-modal .ai-orbit b svg { width: 26px; height: 26px; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@keyframes ai-breathe { 50% { transform: scale(1.08); } }
#ai-builder-modal .ai-cancel-run { position: absolute; top: 0; inset-inline-end: 0; height: 34px; padding: 0 14px; border-radius: 10px; border: 1px solid #e3e9ee; background: #fff; font-size: 12px; color: #6b7984; cursor: pointer; }
#ai-builder-modal .ai-workflow { position: relative; }
#ai-builder-modal .ai-workflow-steps { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 0; padding: 0; list-style: none; }
#ai-builder-modal .ai-workflow-steps li { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; background: #f3f6f9; color: #94a1ac; font-size: 12.5px; font-weight: 600; transition: background .3s, color .3s; }
#ai-builder-modal .ai-workflow-steps li span { width: 8px; height: 8px; border-radius: 50%; background: #cfd8df; }
#ai-builder-modal .ai-workflow-steps li.is-complete { color: #2f6b49; background: #eaf7ef; }
#ai-builder-modal .ai-workflow-steps li.is-complete span { background: #12a150; }
#ai-builder-modal .ai-workflow-steps li.is-current { color: #fff; background: linear-gradient(135deg, var(--ai-a), color-mix(in srgb, var(--ai-a) 55%, var(--ai-b))); box-shadow: 0 8px 20px color-mix(in srgb, var(--ai-a) 28%, transparent); }
#ai-builder-modal .ai-workflow-steps li.is-current span { background: #fff; animation: ai-breathe 1.2s ease-in-out infinite; }
#ai-builder-modal .ai-workflow-track { width: min(420px, 90%); }
#ai-builder-modal .ai-skeleton { display: none; }
#ai-builder-modal[data-phase="working"] .ai-skeleton { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; max-width: 620px; }
#ai-builder-modal .ai-skeleton i { aspect-ratio: 16 / 9; border-radius: 12px; background: linear-gradient(100deg, #f1f4f7 20%, #fbfcfd 40%, #f1f4f7 60%) 0 0 / 300% 100%; box-shadow: inset 0 0 0 1px #edf1f4; animation: ai-shimmer 1.8s ease-in-out infinite; }
#ai-builder-modal .ai-skeleton i:nth-child(2) { animation-delay: .2s; }
#ai-builder-modal .ai-skeleton i:nth-child(3) { animation-delay: .4s; }
@keyframes ai-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* step 3: the preview, with one clear way forward */
#ai-builder-modal[data-phase="preview"] .ai-studio-intro,
#ai-builder-modal[data-phase="preview"] .ai-brand-summary,
#ai-builder-modal[data-phase="preview"] .ai-resource-warning,
#ai-builder-modal[data-phase="preview"] .ai-prompt-shell,
#ai-builder-modal[data-phase="preview"] .ai-intent-shell,
#ai-builder-modal[data-phase="preview"] .ai-understanding,
#ai-builder-modal[data-phase="preview"] .ai-options,
#ai-builder-modal[data-phase="preview"] .ai-workflow,
#ai-builder-modal[data-phase="preview"] .ai-privacy-note,
#ai-builder-modal[data-phase="preview"] #ai-generate-btn,
#ai-builder-modal[data-phase="preview"] #ai-builder-status.success { display: none !important; }
#ai-builder-modal[data-phase="compose"] #ai-smart-preview,
#ai-builder-modal[data-phase="compose"] #ai-review-details,
#ai-builder-modal[data-phase="working"] #ai-smart-preview { display: none !important; }
#ai-builder-modal #ai-smart-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#ai-builder-modal #ai-smart-preview > :not(.ai-preview-card) { grid-column: 1 / -1; }
#ai-builder-modal .ai-preview-card { padding: 8px; border-radius: 18px; background: #f6f8fa; border: 0; }
#ai-builder-modal .ai-preview-card > div { border: 0 !important; border-radius: 12px !important; box-shadow: 0 6px 20px #0b1a2a12; }
#ai-builder-modal .ai-preview-label { font-size: 11.5px; color: #8592a0; margin: 8px 6px 2px; }
#ai-builder-modal .ai-preview-actions { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-radius: 20px; background: #ffffffee; backdrop-filter: blur(10px); box-shadow: 0 0 0 1px #e6ebef, 0 14px 40px #0b1a2a12; }
#ai-builder-modal .ai-preview-actions > p { margin: 0; font-size: 13px; color: #4b5a66; }
#ai-builder-modal .ai-preview-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-direction: row-reverse; }
#ai-builder-modal .ai-preview-tools .ai-insert { height: 52px; padding: 0 26px; font-size: 15.5px; order: 0; }
#ai-builder-modal .ai-preview-tools .ai-btn-secondary { height: 44px; padding: 0 14px; border-radius: 13px; border: 0; background: transparent; color: #4b5a66; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; box-shadow: none; }
#ai-builder-modal .ai-preview-tools .ai-btn-secondary:hover { background: #f2f5f8; }
#ai-builder-modal .ai-preview-tools .ai-btn-secondary small { font-size: 10.5px; padding: 2px 7px; border-radius: 99px; background: #eaf7ef; color: #2f6b49; }
#ai-builder-modal .ai-preview-reading, #ai-builder-modal .ai-intent-notes { border-radius: 16px; font-size: 13px; }
@media (max-width: 720px) {
  #ai-builder-modal .ai-studio-topbar { grid-template-columns: 1fr auto; }
  #ai-builder-modal .ai-phases { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  #ai-builder-modal .ai-modal-body { padding: 20px 18px 14px; }
  #ai-builder-modal #ai-smart-preview { grid-template-columns: 1fr; }
  #ai-builder-modal .ai-preview-actions { flex-direction: column; align-items: stretch; }
  #ai-builder-modal .ai-skeleton { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { #ai-builder-modal * { animation: none !important; } }
#ai-builder-modal .ai-intent-shell { display: grid; gap: 4px; padding: 12px 16px 8px; box-shadow: none; }
#ai-builder-modal .ai-intent-shell .ai-intent-label { display: flex; align-items: center; gap: 7px; padding: 0; margin: 0; border: 0; background: none; font-size: 13px; font-weight: 700; }
#ai-builder-modal .ai-intent-shell .ai-intent-label svg { width: 16px; height: 16px; color: var(--ai-a); }
#ai-builder-modal .ai-intent-shell .ai-intent-input { width: 100%; height: 38px; padding: 0; border: 0; background: transparent; box-shadow: none; outline: none; font: inherit; font-size: 14px; color: #1d2b35; }
#ai-builder-modal .ai-intent-shell:focus-within { border-color: color-mix(in srgb, var(--ai-a) 45%, #fff); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ai-a) 10%, transparent); }
