/* ============================================================
   Assistant chat widget (_AssistantWidget.razor) — extracted styles
   Linked globally from Components/App.razor
   ============================================================ */

/* ── Launcher ── */
.asstw-fab {
    position: fixed; right: 18px; left: auto; bottom: 29px; z-index: 3000;
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%;
    background: linear-gradient(135deg, #252B6A 0%, #3B47B5 60%, #5B6BD9 100%);
    color: white; cursor: pointer;
    box-shadow: 0 12px 28px rgba(37,43,106,0.42);
    animation: asstw-in 0.5s cubic-bezier(0.34,1.4,0.64,1) 0.3s both;
    transition: transform 0.14s ease, filter 0.18s ease;
}
.asstw-fab:hover { filter: brightness(1.07); transform: translateY(-2px); }
.asstw-fab:active { transform: scale(0.95); }
.asstw-fab .mud-icon-root { color: white !important; font-size: 26px !important; }
.asstw-fab-label { line-height: 1; }
.asstw-fab-pulse {
    position: absolute; inset: 0; border-radius: 999px;
    border: 2px solid rgba(91,107,217,0.55); animation: asstw-ring 2.6s ease-out infinite; pointer-events: none;
}
@keyframes asstw-ring { 0% { opacity: 0.6; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes asstw-in { from { opacity: 0; transform: translateY(18px) scale(0.8); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ── Floating panel (non-modal: no backdrop, page stays interactive) ── */
.asstw-panel {
    position: fixed; right: 18px; left: auto; bottom: 24px; z-index: 3001;
    width: min(420px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 110px));
    display: flex; flex-direction: column; overflow: hidden;
    background: #EEF1FA; border: 1px solid rgba(37,43,106,0.14); border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15,19,56,0.34);
    animation: asstw-pop 0.34s cubic-bezier(0.22,0.61,0.36,1) both;
    font-family: inherit;
}
@keyframes asstw-pop { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.asstw-header {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px;
    background: linear-gradient(135deg, #252B6A 0%, #3B47B5 100%); color: white; flex-shrink: 0;
}
.asstw-logo {
    position: relative; width: 38px; height: 38px; border-radius: 11px; background: white;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.asstw-logo img { width: 26px; height: 26px; object-fit: contain; }
.asstw-pulse {
    position: absolute; inset: -4px; border-radius: 15px; border: 2px solid rgba(255,255,255,0.5);
    animation: asstw-ring 2.4s ease-out infinite; pointer-events: none;
}
.asstw-meta { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.asstw-title { font-size: 0.98rem; font-weight: 800; }
.asstw-sub { font-size: 0.7rem; opacity: 0.9; display: inline-flex; align-items: center; gap: 5px; }
.asstw-dot-on { width: 7px; height: 7px; border-radius: 50%; background: #4CD964; box-shadow: 0 0 0 3px rgba(76,217,100,0.25); }
.asstw-icon-btn {
    width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.12); color: white;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
}
.asstw-icon-btn:hover { background: rgba(255,255,255,0.22); }
.asstw-icon-btn:active { transform: scale(0.92); }
.asstw-icon-btn .mud-icon-root { color: white !important; }

.asstw-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
.asstw-track { display: flex; flex-direction: column; gap: 11px; padding: 14px 12px; }

.asstw-row { display: flex; align-items: flex-end; gap: 7px; }
.asstw-row.is-bot { justify-content: flex-start; }
.asstw-row.is-user { justify-content: flex-start; flex-direction: row-reverse; }

.asstw-avatar {
    width: 28px; height: 28px; border-radius: 8px; background: white; flex-shrink: 0;
    border: 1px solid rgba(37,43,106,0.12); display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.asstw-avatar img { width: 19px; height: 19px; object-fit: contain; }

.asstw-bubble {
    max-width: 82%; padding: 10px 13px; border-radius: 15px; font-size: 0.88rem; line-height: 1.75;
    box-shadow: 0 2px 8px rgba(15,19,56,0.06);
    animation: asstw-bub 0.26s cubic-bezier(0.22,0.61,0.36,1) both;
}
@keyframes asstw-bub { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.asstw-bubble.bot { background: #FFFFFF; color: #1A1F3A; border: 1px solid rgba(37,43,106,0.10); border-bottom-right-radius: 5px; }
.asstw-bubble.user { background: linear-gradient(135deg, #252B6A, #3B47B5); color: white; border-bottom-left-radius: 5px; }
.asstw-text { white-space: pre-line; }

.asstw-open-btn {
    margin-top: 9px; display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border: 0; border-radius: 10px;
    background: linear-gradient(135deg, #2E9E5C, #5BC97D); color: white;
    font-family: inherit; font-weight: 700; font-size: 0.8rem; cursor: pointer;
    box-shadow: 0 5px 12px rgba(46,158,92,0.28); transition: filter 0.18s ease, transform 0.12s ease;
}
.asstw-open-btn:hover { filter: brightness(1.05); }
.asstw-open-btn:active { transform: scale(0.97); }
.asstw-open-btn .mud-icon-root { color: white !important; }

.asstw-login-note { margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; color: #B7810E; }
.asstw-login-note .mud-icon-root { color: #B7810E !important; font-size: 15px !important; }

.asstw-chips { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.asstw-chip {
    padding: 6px 11px; border-radius: 999px; border: 1px solid rgba(37,43,106,0.20);
    background: rgba(37,43,106,0.05); color: #252B6A; font-family: inherit; font-size: 0.76rem; font-weight: 600; cursor: pointer;
    transition: background 0.16s ease, transform 0.12s ease, border-color 0.16s ease;
}
.asstw-chip:hover { background: rgba(37,43,106,0.12); border-color: rgba(37,43,106,0.35); }
.asstw-chip:active { transform: scale(0.96); }

/* Selectable active-case buttons (live data). */
.asstw-cases { margin-top: 9px; display: flex; flex-direction: column; gap: 6px; }
.asstw-case {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 9px 12px; border-radius: 11px;
    border: 1px solid rgba(37,43,106,0.18); background: #FFFFFF; color: #1A1F3A;
    font-family: inherit; font-size: 0.83rem; font-weight: 600; cursor: pointer; text-align: right;
    transition: background 0.16s ease, transform 0.12s ease, border-color 0.16s ease;
}
.asstw-case:hover { background: rgba(37,43,106,0.06); border-color: rgba(37,43,106,0.35); }
.asstw-case:active { transform: scale(0.985); }
.asstw-case .mud-icon-root { color: #3B47B5 !important; font-size: 18px !important; flex-shrink: 0; }
.asstw-case-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asstw-case-serial {
    font-size: 0.72rem; font-weight: 700; color: #5B6BD9;
    background: rgba(91,107,217,0.12); padding: 2px 8px; border-radius: 999px; flex-shrink: 0;
    font-feature-settings: "tnum";
}

/* copy-to-clipboard action on bot bubbles */
.asstw-copy {
    margin-top: 8px; display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(37,43,106,0.16);
    background: rgba(37,43,106,0.04); color: #5A6080; font-family: inherit;
    font-size: 0.7rem; font-weight: 600; cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.asstw-copy:hover { background: rgba(37,43,106,0.10); color: #252B6A; border-color: rgba(37,43,106,0.30); }
.asstw-copy .mud-icon-root { font-size: 14px !important; color: inherit !important; }
.asstw-copied { color: #2E9E5C; }

.asstw-typing { display: inline-flex; gap: 5px; align-items: center; }
.asstw-d { width: 7px; height: 7px; border-radius: 50%; background: #8A90AE; animation: asstw-ty 1.2s infinite ease-in-out; }
.asstw-d:nth-child(2) { animation-delay: 0.18s; }
.asstw-d:nth-child(3) { animation-delay: 0.36s; }
@keyframes asstw-ty { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

.asstw-composer {
    display: flex; align-items: flex-end; gap: 8px; padding: 10px;
    background: #FFFFFF; border-top: 1px solid rgba(37,43,106,0.10); flex-shrink: 0;
}
.asstw-input {
    flex: 1; min-height: 42px; max-height: 150px; padding: 10px 16px;
    border: 1px solid rgba(37,43,106,0.16); border-radius: 21px;
    background: #F4F6FC; font-family: inherit; font-size: 0.88rem; line-height: 1.5;
    color: #1A1F3A; outline: none; text-align: right; resize: none; overflow-y: auto;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.asstw-input:focus { border-color: rgba(37,43,106,0.4); box-shadow: 0 0 0 3px rgba(37,43,106,0.12); background: white; }
.asstw-send {
    width: 42px; height: 42px; border-radius: 50%; border: 0; flex-shrink: 0;
    background: linear-gradient(135deg, #252B6A, #3B47B5); color: white; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(37,43,106,0.30); transition: filter 0.18s ease, transform 0.12s ease, opacity 0.18s ease;
}
.asstw-send:hover:not(:disabled) { filter: brightness(1.06); }
.asstw-send:active:not(:disabled) { transform: scale(0.94); }
.asstw-send:disabled { opacity: 0.5; cursor: not-allowed; }
.asstw-send .mud-icon-root { color: white !important; transform: scaleX(-1); }

/* On narrow screens the panel fills the width comfortably. */
@media (max-width: 520px) {
    .asstw-panel { inset-inline-start: 8px; inset-inline-end: 8px; width: auto; bottom: 8px; height: calc(100vh - 80px); }
}
@media (prefers-reduced-motion: reduce) {
    .asstw-fab, .asstw-panel, .asstw-bubble, .asstw-pulse, .asstw-fab-pulse, .asstw-d { animation: none; }
}
