/* KAIA chat widget. Loaded on every page; the widget itself is built by /assets/kaia.js. */
.kaia-launch { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border: 0; border-radius: 9999px; background: #0B1428; color: #FFFFFF; font: 600 14px/1.5 Inter, "IBM Plex Sans Thai", sans-serif; cursor: pointer; box-shadow: 0 12px 28px -10px rgba(11, 20, 40, 0.55), 0 0 0 1px rgba(0, 212, 232, 0.35); transition: transform 200ms cubic-bezier(0.2, 0, 0, 1), box-shadow 200ms; }
.kaia-launch:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -10px rgba(0, 102, 255, 0.55), 0 0 0 1px rgba(0, 212, 232, 0.7); }
.kaia-launch:focus-visible, .kaia button:focus-visible, .kaia textarea:focus-visible, .kaia a:focus-visible { outline: 2px solid #00D4E8; outline-offset: 2px; }
.kaia-launch img { width: 44px; height: 44px; border-radius: 9999px; object-fit: cover; box-shadow: 0 0 0 2px #00D4E8; }
.kaia-launch .kaia-dot { position: absolute; left: 40px; top: 8px; width: 10px; height: 10px; border-radius: 9999px; background: #22C55E; box-shadow: 0 0 0 2px #0B1428; }
.kaia-launch[aria-expanded="true"] { display: none; }
@media (max-width: 639px) { .kaia-launch { padding: 6px; } .kaia-launch .kaia-launch-text { display: none; } }

.kaia { position: fixed; right: 20px; bottom: 20px; z-index: 61; width: 380px; height: min(600px, calc(100vh - 40px)); display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: #FFFFFF; color: #0B1428; font: 400 15px/1.7 Inter, "IBM Plex Sans Thai", sans-serif; box-shadow: 0 24px 60px -18px rgba(11, 20, 40, 0.55), 0 0 0 1px rgba(198, 198, 205, 0.8); }
.kaia[hidden] { display: none; }
@media (max-width: 639px) { .kaia { inset: 0; width: auto; height: auto; border-radius: 0; } }
@media (prefers-reduced-motion: no-preference) { .kaia:not([hidden]) { animation: kaia-in 240ms cubic-bezier(0.2, 0, 0, 1); } @keyframes kaia-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } } }

.kaia-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: linear-gradient(135deg, #0B1428, #14306B); color: #FFFFFF; }
.kaia-face { position: relative; width: 42px; height: 42px; flex: none; }
.kaia-face img { width: 100%; height: 100%; border-radius: 9999px; object-fit: cover; box-shadow: 0 0 0 2px #00D4E8; }
.kaia-speaking .kaia-face::after { content: ""; position: absolute; inset: -5px; border-radius: 9999px; border: 2px solid #00D4E8; animation: kaia-ring 1.2s ease-out infinite; }
@keyframes kaia-ring { from { opacity: 0.9; transform: scale(0.92); } to { opacity: 0; transform: scale(1.25); } }
.kaia-title { flex: 1; min-width: 0; }
.kaia-title strong { display: block; font: 700 16px/1.4 "Space Grotesk", "IBM Plex Sans Thai", sans-serif; }
.kaia-title span { display: block; font-size: 13px; line-height: 1.5; color: #B4C0D8; }
.kaia-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 9999px; background: transparent; color: inherit; cursor: pointer; }
.kaia-icon:hover { background: rgba(255, 255, 255, 0.12); }
.kaia-icon svg { width: 20px; height: 20px; }

.kaia-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #F5F7FA; overscroll-behavior: contain; }
.kaia-msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.kaia-msg.bot { align-self: flex-start; background: #FFFFFF; border: 1px solid #E1E4EA; border-bottom-left-radius: 4px; }
.kaia-msg.user { align-self: flex-end; background: #0066FF; color: #FFFFFF; border-bottom-right-radius: 4px; }
.kaia-msg.note { align-self: stretch; max-width: none; font-size: 13px; line-height: 1.6; color: #39485A; background: #EEF4FF; border: 1px solid #C9DAFF; }
.kaia-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.kaia-actions a, .kaia-actions button, .kaia-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9999px; border: 1px solid #0066FF; background: #FFFFFF; color: #0066FF; font: 600 13px/1.5 inherit; font-family: inherit; text-decoration: none; cursor: pointer; }
.kaia-actions a:hover, .kaia-actions button:hover, .kaia-chip:hover { background: #0066FF; color: #FFFFFF; }
.kaia-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kaia-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.kaia-typing i { width: 7px; height: 7px; border-radius: 9999px; background: #8FA3C8; animation: kaia-bounce 1s infinite ease-in-out; }
.kaia-typing i:nth-child(2) { animation-delay: 0.15s; } .kaia-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes kaia-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-4px); opacity: 1; } }

.kaia-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid #E1E4EA; background: #FFFFFF; }
.kaia-form textarea { flex: 1; min-height: 42px; max-height: 120px; padding: 10px 12px; resize: none; border: 1px solid #C6C6CD; border-radius: 12px; font: 400 15px/1.5 inherit; font-family: inherit; color: #0B1428; }
.kaia-form textarea:focus { border-color: #0066FF; outline: none; }
.kaia-send, .kaia-mic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 0; border-radius: 12px; cursor: pointer; }
.kaia-send { background: #0066FF; color: #FFFFFF; }
.kaia-send:disabled { background: #C6C6CD; cursor: default; }
.kaia-mic { background: #EEF4FF; color: #0066FF; }
.kaia-mic[aria-pressed="true"] { background: #E5484D; color: #FFFFFF; }
@media (prefers-reduced-motion: no-preference) { .kaia-mic[aria-pressed="true"] { animation: kaia-rec 1.2s ease-in-out infinite; } @keyframes kaia-rec { 50% { box-shadow: 0 0 0 6px rgba(229, 72, 77, 0.25); } } }
.kaia-send svg, .kaia-mic svg { width: 20px; height: 20px; }
.kaia-foot { padding: 0 12px 10px; font-size: 12px; line-height: 1.5; color: #516072; background: #FFFFFF; }
@media (prefers-reduced-motion: reduce) { .kaia-typing i, .kaia-speaking .kaia-face::after { animation: none; } .kaia-launch { transition: none; } }
