/*
 * TVR Roofing Assistant - Gold theme.
 * Vanilla CSS, fully namespaced (.tvr-ra-*). No external fonts or CDNs.
 */

.tvr-ra-root {
	--tvr-ra-gold: #C9A227;
	--tvr-ra-dark: #16130C;
	--tvr-ra-text: #1A1A1A;
	--tvr-ra-gold-soft: #FBF5E1;
	--tvr-ra-radius: 16px;
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.4;
}

.tvr-ra-root,
.tvr-ra-root *,
.tvr-ra-preview-window,
.tvr-ra-preview-window * {
	box-sizing: border-box;
}

.tvr-ra-pos-right { right: 20px; }
.tvr-ra-pos-left { left: 20px; }

/* Launcher */
.tvr-ra-launcher {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: linear-gradient(135deg, #E3C75A 0%, var(--tvr-ra-gold) 55%, #A8841A 100%);
	color: var(--tvr-ra-dark);
	border: none;
	border-radius: 999px;
	padding: 14px 20px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(201, 162, 39, 0.45);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tvr-ra-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 28px rgba(201, 162, 39, 0.6);
}

.tvr-ra-launcher:focus-visible,
.tvr-ra-btn:focus-visible,
.tvr-ra-send:focus-visible,
.tvr-ra-close:focus-visible {
	outline: 3px solid var(--tvr-ra-dark);
	outline-offset: 2px;
}

.tvr-ra-launcher-icon { display: inline-flex; }

/* Window */
.tvr-ra-window {
	position: fixed;
	bottom: 20px;
	width: 400px;
	max-width: calc(100vw - 40px);
	height: 650px;
	max-height: calc(100vh - 40px);
	background: #FFFFFF;
	border-radius: var(--tvr-ra-radius, 16px);
	border: 1px solid rgba(201, 162, 39, 0.5);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.tvr-ra-pos-right .tvr-ra-window { right: 20px; }
.tvr-ra-pos-left .tvr-ra-window { left: 20px; }

.tvr-ra-window.tvr-ra-open {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.tvr-ra-window[hidden] { display: none; }

@media (max-width: 480px) {
	.tvr-ra-window {
		width: calc(100vw - 16px);
		height: calc(100vh - 90px);
		bottom: 8px;
		right: 8px !important;
		left: 8px !important;
		max-width: calc(100vw - 16px);
	}
}

/* Header */
.tvr-ra-header {
	background: var(--tvr-ra-dark);
	color: #FFFFFF;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	border-bottom: 3px solid var(--tvr-ra-gold);
}

.tvr-ra-header-title {
	font-size: 16px;
	font-weight: 700;
	color: var(--tvr-ra-gold);
	line-height: 1.3;
}

.tvr-ra-header-subtitle {
	font-size: 12.5px;
	opacity: 0.85;
	margin-top: 2px;
}

.tvr-ra-close {
	background: transparent;
	border: none;
	color: #FFFFFF;
	cursor: pointer;
	padding: 6px;
	border-radius: 8px;
	display: inline-flex;
}

.tvr-ra-close:hover { background: rgba(255, 255, 255, 0.15); }
.tvr-ra-close:focus-visible { outline-color: var(--tvr-ra-gold); }

/* Body */
.tvr-ra-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #FAF8F2;
}

.tvr-ra-message {
	max-width: 88%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	white-space: pre-line;
	word-wrap: break-word;
	animation: tvr-ra-fade 0.18s ease;
}

@keyframes tvr-ra-fade {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}

.tvr-ra-message-bot {
	align-self: flex-start;
	background: #FFFFFF;
	color: var(--tvr-ra-text);
	border: 1px solid #EADFBD;
	border-left: 3px solid var(--tvr-ra-gold);
	border-bottom-left-radius: 4px;
}

.tvr-ra-message-user {
	align-self: flex-end;
	background: var(--tvr-ra-gold);
	color: var(--tvr-ra-dark);
	font-weight: 600;
	border-bottom-right-radius: 4px;
}

.tvr-ra-message ul {
	margin: 6px 0 0;
	padding-left: 18px;
}

.tvr-ra-message li { margin-bottom: 2px; }

/* Typing */
.tvr-ra-typing {
	align-self: flex-start;
	background: #FFFFFF;
	border: 1px solid #EADFBD;
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	padding: 12px 16px;
	display: inline-flex;
	gap: 4px;
}

.tvr-ra-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--tvr-ra-gold);
	display: inline-block;
	animation: tvr-ra-bounce 1.2s infinite ease-in-out;
}

