/* WAT Arrow — widget styles. Inherits theme tokens when available. */

.wata-chat {
	--wata-accent: var(--wp--preset--color--primary, #1f6feb);
	--wata-accent-contrast: #fff;
	--wata-bg: var(--wp--preset--color--base, #ffffff);
	--wata-fg: var(--wp--preset--color--contrast, #1a1a1a);
	--wata-muted: #6b7280;
	--wata-border: #e5e7eb;
	--wata-font: var(--wp--preset--font-family--body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
	font-family: var(--wata-font);
	color: var(--wata-fg);
	box-sizing: border-box;
}
.wata-chat *, .wata-chat *::before, .wata-chat *::after { box-sizing: inherit; }

/* Animated "AI" launcher button (pure CSS — no emoji / inline SVG to be stripped). */
.wata-launcher {
	position: fixed; right: 22px; bottom: 22px; z-index: 99998;
	transition: opacity .2s ease, transform .2s ease;
}
.wata-launcher.is-hidden { opacity: 0; transform: scale(.5); pointer-events: none; }

.wata-launcher__btn {
	position: relative; width: 64px; height: 64px; padding: 0; border: 0; cursor: pointer;
	border-radius: 50%;
	background: linear-gradient(135deg, #7c5cff 0%, #1f6feb 55%, #00d4ff 100%);
	background-size: 220% 220%;
	box-shadow: 0 12px 30px rgba(31,111,235,.45);
	display: inline-flex; align-items: center; justify-content: center;
	animation: wata-gradient 6s ease infinite;
	transition: transform .18s ease, box-shadow .18s ease;
}
.wata-launcher__btn:hover { transform: scale(1.07); box-shadow: 0 16px 38px rgba(31,111,235,.55); }
.wata-launcher__btn:active { transform: scale(.97); }

.wata-launcher__core { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.wata-launcher__ai { color: #fff; font-weight: 800; font-size: 21px; letter-spacing: 1px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.wata-launcher__dot { position: absolute; top: -10px; right: -12px; width: 9px; height: 9px; border-radius: 50%; background: #19e57f; box-shadow: 0 0 0 2px #fff; animation: wata-blink 2s ease-in-out infinite; }

/* Expanding pulse rings */
.wata-launcher__rings { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.wata-launcher__rings::before, .wata-launcher__rings::after {
	content: ''; position: absolute; inset: 0; border-radius: 50%;
	border: 2px solid rgba(31,111,235,.55); animation: wata-ring 2.6s ease-out infinite;
}
.wata-launcher__rings::after { animation-delay: 1.3s; }

/* Hover tooltip */
.wata-launcher__tip {
	position: absolute; right: 76px; bottom: 20px; white-space: nowrap;
	background: #111827; color: #fff; font-size: 12px; font-weight: 600;
	padding: 7px 11px; border-radius: 8px; opacity: 0; transform: translateX(8px);
	transition: opacity .18s ease, transform .18s ease; pointer-events: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wata-launcher:hover .wata-launcher__tip { opacity: 1; transform: translateX(0); }

@keyframes wata-ring { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes wata-gradient { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes wata-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
	.wata-launcher__btn, .wata-launcher__rings::before, .wata-launcher__rings::after, .wata-launcher__dot { animation: none; }
}

/* Floating panel — visibility driven by .is-open so it can animate (and a theme
   can't accidentally reveal it the way it might override the [hidden] attribute). */
.wata-chat--floating {
	position: fixed; right: 22px; bottom: 22px; z-index: 99999;
	width: 380px; max-width: calc(100vw - 32px);
	opacity: 0; visibility: hidden; transform: translateY(16px) scale(.98);
	transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.wata-chat--floating.is-open {
	opacity: 1; visibility: visible; transform: none;
	transition: opacity .22s ease, transform .22s ease, visibility 0s;
}
.wata-chat__panel {
	display: flex; flex-direction: column;
	height: 560px; max-height: calc(100vh - 48px);
	background: var(--wata-bg); border: 1px solid var(--wata-border);
	border-radius: 16px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.22);
}
.wata-chat--embed .wata-chat__panel { height: 520px; box-shadow: none; }

.wata-chat__header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 12px 16px; background: var(--wata-accent); color: #fff;
}
.wata-chat__title { font-weight: 700; font-size: 14px; }
.wata-chat__close { background: transparent; border: 0; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }

.wata-chat__messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--wata-bg); }

.wata-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.wata-msg--bot { align-self: flex-start; background: #f1f3f5; color: #1a1a1a; border-bottom-left-radius: 4px; }
.wata-msg--user { align-self: flex-end; background: var(--wata-accent); color: #fff; border-bottom-right-radius: 4px; }
.wata-msg--system { align-self: center; background: transparent; color: var(--wata-muted); font-size: 12px; text-align: center; }
.wata-msg a { color: inherit; text-decoration: underline; }
.wata-msg--user a { color: #fff; }

/* Typing dots */
.wata-typing { display: inline-flex; gap: 4px; }
.wata-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--wata-muted); opacity: .5; animation: wata-bounce 1.2s infinite; }
.wata-typing span:nth-child(2) { animation-delay: .2s; }
.wata-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes wata-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Cards */
.wata-card { align-self: stretch; border: 1px solid var(--wata-border); border-radius: 12px; padding: 12px; background: #fff; }
.wata-card__head { font-weight: 700; font-size: 14px; margin-bottom: 6px; word-break: break-all; }
.wata-card__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.wata-grade { font-size: 20px; font-weight: 800; color: var(--wata-accent); }
.wata-score { font-size: 12px; color: var(--wata-muted); }
.wata-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.wata-badge--bad { background: #fde2e1; color: #b42318; }
.wata-badge--good { background: #dcfce7; color: #166534; }
.wata-card__issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wata-card__issues li { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.wata-sev { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: #eee; color: #555; }
.wata-sev--critical { background: #b42318; color: #fff; }
.wata-sev--high { background: #d9480f; color: #fff; }
.wata-sev--medium { background: #f59f00; color: #1a1a1a; }
.wata-sev--low { background: #e9ecef; color: #495057; }

.wata-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wata-btn {
	display: inline-block; background: var(--wata-accent); color: #fff !important;
	padding: 8px 14px; border-radius: 8px; text-decoration: none !important;
	font-size: 13px; font-weight: 600;
}
.wata-card--booking { background: #f0fdf4; border-color: #bbf7d0; }

/* Form */
.wata-chat__form { display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--wata-border); background: var(--wata-bg); }
.wata-chat__input { flex: 1; border: 1px solid var(--wata-border); border-radius: 999px; padding: 9px 14px; font-size: 14px; outline: none; }
.wata-chat__input:focus { border-color: var(--wata-accent); }
.wata-chat__send {
	border: 0; background: var(--wata-accent) !important; color: #fff !important;
	padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer;
	flex: 0 0 auto; line-height: 1;
}
.wata-chat__mic {
	border: 1px solid var(--wata-border); background: #fff; color: var(--wata-fg);
	padding: 0 12px; height: 38px; border-radius: 999px; cursor: pointer;
	font-size: 13px; font-weight: 600; flex: 0 0 auto; line-height: 1;
	display: inline-flex; align-items: center;
}
.wata-chat__mic.is-active { background: var(--wata-accent) !important; border-color: var(--wata-accent); color: #fff !important; }
.wata-chat__mic.is-listening { background: var(--wata-accent) !important; color: #fff !important; }
.wata-chat__mic.is-listening { animation: wata-pulse 1.1s infinite; }
@keyframes wata-pulse { 0% { box-shadow: 0 0 0 0 rgba(31,111,235,.5); } 70% { box-shadow: 0 0 0 10px rgba(31,111,235,0); } 100% { box-shadow: 0 0 0 0 rgba(31,111,235,0); } }
