/* Ожидание видно везде одинаково (public/js/busy.js):
   1) полоса вверху страницы — идёт запрос к программе или открывается следующая страница;
   2) надпись вида «Сохраняю…», «Загружаю…» — сама получает крутилку, перелив и счётчик секунд;
   3) карточка долгой работы (ИИ пишет ответ) — этапы, полоса по обычному времени, «строки текста». */

/* 1. Полоса вверху */
#bw-top { position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 2147483000; pointer-events: none; opacity: 0; transition: opacity .25s; }
#bw-top.on { opacity: 1; }
#bw-top i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #17357a, #3f7bf0 55%, #7fd3ff); box-shadow: 0 0 10px rgba(63, 123, 240, .7); border-radius: 0 3px 3px 0; transition: width .35s ease-out; }
#bw-top.on i { animation: bw-top-glow 1.2s ease-in-out infinite; }
@keyframes bw-top-glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }

/* 2. Надпись ожидания */
.bw-inline { position: relative; display: inline-flex; align-items: center; gap: 8px; color: #17357a !important;
  background: linear-gradient(100deg, currentColor 0%, currentColor 40%, #7fa8ff 50%, currentColor 60%, currentColor 100%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: bw-shine 1.6s linear infinite; }
.bw-inline::before { content: ''; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #c9d8ff; border-top-color: #17357a; animation: bw-spin .75s linear infinite; }
.bw-inline[data-bw-t]::after { content: attr(data-bw-t); flex: none; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #eaf0fb; color: #4b5d86; -webkit-text-fill-color: #4b5d86; white-space: nowrap; }
.bw-inline.bw-long[data-bw-t]::after { background: #fff4d6; color: #8a5a10; -webkit-text-fill-color: #8a5a10; }
button.bw-inline, .btn.bw-inline { -webkit-text-fill-color: currentColor; background: none; animation: none; color: inherit !important; }
button.bw-inline::before, .btn.bw-inline::before { border-color: rgba(255, 255, 255, .45); border-top-color: currentColor; }
button.bw-inline[data-bw-t]::after, .btn.bw-inline[data-bw-t]::after { display: none; }
@keyframes bw-spin { to { transform: rotate(360deg); } }
@keyframes bw-shine { from { background-position: 120% 0; } to { background-position: -100% 0; } }

/* 3. Карточка долгой работы */
.bw-card { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; margin: 10px 0; padding: 14px 16px 12px; border: 1px solid #cfdcf8; border-radius: 14px;
  background: linear-gradient(135deg, #f5f8ff, #eef4ff 60%, #f7f3ff); box-shadow: 0 2px 10px rgba(23, 53, 122, .07); overflow: hidden; position: relative; }
.bw-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .65) 50%, transparent 70%); background-size: 250% 100%; animation: bw-shine 2.4s linear infinite; pointer-events: none; }
.bw-orb { grid-row: 1 / span 2; width: 38px; height: 38px; border-radius: 50%; position: relative; background: conic-gradient(from 0deg, #17357a, #3f7bf0, #a58bff, #7fd3ff, #17357a); animation: bw-spin 1.6s linear infinite; }
.bw-orb::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: #f5f8ff; }
.bw-orb b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; z-index: 1; animation: bw-spin 1.6s linear infinite reverse; }
.bw-title { font-weight: 650; font-size: 14.5px; color: #17357a; }
.bw-stage { font-size: 13px; color: #4b5d86; min-height: 18px; transition: opacity .25s; }
.bw-stage.swap { opacity: 0; }
.bw-time { grid-row: 1 / span 2; font: 600 13px/1 ui-monospace, Consolas, monospace; color: #4b5d86; background: #fff; border: 1px solid #d9e3f8; border-radius: 999px; padding: 6px 10px; white-space: nowrap; }
.bw-bar { grid-column: 1 / -1; height: 6px; margin-top: 8px; border-radius: 999px; background: #dfe8fb; overflow: hidden; }
.bw-bar i { display: block; height: 100%; width: 3%; border-radius: 999px; background: linear-gradient(90deg, #17357a, #3f7bf0, #a58bff); background-size: 200% 100%; animation: bw-shine 1.4s linear infinite; transition: width .9s ease-out; }
.bw-lines { grid-column: 1 / -1; display: grid; gap: 7px; margin-top: 10px; }
.bw-lines i { display: block; height: 9px; border-radius: 6px; background: linear-gradient(90deg, #dde6fa 20%, #f3f6ff 45%, #dde6fa 70%); background-size: 220% 100%; animation: bw-shine 1.5s linear infinite; }
.bw-lines i:nth-child(1) { width: 92%; } .bw-lines i:nth-child(2) { width: 78%; animation-delay: .15s; } .bw-lines i:nth-child(3) { width: 85%; animation-delay: .3s; } .bw-lines i:nth-child(4) { width: 46%; animation-delay: .45s; }
.bw-card.typing .bw-lines { display: none; }
.bw-card.long { border-color: #f2dda6; background: linear-gradient(135deg, #fffaf0, #fff6e0); }
.bw-card.long .bw-stage { color: #8a5a10; }
.bw-card.done { animation: bw-out .35s ease-in forwards; }
@keyframes bw-out { to { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 560px) { .bw-card { grid-template-columns: auto 1fr; } .bw-time { grid-row: auto; grid-column: 1 / -1; justify-self: start; } }
@media (prefers-reduced-motion: reduce) { .bw-inline, .bw-inline::before, .bw-card::before, .bw-orb, .bw-orb b, .bw-bar i, .bw-lines i, #bw-top.on i { animation-duration: 4s; } }