.tvr-ra-typing span:nth-child(2) { animation-delay: 0.15s; }
.tvr-ra-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes tvr-ra-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* Buttons (button and anchor variants) */
.tvr-ra-quick-actions {
	padding: 10px 16px 0;
	max-height: 38%;
	overflow-y: auto;
	background: #FAF8F2;
	flex-shrink: 0;
}

.tvr-ra-quick-actions:empty { display: none; }

.tvr-ra-quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 8px;
}

.tvr-ra-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #FFFFFF;
	color: var(--tvr-ra-dark);
	border: 1.5px solid var(--tvr-ra-gold);
	border-radius: 999px;
	padding: 9px 14px;
	font-size: 13.5px;
	font-weight: 600;
	font-family: inherit;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	min-height: 40px;
	transition: background 0.15s ease, color 0.15s ease;
}

.tvr-ra-btn:hover {
	background: var(--tvr-ra-gold-soft);
	color: var(--tvr-ra-dark);
	text-decoration: none;
}

.tvr-ra-btn-primary {
	background: var(--tvr-ra-gold);
	color: var(--tvr-ra-dark);
}

.tvr-ra-btn-primary:hover {
	background: var(--tvr-ra-dark);
	color: var(--tvr-ra-gold);
	border-color: var(--tvr-ra-dark);
}

.tvr-ra-btn-dark {
	background: var(--tvr-ra-dark);
	color: var(--tvr-ra-gold);
	border-color: var(--tvr-ra-dark);
}

.tvr-ra-btn-dark:hover {
	background: #2A2415;
	color: #E3C75A;
}

.tvr-ra-btn-ghost {
	border-color: #D9D2BB;
	color: #5C5538;
	font-weight: 500;
}

.tvr-ra-btn-wide {
	flex: 1 1 100%;
}

/* Input row */
.tvr-ra-input-row {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	background: #FFFFFF;
	border-top: 1px solid #EADFBD;
	flex-shrink: 0;
	margin: 0;
}

.tvr-ra-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 14px;
	border: 1.5px solid #D9D2BB;
	border-radius: 999px;
	font-size: 14px;
	font-family: inherit;
	color: var(--tvr-ra-text);
	background: #FFFFFF;
	box-shadow: none;
}

.tvr-ra-input:focus {
	outline: none;
	border-color: var(--tvr-ra-gold);
	box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.25);
}

.tvr-ra-send {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border: none;
	border-radius: 50%;
	background: var(--tvr-ra-gold);
	color: var(--tvr-ra-dark);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.tvr-ra-send:hover { background: var(--tvr-ra-dark); color: var(--tvr-ra-gold); }

.tvr-ra-footer {
	flex-shrink: 0;
	text-align: center;
	font-size: 11.5px;
	color: #7A7255;
	padding: 8px 14px;
	background: #FFFFFF;
	border-top: 1px solid #F0E9D0;
}

.tvr-ra-static {
	background: #FFFFFF;
	border: 1px solid #EADFBD;
	border-radius: 12px;
	padding: 14px;
	font-size: 14px;
	line-height: 1.6;
}

.tvr-ra-static a { color: #8A6D12; font-weight: 600; }

.tvr-ra-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Admin */
.tvr-ra-admin-columns {
	display: flex;
	gap: 32px;
	margin-top: 20px;
	align-items: flex-start;
	flex-wrap: wrap;
}

.tvr-ra-admin-settings { flex: 1 1 520px; max-width: 640px; }
.tvr-ra-admin-preview { flex: 0 0 420px; position: sticky; top: 40px; }

.tvr-ra-preview-frame {
	background: #EFEBDD;
	border-radius: 12px;
	padding: 20px;
}

.tvr-ra-preview-window {
	position: static;
	width: 100%;
	height: 460px;
	max-width: 100%;
	opacity: 1;
	transform: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
