/* TinyWhisk AI Chat — floating widget styles */
.twchat * { box-sizing: border-box; }
.twchat { position: fixed; right: 22px; bottom: 22px; z-index: 999999; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

/* Launcher button */
.twchat-toggle {
	position: relative; width: 60px; height: 60px; border: none; border-radius: 50%;
	background: linear-gradient(135deg, #ff8a3d 0%, #ff6a3d 100%);
	color: #fff; cursor: pointer; box-shadow: 0 8px 22px rgba(255,106,61,.45);
	display: flex; align-items: center; justify-content: center;
	transition: transform .18s ease, box-shadow .18s ease;
}
.twchat-toggle:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(255,106,61,.55); }
.twchat-toggle-icon { display: block; }
.twchat-badge {
	position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
	background: #ff3b3b; color: #fff; border-radius: 11px; font-size: 12px; font-weight: 700;
	display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.twchat-pulse {
	position: absolute; inset: 0; border-radius: 50%; border: 2px solid #ff6a3d;
	animation: twchat-pulse 2s infinite; opacity: 0; pointer-events: none;
}
@keyframes twchat-pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.5); opacity: 0; } }

/* Panel */
.twchat-panel {
	position: absolute; right: 0; bottom: 74px; width: 372px; max-width: calc(100vw - 28px);
	height: 560px; max-height: calc(100vh - 110px);
	background: #fff; border-radius: 18px; overflow: hidden;
	box-shadow: 0 18px 50px rgba(20,20,40,.28); display: flex; flex-direction: column;
	transform-origin: bottom right; animation: twchat-pop .22s ease;
}
@keyframes twchat-pop { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* Header */
.twchat-header {
	display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: #fff;
	background: linear-gradient(135deg, #ff8a3d 0%, #ff6a3d 60%, #ff5e7a 100%);
}
.twchat-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.twchat-head-text { flex: 1; min-width: 0; }
.twchat-title { font-weight: 700; font-size: 15px; }
.twchat-sub { font-size: 12px; opacity: .92; display: flex; align-items: center; gap: 6px; }
.twchat-dot { width: 8px; height: 8px; border-radius: 50%; background: #38e08a; box-shadow: 0 0 0 3px rgba(56,224,138,.35); }
.twchat-close { background: transparent; border: none; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 2px; opacity: .9; }
.twchat-close:hover { opacity: 1; }

/* Tabs */
.twchat-tabs { display: flex; border-bottom: 1px solid #f0f0f0; background: #fff; }
.twchat-tab { flex: 1; border: none; background: transparent; padding: 11px 0; font-size: 14px; font-weight: 600; color: #9aa0aa; cursor: pointer; border-bottom: 2px solid transparent; }
.twchat-tab.is-active { color: #ff6a3d; border-bottom-color: #ff6a3d; }

/* Body */
.twchat-body { flex: 1; overflow: hidden; position: relative; background: #f7f8fb; }
.twchat-pane { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 14px; overflow-y: auto; }
.twchat-pane[hidden] { display: none; }

/* Messages */
.twchat-messages { display: flex; flex-direction: column; gap: 10px; }
.twchat-row { display: flex; gap: 8px; align-items: flex-end; }
.twchat-row.bot { justify-content: flex-start; }
.twchat-row.user { justify-content: flex-end; }
.twchat-bot-ic { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg,#ff8a3d,#ff5e7a); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.twchat-bubble { max-width: 78%; padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.twchat-row.bot .twchat-bubble { background: #fff; color: #23262b; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.twchat-row.user .twchat-bubble { background: linear-gradient(135deg,#ff8a3d,#ff6a3d); color: #fff; border-bottom-right-radius: 4px; }
.twchat-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.twchat-typing span { width: 7px; height: 7px; border-radius: 50%; background: #cfd3da; animation: twchat-blink 1.2s infinite; }
.twchat-typing span:nth-child(2) { animation-delay: .2s; }
.twchat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes twchat-blink { 0%,60%,100% { opacity: .3; } 30% { opacity: 1; } }

/* Quick replies */
.twchat-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.twchat-chip { border: 1px solid #ffd2bd; background: #fff4ef; color: #d8491f; font-size: 13px; padding: 7px 12px; border-radius: 16px; cursor: pointer; transition: background .15s; }
.twchat-chip:hover { background: #ffe6da; }

/* Contact pane */
.twchat-contact-card { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid #eef0f4; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.twchat-contact-ic { width: 38px; height: 38px; border-radius: 10px; background: #fff4ef; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.twchat-contact-info { flex: 1; min-width: 0; }
.twchat-contact-name { font-size: 12px; color: #9aa0aa; }
.twchat-contact-val { font-size: 14px; font-weight: 600; color: #23262b; }
.twchat-contact-btn { text-decoration: none; background: linear-gradient(135deg,#ff8a3d,#ff6a3d); color: #fff; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 12px; white-space: nowrap; }
.twchat-contact-btn:hover { opacity: .92; }
.twchat-contact-note { font-size: 12.5px; color: #8a909c; line-height: 1.55; margin: 6px 2px 0; }

/* Input bar */
.twchat-inputbar { display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid #f0f0f0; }
.twchat-input { flex: 1; border: 1px solid #e6e8ee; border-radius: 22px; padding: 10px 15px; font-size: 14px; outline: none; }
.twchat-input:focus { border-color: #ff8a3d; box-shadow: 0 0 0 3px rgba(255,138,61,.15); }
.twchat-send { width: 42px; height: 42px; border: none; border-radius: 50%; background: linear-gradient(135deg,#ff8a3d,#ff6a3d); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.twchat-send:hover { opacity: .92; }
.twchat-send:disabled { opacity: .5; cursor: default; }

/* Mobile: full-width bottom sheet */
@media (max-width: 480px) {
	.twchat { right: 0; bottom: 0; left: 0; }
	.twchat-toggle { right: 16px; bottom: 16px; position: absolute; }
	.twchat-panel { right: 0; bottom: 0; left: 0; width: 100%; height: 80vh; max-height: 80vh; border-radius: 18px 18px 0 0; bottom: 0; }
	@keyframes twchat-pop { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
}
