/* Docshar AI command bar styles (js/ai-command.js): "Tell Docshar what to do" on the home hero and tool pages. */

/* ---------- Mount points (space is reserved so the page does not jump when the bar appears) ---------- */
.aic-mount-home { margin-top: 18px; max-width: 640px; min-height: 92px; }
.aic-mount-tool { margin-top: 20px; min-height: 80px; }

.aic { position: relative; min-width: 0; max-width: 100%; --aic-ring: linear-gradient(120deg, #6366f1, #8b5cf6 45%, #d946ef); }

/* ---------- The bar ---------- */
.aic-bar {
  position: relative; display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 7px 0 14px;
  border-radius: 18px; background: linear-gradient(#fff, #fff) padding-box, var(--aic-ring) border-box; border: 2px solid transparent;
  box-shadow: 0 10px 30px -14px rgba(99, 102, 241, .55), 0 1px 2px rgba(15, 23, 42, .05);
  transition: box-shadow .2s;
}
.aic-bar:focus-within { box-shadow: 0 0 0 4px rgba(139, 92, 246, .16), 0 12px 32px -14px rgba(99, 102, 241, .6); }
.aic[data-drop="true"] .aic-bar { box-shadow: 0 0 0 4px rgba(139, 92, 246, .3); background: linear-gradient(#f5f3ff, #f5f3ff) padding-box, var(--aic-ring) border-box; }
.aic-spark { flex-shrink: 0; width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid #ede9fe; box-shadow: 0 4px 10px -5px rgba(139, 92, 246, .55); }
.aic-spark svg { width: 16px; height: 16px; }
.aic-input { flex: 1 1 0; width: 0; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; padding: 0 6px 0 8px; font-size: 15px; color: #18181b; }
.aic-input::placeholder { color: #94a3b8; }
.aic-input:disabled { color: #71717a; }
.aic-ibtn, .aic-send { flex-shrink: 0; width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; transition: background-color .15s, color .15s, box-shadow .15s; }
.aic-ibtn { color: #64748b; }
.aic-ibtn:hover:not(:disabled) { background: #f1f5f9; color: #4f46e5; }
.aic-ibtn svg, .aic-send svg { width: 18px; height: 18px; }
.aic-ibtn:disabled, .aic-send:disabled { opacity: .45; cursor: not-allowed; }
.aic-send { color: #fff; background: #4f46e5; box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .7); margin-left: 2px; }
.aic-send:hover:not(:disabled) { background: #4338ca; }
.aic[data-busy="true"] .aic-send { background: #18181b; box-shadow: none; }
.aic[data-busy="true"] .aic-send svg { width: 14px; height: 14px; fill: currentColor; }
.aic-bar button:focus-visible, .aic-chip:focus-visible, .aic-lang:focus-visible, .aic-card button:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
/* listening */
.aic[data-listening="true"] [data-mic] { color: #fff; background: #e11d48; animation: aic-pulse 1.3s ease-out infinite; }
@keyframes aic-pulse { 0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .45); } 100% { box-shadow: 0 0 0 10px rgba(225, 29, 72, 0); } }
/* the plan needs a file: point at the attach button */
.aic-ibtn.aic-attn { color: #4f46e5; background: #eef2ff; animation: aic-attn 1.6s ease-in-out infinite; }
@keyframes aic-attn { 0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, .5); } 50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); } }

/* ---------- Attached files ---------- */
.aic-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.aic-files[hidden] { display: none; }
.aic-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 32px; padding: 0 4px 0 10px; border-radius: 10px; background: #fff; border: 1px solid #e0e7ff; font-size: 12.5px; color: #3f3f46; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.aic-file > svg { width: 15px; height: 15px; color: #6366f1; flex-shrink: 0; }
.aic-fname { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.aic-fmeta { color: #94a3b8; white-space: nowrap; }
.aic-file button { width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: #94a3b8; }
.aic-file button:hover:not(:disabled) { background: #fee2e2; color: #e11d48; }
.aic-file button svg { width: 14px; height: 14px; }

/* ---------- Suggestions + meta row ---------- */
.aic-under { display: flex; align-items: center; gap: 10px; margin-top: 9px; min-width: 0; }
.aic-chips { flex: 1 1 0; width: 0; min-width: 0; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.aic-chips::-webkit-scrollbar { display: none; }
.aic[data-card="true"] .aic-chips, .aic[data-running="true"] .aic-chips { visibility: hidden; }
.aic-chip { flex-shrink: 0; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid #e0e7ff; background: rgba(255, 255, 255, .85); font-size: 12.5px; font-weight: 500; color: #4338ca; white-space: nowrap; transition: background .15s, border-color .15s; }
.aic-chip:hover { background: #eef2ff; border-color: #a5b4fc; }
.aic-meta { flex-shrink: 0; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: #94a3b8; }
.aic-lang { height: 24px; min-width: 34px; padding: 0 7px; border-radius: 7px; border: 1px solid #e2e8f0; background: #fff; font-size: 11px; font-weight: 700; color: #64748b; }
.aic-lang:hover { border-color: #a5b4fc; color: #4f46e5; }
.aic-lang[hidden] { display: none; }
.aic-left-short { display: none; }
@media (max-width: 639px) { .aic-left-short { display: inline; } }

/* ---------- Result card ---------- */
.aic-card { position: relative; z-index: 5; margin-top: 10px; border-radius: 18px; background: #fff; border: 1px solid #e0e7ff; box-shadow: 0 18px 40px -22px rgba(79, 70, 229, .45), 0 1px 2px rgba(15, 23, 42, .05); padding: 14px 16px 15px; animation: aic-in .2s ease-out; text-align: left; }
.aic-card[hidden] { display: none; }
@keyframes aic-in { from { opacity: 0; transform: translateY(-4px); } }
.aic-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.aic-ava { flex-shrink: 0; width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #4f46e5; background: #eef2ff; }
.aic-ava svg { width: 16px; height: 16px; }
.aic-ava[data-tone="done"] { color: #059669; background: #d1fae5; }
.aic-ava[data-tone="error"], .aic-ava[data-tone="failed"] { color: #e11d48; background: #ffe4e6; }
.aic-ava[data-tone="manual"] { color: #d97706; background: #fef3c7; }
.aic-ava[data-tone="running"] svg { animation: df-spin 1.2s linear infinite; }
.aic-title { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700; color: #18181b; line-height: 1.3; }
.aic-hbtn { flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: #94a3b8; }
.aic-hbtn:hover { background: #f1f5f9; color: #3f3f46; }
.aic-hbtn svg { width: 16px; height: 16px; }
.aic-hbtn[hidden] { display: none; }
.aic-body { margin-top: 10px; font-size: 13.5px; color: #3f3f46; line-height: 1.5; }
.aic-body p + p { margin-top: 8px; }
.aic-sum { color: #52525b; margin-bottom: 8px; }
.aic-quote { color: #64748b; font-style: italic; overflow-wrap: anywhere; }
.aic-text { overflow-wrap: anywhere; }
.aic-err { color: #9f1239; }
.aic-hint { font-size: 12px; color: #94a3b8; }
.aic-body .aic-hint { margin-top: 8px; }
.aic-on { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; color: #64748b; min-width: 0; }
.aic-on b { color: #3f3f46; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.aic-on svg { width: 14px; height: 14px; flex-shrink: 0; color: #6366f1; }
.aic-need { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 9px 11px; border-radius: 12px; background: #eef2ff; color: #3730a3; font-size: 13px; font-weight: 500; }
.aic-need svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.aic-dots { display: flex; gap: 5px; margin-top: 10px; }
.aic-dots span { width: 7px; height: 7px; border-radius: 50%; background: #a5b4fc; animation: aic-dot 1s ease-in-out infinite; }
.aic-dots span:nth-child(2) { animation-delay: .15s; } .aic-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes aic-dot { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* steps */
.aic-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.aic-steps li { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.aic-num { flex-shrink: 0; width: 24px; height: 24px; margin-top: 1px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #4f46e5; background: #eef2ff; }
.aic-num svg { width: 14px; height: 14px; }
.aic-num .spinner { width: 12px; height: 12px; }
.aic-steps li[data-st="done"] .aic-num { color: #fff; background: #10b981; }
.aic-steps li[data-st="fail"] .aic-num { color: #fff; background: #e11d48; }
.aic-steps li[data-st="manual"] .aic-num { color: #b45309; background: #fef3c7; }
.aic-steps li[data-st="skip"] { opacity: .5; }
.aic-steps li[data-st="skip"] .aic-num { color: #94a3b8; background: #f1f5f9; }
.aic-step { min-width: 0; flex: 1; }
.aic-step-label { font-weight: 600; color: #18181b; overflow-wrap: anywhere; }
.aic-step-opts { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 3px; font-size: 12px; color: #64748b; }
.aic-step-opts span { padding: 1px 7px; border-radius: 6px; background: #f8fafc; border: 1px solid #f1f5f9; overflow-wrap: anywhere; }
.aic-step-opts .aic-tool { color: #4338ca; background: #eef2ff; border-color: #e0e7ff; font-weight: 600; }
.aic-step-note { margin-top: 4px; font-size: 12.5px; color: #64748b; }
.aic-steps li[data-st="fail"] .aic-step-note { color: #be123c; font-weight: 500; }
.aic-steps li[data-st="manual"] .aic-step-note { color: #92400e; font-weight: 500; }
/* progress */
.aic-prog { margin-top: 12px; }
.aic-prog-bar { height: 6px; border-radius: 999px; background: #eef2ff; overflow: hidden; }
.aic-prog-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6366f1, #a855f7); transition: width .25s; }
.aic-prog p { margin-top: 6px; font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* question chips */
.aic-qchips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.aic-chip-q { height: 34px; padding: 0 14px; font-size: 13px; font-weight: 600; background: #eef2ff; }
/* actions */
.aic-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.aic-actions .aic-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 11px; }
.aic-actions .aic-sm svg { width: 15px; height: 15px; }
.aic-actions .aic-hint { margin-left: auto; }

/* ---------- Compact version on tool pages ---------- */
.aic[data-mode="tool"] .aic-bar { height: 48px; border-radius: 15px; border-width: 1.5px; padding-left: 10px; box-shadow: 0 6px 18px -12px rgba(99, 102, 241, .5); }
.aic[data-mode="tool"] .aic-spark { width: 26px; height: 26px; border-radius: 8px; }
.aic[data-mode="tool"] .aic-spark svg { width: 14px; height: 14px; }
.aic[data-mode="tool"] .aic-input { font-size: 14px; }
.aic[data-mode="tool"] .aic-ibtn, .aic[data-mode="tool"] .aic-send { width: 34px; height: 34px; border-radius: 10px; }
.aic[data-mode="tool"] .aic-under { margin-top: 7px; }
.aic[data-mode="tool"] .aic-chip { height: 26px; font-size: 12px; padding: 0 10px; }

/* ---------- Phones ---------- */
@media (max-width: 639px) {
  .aic-mount-home { min-height: 92px; }
  .aic-mount-tool { min-height: 84px; }
  .aic-bar { height: 52px; padding: 0 5px 0 10px; gap: 2px; }
  .aic-spark { display: none; }
  .aic-input { padding-left: 4px; font-size: 16px; } /* 16px keeps iOS from zooming in */
  .aic[data-mode="tool"] .aic-input { font-size: 16px; }
  .aic-ibtn, .aic-send { width: 36px; height: 36px; }
  .aic-under { gap: 8px; }
  .aic-left-full { display: none; }
  .aic-card { padding: 12px 13px 13px; }
  .aic-actions .aic-hint { display: none; }
  .aic-fname { max-width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  .aic-card, .aic-dots span, .aic[data-listening="true"] [data-mic], .aic-ibtn.aic-attn, .aic-ava[data-tone="running"] svg { animation: none; }
}
