/* ==========================================================================
   UCDreams Tools — Global Chat & 1-Login Modal Styles
   High-contrast, responsive, dark/light mode compatible. No emojis.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Header Auth Widget (Desktop & Mobile)
   -------------------------------------------------------------------------- */
.ucd-header-auth-wrap {
	display: inline-flex;
	align-items: center;
	position: relative;
	font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ucd-header-login-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	background: rgba(239, 68, 68, 0.1);
	color: #ef4444;
	border: 1px solid rgba(239, 68, 68, 0.25);
	border-radius: 99px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	text-decoration: none;
	outline: none;
}

.ucd-header-login-btn:hover {
	background: #ef4444;
	color: #ffffff;
	border-color: #ef4444;
	box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
	transform: translateY(-1px);
}

/* Logged-In User Profile Pill */
.ucd-header-profile-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 5px 12px 5px 6px;
	background: var(--color-surface, #ffffff);
	border: 1px solid var(--color-border, #e2e8f0);
	border-radius: 99px;
	color: var(--color-text, #1e293b);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	outline: none;
}

.ucd-header-profile-btn:hover {
	border-color: #ef4444;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ucd-header-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: linear-gradient(135deg, #ef4444, #b91c1c);
	color: #ffffff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
}

.ucd-header-handle {
	max-width: 100px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ucd-header-chevron {
	transition: transform 0.2s ease;
}

.ucd-header-profile.is-open .ucd-header-chevron {
	transform: rotate(180deg);
}

/* Profile Dropdown Menu */
.ucd-profile-dropdown {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: 220px;
	background: var(--color-surface, #ffffff);
	border: 1px solid var(--color-border, #e2e8f0);
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
	padding: 12px;
	z-index: 99999;
	display: none;
	animation: ucdDropIn 0.2s ease forwards;
}

@keyframes ucdDropIn {
	from { opacity: 0; transform: translateY(-8px); }
	to { opacity: 1; transform: translateY(0); }
}

.ucd-header-profile.is-open .ucd-profile-dropdown {
	display: block;
}

.ucd-dropdown-user-info {
	padding: 6px 8px 12px;
	border-bottom: 1px solid var(--color-border, #e2e8f0);
	margin-bottom: 8px;
}

.ucd-dropdown-user-greeting {
	font-size: 11px;
	color: var(--color-text-muted, #64748b);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 600;
}

.ucd-dropdown-user-name {
	font-size: 15px;
	font-weight: 700;
	color: var(--color-heading, #0f172a);
	margin-top: 2px;
	word-break: break-all;
}

.ucd-dropdown-action-btn {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 10px;
	border-radius: 8px;
	background: transparent;
	border: none;
	color: var(--color-text, #1e293b);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	text-align: left;
	transition: all 0.15s ease;
	text-decoration: none;
}

.ucd-dropdown-action-btn:hover {
	background: rgba(239, 68, 68, 0.08);
	color: #ef4444;
}

.ucd-dropdown-action-btn.is-logout {
	color: #dc2626;
	border-top: 1px solid var(--color-border, #e2e8f0);
	margin-top: 6px;
	padding-top: 10px;
	border-radius: 0 0 8px 8px;
}

.ucd-dropdown-action-btn.is-logout:hover {
	background: rgba(220, 38, 38, 0.1);
}

/* --------------------------------------------------------------------------
   2. Floating Action Controls (FAB Layout)
   AI Chat Bot on Bottom-Left + Report Issue
   Community Chat on Bottom-Right (Circular FAB matching AI Chatbot UI)
   -------------------------------------------------------------------------- */

/* AI Assistant container: Fixed Bottom-Left */
.ucd-assistant-wrap,
.ucd-assistant-wrap.ucd-pos-bottom-left,
.ucd-assistant-wrap.ucd-pos-bottom-right {
	position: fixed !important;
	bottom: 24px !important;
	left: 24px !important;
	right: auto !important;
	z-index: 99995 !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: flex-start !important;
	transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

body.has-cookie-banner .ucd-assistant-wrap,
body.has-cookie-banner .ucd-assistant-wrap.ucd-pos-bottom-left,
body.has-cookie-banner .ucd-assistant-wrap.ucd-pos-bottom-right {
	bottom: calc(24px + 64px) !important;
}

/* Greeting bubble floats cleanly ABOVE the AI button on the left */
.ucd-assistant-greeting-bubble {
	bottom: calc(100% + 14px) !important;
	left: 0 !important;
	right: auto !important;
	z-index: 100000 !important;
}

/* Assistant Dialog Window opens anchored to the bottom-left */
.ucd-assistant-dialog,
.ucd-assistant-wrap.ucd-pos-bottom-left .ucd-assistant-dialog,
.ucd-assistant-wrap.ucd-pos-bottom-right .ucd-assistant-dialog {
	bottom: 74px !important;
	left: 0 !important;
	right: auto !important;
	transform-origin: bottom left !important;
}

/* Report Issue sits beside AI Assistant on the bottom-left */
#ucdReporterTrigger,
.ucd-reporter-fab-trigger,
.ucd-reporter-container .ucd-reporter-fab-trigger,
body .ucd-reporter-fab-trigger {
	position: fixed !important;
	bottom: 34px !important;
	left: 94px !important;
	right: auto !important;
	height: 38px !important;
	box-sizing: border-box !important;
	padding: 0 16px !important;
	display: inline-flex !important;
	align-items: center !important;
	gap: 7px !important;
	border-radius: 999px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	z-index: 99980 !important;
	transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1), left 0.25s ease, opacity 0.2s ease, transform 0.2s ease !important;
}

body.has-cookie-banner #ucdReporterTrigger,
body.has-cookie-banner .ucd-reporter-fab-trigger,
body.has-cookie-banner .ucd-reporter-container .ucd-reporter-fab-trigger {
	bottom: calc(34px + 64px) !important;
}

/* Hide report button when chat panel or assistant dialog is open */
body:has(.ucd-chat-widget-wrap.panel-open) #ucdReporterTrigger,
body:has(.ucd-chat-widget-wrap.panel-open) .ucd-reporter-fab-trigger,
.ucd-chat-widget-wrap.panel-open ~ * #ucdReporterTrigger,
.ucd-chat-widget-wrap.panel-open ~ * .ucd-reporter-fab-trigger,
body:has(.ucd-assistant-dialog.is-active) #ucdReporterTrigger,
body:has(.ucd-assistant-dialog.is-active) .ucd-reporter-fab-trigger,
.ucd-assistant-dialog.is-active ~ * #ucdReporterTrigger,
.ucd-assistant-dialog.is-active ~ * .ucd-reporter-fab-trigger {
	opacity: 0 !important;
	pointer-events: none !important;
}

/* Permanently remove What's New floating trigger icon */
.ucd-wn-floating-pill,
#ucd-wn-trigger {
	display: none !important;
}

/* Community Chat Widget: Positioned on Bottom-Right */
.ucd-chat-widget-wrap {
	position: fixed;
	bottom: 24px;
	right: 24px !important;
	left: auto !important;
	z-index: 99990 !important;
	font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

body.has-cookie-banner .ucd-chat-widget-wrap {
	bottom: calc(24px + 64px) !important;
}

.ucd-chat-widget-wrap.panel-open {
	z-index: 1000005 !important;
}

.ucd-chat-widget-wrap.panel-open .ucd-chat-toggle-btn {
	display: none !important;
}

/* Community Chat FAB Launcher (matches AI Chat Bot circular UI) */
.ucd-chat-toggle-btn {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	background: var(--color-surface, #ffffff);
	color: var(--color-heading, #0f172a);
	border: 1px solid var(--color-border, #cbd5e1);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	cursor: pointer;
	transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.2s ease, background 0.2s ease;
	position: relative;
	outline: none;
}

.ucd-chat-toggle-btn:hover {
	border-color: #ef4444;
	box-shadow: 0 14px 32px rgba(239, 68, 68, 0.22);
	transform: scale(1.08) translateY(-2px);
}

.ucd-chat-toggle-btn:active {
	transform: scale(0.96);
}

/* Hide any residual text */
.ucd-chat-toggle-btn span:not(.ucd-chat-online-pulse):not(.ucd-chat-unread-badge) {
	display: none !important;
}

/* Online pulse dot positioned at top-right of the circle */
.ucd-chat-online-pulse {
	position: absolute;
	top: 11px;
	right: 11px;
	width: 10px;
	height: 10px;
	background: #10b981;
	border-radius: 50%;
	border: 2px solid var(--color-surface, #ffffff);
	box-shadow: 0 0 6px #10b981;
}

.ucd-chat-online-pulse::after {
	content: '';
	position: absolute;
	top: -3px;
	left: -3px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: rgba(16, 185, 129, 0.4);
	animation: ucdPulse 2s infinite ease-out;
}

@keyframes ucdPulse {
	0% { transform: scale(0.6); opacity: 1; }
	100% { transform: scale(1.6); opacity: 0; }
}

.ucd-chat-unread-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	background: #ef4444;
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	border-radius: 999px;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* Dark mode theme support */
[data-theme="dark"] .ucd-chat-toggle-btn,
body.dark-mode .ucd-chat-toggle-btn,
html[data-theme="dark"] .ucd-chat-toggle-btn {
	background: #1e293b;
	border-color: rgba(255, 255, 255, 0.14);
	color: #f8fafc;
	box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .ucd-chat-online-pulse,
body.dark-mode .ucd-chat-online-pulse,
html[data-theme="dark"] .ucd-chat-online-pulse {
	border-color: #1e293b;
}

/* --------------------------------------------------------------------------
   3. Floating Chat Panel Drawer
   -------------------------------------------------------------------------- */
.ucd-chat-panel {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 360px;
	height: 520px;
	max-height: calc(100vh - 48px);
	background: var(--color-surface, #ffffff);
	border: 1px solid var(--color-border, #e2e8f0);
	border-radius: 18px;
	box-shadow: 0 20px 48px rgba(0, 0, 0, 0.2);
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 100000 !important;
	animation: ucdPanelSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ucdPanelSlideUp {
	from { opacity: 0; transform: translateY(18px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.ucd-chat-panel.is-active {
	display: flex;
}

/* Header */
.ucd-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	background: var(--color-surface, #ffffff);
	border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.ucd-chat-header-title-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ucd-chat-header-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--color-heading, #0f172a);
	margin: 0;
}

.ucd-chat-header-tools {
	display: flex;
	align-items: center;
	gap: 6px;
}

.ucd-chat-tool-btn {
	width: 28px;
	height: 28px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 6px;
	color: var(--color-text-muted, #64748b);
	cursor: pointer;
	transition: all 0.15s ease;
}

.ucd-chat-tool-btn:hover {
	background: var(--color-bg, #f1f5f9);
	color: var(--color-heading, #0f172a);
}

/* Message Feed */
.ucd-chat-feed {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--color-bg, #f8fafc);
	scroll-behavior: smooth;
}

.ucd-chat-empty-state {
	margin: auto;
	text-align: center;
	padding: 24px;
	color: var(--color-text-muted, #64748b);
}

.ucd-chat-empty-icon {
	color: #94a3b8;
	margin-bottom: 8px;
}

.ucd-chat-empty-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--color-heading, #0f172a);
}

.ucd-chat-empty-sub {
	font-size: 12px;
	margin-top: 4px;
}

/* Chat Bubbles */
.ucd-chat-msg-row {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	max-width: 88%;
}

.ucd-chat-msg-row.is-me {
	align-self: flex-end;
	align-items: flex-end;
}

.ucd-chat-msg-meta {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 3px;
	font-size: 11px;
}

.ucd-chat-msg-handle {
	font-weight: 700;
	color: var(--color-heading, #0f172a);
}

.ucd-chat-msg-time {
	color: var(--color-text-muted, #94a3b8);
	font-size: 10px;
}

.ucd-chat-bubble {
	padding: 9px 13px;
	border-radius: 12px 12px 12px 2px;
	background: var(--color-surface, #ffffff);
	border: 1px solid var(--color-border, #e2e8f0);
	color: var(--color-text, #1e293b);
	font-size: 13px;
	line-height: 1.45;
	word-break: break-word;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ucd-chat-msg-row.is-me .ucd-chat-bubble {
	border-radius: 12px 12px 2px 12px;
	background: #ef4444;
	color: #ffffff;
	border-color: #ef4444;
	box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}

/* Footer / Input Area */
.ucd-chat-footer {
	padding: 12px;
	background: var(--color-surface, #ffffff);
	border-top: 1px solid var(--color-border, #e2e8f0);
}

.ucd-chat-form {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ucd-chat-input {
	flex: 1;
	padding: 9px 14px;
	background: var(--color-bg, #f8fafc);
	border: 1px solid var(--color-border, #cbd5e1);
	border-radius: 99px;
	font-size: 13px;
	color: var(--color-text, #1e293b);
	outline: none;
	transition: all 0.2s ease;
	font-family: inherit;
}

.ucd-chat-input:focus {
	border-color: #ef4444;
	background: var(--color-surface, #ffffff);
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.ucd-chat-send-btn {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #ef4444;
	color: #ffffff;
	border: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	outline: none;
	flex-shrink: 0;
}

.ucd-chat-send-btn:hover {
	background: #dc2626;
	transform: scale(1.04);
}

.ucd-chat-send-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

/* Voice Recording & Audio Playback Styles */
.ucd-chat-voice-btn {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--color-bg, #f1f5f9);
	color: var(--color-text, #475569);
	border: 1px solid var(--color-border, #cbd5e1);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	outline: none;
	flex-shrink: 0;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
}

.ucd-chat-voice-btn:hover {
	background: rgba(239, 68, 68, 0.1);
	border-color: #ef4444;
	color: #ef4444;
	transform: scale(1.05);
}

.ucd-chat-voice-btn.is-recording {
	background: #ef4444;
	color: #ffffff;
	border-color: #ef4444;
	animation: ucdMicPulse 1s infinite;
}

@keyframes ucdMicPulse {
	0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
	70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
	100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Voice Recording Bar */
.ucd-chat-recording-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 4px 6px;
	background: var(--color-bg, #f8fafc);
	border: 1px solid rgba(239, 68, 68, 0.35);
	border-radius: 99px;
	animation: ucdFadeIn 0.2s ease forwards;
}

.ucd-recording-live-indicator {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.ucd-recording-pulse-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #ef4444;
	animation: ucdDotBlink 0.9s infinite alternate;
}

@keyframes ucdDotBlink {
	from { opacity: 0.3; transform: scale(0.85); }
	to { opacity: 1; transform: scale(1.15); }
}

.ucd-recording-timer {
	font-size: 12px;
	font-weight: 700;
	color: #ef4444;
	font-variant-numeric: tabular-nums;
	font-family: inherit;
}

.ucd-recording-wave-visualizer {
	display: flex;
	align-items: center;
	gap: 3px;
	flex: 1;
	justify-content: center;
	height: 18px;
}

.ucd-recording-wave-visualizer span {
	width: 2.5px;
	border-radius: 2px;
	background: #ef4444;
	animation: ucdWaveBounce 0.8s infinite ease-in-out alternate;
}

.ucd-recording-wave-visualizer span:nth-child(1) { height: 4px; animation-delay: 0.1s; }
.ucd-recording-wave-visualizer span:nth-child(2) { height: 10px; animation-delay: 0.3s; }
.ucd-recording-wave-visualizer span:nth-child(3) { height: 16px; animation-delay: 0.2s; }
.ucd-recording-wave-visualizer span:nth-child(4) { height: 7px; animation-delay: 0.4s; }
.ucd-recording-wave-visualizer span:nth-child(5) { height: 14px; animation-delay: 0.15s; }
.ucd-recording-wave-visualizer span:nth-child(6) { height: 18px; animation-delay: 0.35s; }
.ucd-recording-wave-visualizer span:nth-child(7) { height: 9px; animation-delay: 0.25s; }
.ucd-recording-wave-visualizer span:nth-child(8) { height: 12px; animation-delay: 0.05s; }

.ucd-recording-cancel-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: transparent;
	border: none;
	color: var(--color-text-muted, #64748b);
	font-size: 11.5px;
	font-weight: 600;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
	transition: all 0.15s ease;
}

.ucd-recording-cancel-btn:hover {
	color: #ef4444;
	background: rgba(239, 68, 68, 0.1);
}

/* Voice Message Bubble in Feed */
.ucd-chat-bubble.has-voice {
	padding: 6px 10px;
}

.ucd-chat-voice-bubble {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	user-select: none;
}

.ucd-voice-play-btn {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #ef4444;
	border: none;
	color: #ffffff !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: transform 0.15s ease, background 0.15s ease;
	box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
	padding: 0;
}

.ucd-voice-play-btn:hover {
	background: #dc2626;
	transform: scale(1.08);
}

.ucd-voice-play-icon {
	margin-left: 2px;
}

.ucd-voice-waveform-wrap {
	position: relative;
	width: 96px;
	height: 22px;
	display: flex;
	align-items: center;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 6px;
	padding: 0 5px;
	overflow: hidden;
}

.ucd-chat-msg-row.is-me .ucd-voice-waveform-wrap {
	background: rgba(255, 255, 255, 0.18);
}

.ucd-voice-progress {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 0%;
	background: rgba(239, 68, 68, 0.25);
	transition: width 0.1s linear;
	pointer-events: none;
}

.ucd-chat-msg-row.is-me .ucd-voice-progress {
	background: rgba(255, 255, 255, 0.35);
}

.ucd-voice-waves {
	display: flex;
	align-items: center;
	gap: 3px;
	width: 100%;
	height: 100%;
	justify-content: space-between;
}

.ucd-voice-waves span {
	width: 2.5px;
	border-radius: 2px;
	background: currentColor;
	opacity: 0.55;
	transition: height 0.2s ease;
}

.ucd-voice-waves span:nth-child(1) { height: 6px; }
.ucd-voice-waves span:nth-child(2) { height: 12px; }
.ucd-voice-waves span:nth-child(3) { height: 16px; }
.ucd-voice-waves span:nth-child(4) { height: 8px; }
.ucd-voice-waves span:nth-child(5) { height: 14px; }
.ucd-voice-waves span:nth-child(6) { height: 18px; }
.ucd-voice-waves span:nth-child(7) { height: 10px; }
.ucd-voice-waves span:nth-child(8) { height: 14px; }
.ucd-voice-waves span:nth-child(9) { height: 8px; }
.ucd-voice-waves span:nth-child(10) { height: 12px; }

.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span {
	animation: ucdWaveBounce 0.6s infinite ease-in-out alternate;
}

.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(1) { animation-delay: 0.1s; }
.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(2) { animation-delay: 0.25s; }
.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(3) { animation-delay: 0.15s; }
.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(4) { animation-delay: 0.3s; }
.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(5) { animation-delay: 0.05s; }
.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(6) { animation-delay: 0.2s; }
.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(7) { animation-delay: 0.35s; }
.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(8) { animation-delay: 0.1s; }
.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(9) { animation-delay: 0.4s; }
.ucd-chat-voice-bubble.is-playing .ucd-voice-waves span:nth-child(10) { animation-delay: 0.18s; }

@keyframes ucdWaveBounce {
	0% { height: 4px; }
	100% { height: 18px; }
}

.ucd-voice-duration-tag {
	font-size: 11px;
	font-weight: 700;
	opacity: 0.85;
	font-variant-numeric: tabular-nums;
}

.ucd-voice-expired-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	opacity: 0.7;
	font-style: italic;
}

/* Dark mode adjustments for voice bubble */
html[data-theme="dark"] .ucd-voice-waveform-wrap,
html.dark .ucd-voice-waveform-wrap {
	background: rgba(255, 255, 255, 0.08);
}

/* Guest prompt banner in chat */
.ucd-chat-guest-prompt {
	text-align: center;
	padding: 10px 14px;
	background: var(--color-bg, #f1f5f9);
	border-radius: 10px;
	font-size: 12px;
	color: var(--color-text-muted, #64748b);
}

.ucd-chat-guest-prompt button {
	background: none;
	border: none;
	color: #ef4444;
	font-weight: 700;
	cursor: pointer;
	text-decoration: underline;
	font-size: 12px;
	padding: 0;
	margin: 0;
}

.ucd-chat-guest-prompt button:hover {
	color: #dc2626;
}

/* --------------------------------------------------------------------------
   4. Auth Modal (Login / Sign Up)
   -------------------------------------------------------------------------- */
.ucd-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.65);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
	z-index: 100005 !important;
	animation: ucdFadeIn 0.2s ease forwards;
}

@keyframes ucdFadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

.ucd-modal-backdrop.is-active {
	display: flex;
}

.ucd-auth-card {
	width: 100%;
	max-width: 400px;
	background: var(--color-surface, #ffffff);
	border: 1px solid var(--color-border, #e2e8f0);
	border-radius: 20px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
	overflow: hidden;
	position: relative;
	font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	animation: ucdScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ucdScaleIn {
	from { opacity: 0; transform: scale(0.95); }
	to { opacity: 1; transform: scale(1); }
}

.ucd-auth-modal-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 32px;
	height: 32px;
	background: var(--color-bg, #f1f5f9);
	border: none;
	border-radius: 50%;
	color: var(--color-text-muted, #64748b);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
}

.ucd-auth-modal-close:hover {
	background: rgba(239, 68, 68, 0.1);
	color: #ef4444;
}

.ucd-auth-header {
	padding: 24px 24px 16px;
	text-align: center;
}

.ucd-auth-header-title {
	font-size: 20px;
	font-weight: 800;
	color: var(--color-heading, #0f172a);
	margin: 0 0 6px;
}

.ucd-auth-header-sub {
	font-size: 13px;
	color: var(--color-text-muted, #64748b);
	margin: 0;
}

/* Tabs */
.ucd-auth-tabs {
	display: flex;
	margin: 0 24px 20px;
	background: var(--color-bg, #f1f5f9);
	padding: 4px;
	border-radius: 10px;
}

.ucd-auth-tab-btn {
	flex: 1;
	padding: 8px;
	border: none;
	background: transparent;
	color: var(--color-text-muted, #64748b);
	font-size: 13px;
	font-weight: 600;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
	outline: none;
}

.ucd-auth-tab-btn.is-active {
	background: var(--color-surface, #ffffff);
	color: var(--color-heading, #0f172a);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.ucd-auth-body {
	padding: 0 24px 24px;
}

.ucd-auth-form-group {
	margin-bottom: 16px;
}

.ucd-auth-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--color-heading, #0f172a);
	margin-bottom: 6px;
}

.ucd-auth-input {
	width: 100%;
	padding: 11px 14px;
	background: var(--color-bg, #f8fafc);
	border: 1px solid var(--color-border, #cbd5e1);
	border-radius: 10px;
	font-size: 14px;
	color: var(--color-text, #1e293b);
	outline: none;
	transition: all 0.2s ease;
	box-sizing: border-box;
	font-family: inherit;
}

.ucd-auth-input:focus {
	border-color: #ef4444;
	background: var(--color-surface, #ffffff);
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.ucd-auth-submit-btn {
	width: 100%;
	padding: 12px;
	background: #ef4444;
	color: #ffffff;
	border: none;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-top: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.ucd-auth-submit-btn:hover {
	background: #dc2626;
	box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.ucd-auth-submit-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.ucd-auth-error {
	padding: 10px 14px;
	background: rgba(239, 68, 68, 0.1);
	border: 1px solid rgba(239, 68, 68, 0.2);
	border-radius: 8px;
	color: #dc2626;
	font-size: 12px;
	line-height: 1.4;
	margin-bottom: 16px;
	display: none;
}

/* Username Availability Live Badge */
.ucd-input-with-badge {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
}

.ucd-input-with-badge .ucd-auth-input {
	padding-right: 90px;
}

.ucd-handle-badge {
	position: absolute;
	right: 10px;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 8px;
	border-radius: 99px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.2px;
	pointer-events: none;
	transition: all 0.2s ease;
}

.ucd-handle-badge.is-available {
	background: rgba(16, 185, 129, 0.12);
	color: #059669;
	border: 1px solid rgba(16, 185, 129, 0.3);
}

.ucd-handle-badge.is-taken {
	background: rgba(239, 68, 68, 0.12);
	color: #dc2626;
	border: 1px solid rgba(239, 68, 68, 0.3);
}

.ucd-handle-badge.is-checking {
	background: rgba(100, 116, 139, 0.12);
	color: #64748b;
	border: 1px solid rgba(100, 116, 139, 0.3);
}

.ucd-badge-spinner {
	width: 10px;
	height: 10px;
	border: 2px solid rgba(100, 116, 139, 0.4);
	border-top-color: #64748b;
	border-radius: 50%;
	animation: ucdBadgeSpin 0.7s linear infinite;
	display: inline-block;
}

@keyframes ucdBadgeSpin {
	to { transform: rotate(360deg); }
}

/* OTP Verification View */
.ucd-otp-info {
	text-align: center;
	margin-bottom: 16px;
}

.ucd-otp-desc {
	font-size: 13px;
	color: var(--color-text-muted, #64748b);
	margin: 0;
	line-height: 1.5;
}

.ucd-otp-desc strong {
	color: var(--color-heading, #0f172a);
	word-break: break-all;
}

.ucd-otp-digit-input {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
	font-size: 26px !important;
	font-weight: 800 !important;
	letter-spacing: 8px !important;
	text-align: center !important;
	padding: 12px 14px !important;
	color: #ef4444 !important;
	text-transform: uppercase;
}

.ucd-otp-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 16px;
	text-align: center;
}

.ucd-otp-link-btn {
	background: none;
	border: none;
	padding: 4px 8px;
	font-size: 12px;
	font-weight: 600;
	color: #ef4444;
	cursor: pointer;
	transition: all 0.15s ease;
	outline: none;
	text-decoration: none;
	font-family: inherit;
}

.ucd-otp-link-btn:hover:not(:disabled) {
	color: #dc2626;
	text-decoration: underline;
}

.ucd-otp-link-btn:disabled {
	color: var(--color-text-muted, #94a3b8);
	cursor: not-allowed;
	opacity: 0.7;
	text-decoration: none;
}

/* --------------------------------------------------------------------------
   5. Dark Mode Adjustments
   -------------------------------------------------------------------------- */
html[data-theme="dark"],
html.dark,
body.dark-mode {
	--color-surface: #0f172a;
	--color-bg: #1e293b;
	--color-border: #334155;
	--color-heading: #f8fafc;
	--color-text: #cbd5e1;
	--color-text-muted: #94a3b8;
}

html[data-theme="dark"] .ucd-chat-feed,
html.dark .ucd-chat-feed {
	background: #090d16;
}

html[data-theme="dark"] .ucd-chat-bubble,
html.dark .ucd-chat-bubble {
	background: #1e293b;
	border-color: #334155;
	color: #f1f5f9;
}

html[data-theme="dark"] .ucd-chat-msg-row.is-me .ucd-chat-bubble,
html.dark .ucd-chat-msg-row.is-me .ucd-chat-bubble {
	background: #ef4444;
	color: #ffffff;
	border-color: #ef4444;
}

html[data-theme="dark"] .ucd-chat-input,
html.dark .ucd-chat-input,
html[data-theme="dark"] .ucd-auth-input,
html.dark .ucd-auth-input {
	background: #0f172a;
	border-color: #334155;
	color: #f8fafc;
}

html[data-theme="dark"] .ucd-auth-tabs,
html.dark .ucd-auth-tabs,
html[data-theme="dark"] .ucd-chat-guest-prompt,
html.dark .ucd-chat-guest-prompt {
	background: #1e293b;
}

html[data-theme="dark"] .ucd-auth-modal-close,
html.dark .ucd-auth-modal-close {
	background: #1e293b;
}

/* --------------------------------------------------------------------------
   6. Mobile Responsiveness (< 768px)
   Harmonized Floating Docks: No vertical stacking, no horizontal collisions.
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
	/* Clean Baseline Dock: AI on Left, Report beside it, Chat on Right */
	/* AI Assistant on Bottom-Left */
	.ucd-assistant-wrap,
	.ucd-assistant-wrap.ucd-pos-bottom-left,
	.ucd-assistant-wrap.ucd-pos-bottom-right {
		bottom: 18px !important;
		left: 14px !important;
		right: auto !important;
	}

	body.has-cookie-banner .ucd-assistant-wrap,
	body.has-cookie-banner .ucd-assistant-wrap.ucd-pos-bottom-left,
	body.has-cookie-banner .ucd-assistant-wrap.ucd-pos-bottom-right {
		bottom: calc(18px + 70px) !important;
	}

	.ucd-assistant-fab {
		width: 50px !important;
		height: 50px !important;
	}

	.ucd-assistant-greeting-bubble {
		max-width: calc(100vw - 32px) !important;
		left: 0 !important;
		right: auto !important;
		bottom: calc(100% + 10px) !important;
	}

	/* Report Issue on mobile: sleek compact icon circle beside AI */
	#ucdReporterTrigger,
	.ucd-reporter-fab-trigger,
	.ucd-reporter-container .ucd-reporter-fab-trigger,
	body .ucd-reporter-fab-trigger {
		position: fixed !important;
		bottom: 24px !important;
		left: 74px !important;
		right: auto !important;
		height: 38px !important;
		width: 38px !important;
		min-width: 38px !important;
		max-width: 38px !important;
		padding: 0 !important;
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
		border-radius: 50% !important;
		box-sizing: border-box !important;
		z-index: 99980 !important;
		transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1), left 0.25s ease, opacity 0.2s ease, transform 0.2s ease !important;
	}

	body.has-cookie-banner #ucdReporterTrigger,
	body.has-cookie-banner .ucd-reporter-fab-trigger,
	body.has-cookie-banner .ucd-reporter-container .ucd-reporter-fab-trigger {
		bottom: calc(24px + 70px) !important;
	}

	#ucdReporterTrigger .ucd-rep-label,
	.ucd-reporter-fab-trigger .ucd-rep-label {
		display: none !important;
	}

	#ucdReporterTrigger .ucd-rep-icon,
	.ucd-reporter-fab-trigger .ucd-rep-icon {
		margin: 0 !important;
	}

	/* Community Chat FAB on Bottom-Right */
	.ucd-chat-widget-wrap {
		bottom: 18px !important;
		right: 14px !important;
		left: auto !important;
		z-index: 99990 !important;
	}

	body.has-cookie-banner .ucd-chat-widget-wrap {
		bottom: calc(18px + 70px) !important;
	}

	.ucd-chat-toggle-btn {
		width: 50px !important;
		height: 50px !important;
		padding: 0 !important;
		border-radius: 50% !important;
	}

	.ucd-chat-online-pulse {
		top: 9px !important;
		right: 9px !important;
	}

	.ucd-chat-toggle-btn span:not(.ucd-chat-online-pulse):not(.ucd-chat-unread-badge) {
		display: none !important;
	}
	.ucd-chat-toggle-btn span:not(.ucd-chat-online-pulse):not(.ucd-chat-unread-badge)::after {
		content: "" !important;
		display: none !important;
	}

	/* What's New pill: Hide on mobile */
	.ucd-wn-floating-pill,
	#ucd-wn-trigger {
		display: none !important;
	}

	.ucd-chat-panel {
		position: fixed !important;
		bottom: 0 !important;
		right: 0 !important;
		left: 0 !important;
		width: 100% !important;
		height: 75vh !important;
		max-height: 85vh !important;
		border-radius: 20px 20px 0 0 !important;
		border-bottom: none !important;
		border-left: none !important;
		border-right: none !important;
		z-index: 999999 !important;
	}

	.mobile-only-actions .ucd-header-login-btn {
		padding: 5px 10px;
		font-size: 12px;
		gap: 4px;
	}

	.mobile-only-actions .ucd-header-profile-btn {
		padding: 4px 8px 4px 4px;
		font-size: 12px;
	}

	.mobile-only-actions .ucd-header-avatar {
		width: 22px;
		height: 22px;
		font-size: 10px;
	}

	.ucd-header-handle {
		max-width: 70px;
	}

	.ucd-auth-card {
		border-radius: 18px;
		max-width: 92%;
	}
}
