/* ================================================================
   FLOATING DOCK — compact nav + unified AI hub
   ================================================================ */

.dock {
	position: fixed;
	left: 50%;
	bottom: max(1rem, env(safe-area-inset-bottom, 0px));
	z-index: 90;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.65rem;
	width: max-content;
	max-width: min(92vw, 420px);
	pointer-events: none;
	--dock-h: 2.75rem;
	--dock-icon: 1.05rem;
}

.dock > * {
	pointer-events: auto;
}

body.header-nav-open .dock,
body.voice-assistant-open .dock {
	opacity: 0;
	visibility: hidden;
	transform: translateX(-50%) translateY(12px);
	transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
}

/* ================= Compact bar ================= */

.dock__bar {
	position: relative;
	border: 1px solid var(--color-border-glass);
	border-radius: var(--radius-pill);
	background: rgba(14, 15, 18, 0.94);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.06),
		0 14px 36px -16px rgba(0, 0, 0, 0.85);
}

.dock.is-active .dock__bar,
.dock:has([data-voice-toggle][aria-expanded="true"]) .dock__bar {
	border-color: rgba(214, 255, 47, 0.22);
}

.dock__bar-inner {
	display: flex;
	align-items: center;
	gap: 0.15rem;
	padding: 0.3rem 0.35rem;
	min-height: calc(var(--dock-h) + 0.2rem);
}

.dock__group {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.1rem;
}

.dock__divider {
	flex: 0 0 1px;
	width: 1px;
	height: 1.35rem;
	margin: 0 0.15rem;
	background: rgba(255, 255, 255, 0.1);
}

/* Nav items — icon-first, compact */
.dock__item {
	position: relative;
	z-index: 1;
	display: inline-grid;
	place-items: center;
	min-width: var(--dock-h);
	width: var(--dock-h);
	height: var(--dock-h);
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: var(--color-text-secondary);
	background: transparent;
	transition: color 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.dock__item-icon {
	width: var(--dock-icon);
	height: var(--dock-icon);
	opacity: 0.75;
	transition: opacity 0.25s ease, color 0.25s ease;
}

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

.dock__item:hover {
	color: var(--color-white);
	background: rgba(255, 255, 255, 0.04);
}

.dock__item:hover .dock__item-icon {
	opacity: 1;
}

.dock__item.is-active {
	color: var(--color-accent);
}

.dock__item.is-active .dock__item-icon {
	opacity: 1;
	color: var(--color-accent);
}

.dock__item[hidden] {
	display: none !important;
}

/* Top — icon only, no label */
.dock__item--top {
	min-width: var(--dock-h);
	padding: 0;
	border-radius: 50%;
}

.dock__item--top .dock__item-label {
	display: none;
}

.dock__item--top.is-visible {
	animation: dock-top-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dock-top-in {
	from { opacity: 0; transform: scale(0.85); }
	to { opacity: 1; transform: scale(1); }
}

/* ================= Unified AI hub ================= */

.dock__ai-hub {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0;
	padding: 0.15rem;
	border-radius: var(--radius-pill);
	background: rgba(214, 255, 47, 0.08);
	border: 1px solid rgba(214, 255, 47, 0.22);
}

.dock__ai-hub-sep {
	width: 1px;
	height: 1.1rem;
	background: rgba(214, 255, 47, 0.25);
	flex-shrink: 0;
}

.dock__ai-btn {
	position: relative;
	z-index: 1;
	display: grid;
	place-items: center;
	width: calc(var(--dock-h) - 0.2rem);
	height: calc(var(--dock-h) - 0.2rem);
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: var(--color-accent);
	background: transparent;
	transition: color 0.25s ease, background-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.dock__ai-btn-icon {
	width: calc(var(--dock-icon) + 0.05rem);
	height: calc(var(--dock-icon) + 0.05rem);
}

.dock__ai-btn:hover {
	background: rgba(214, 255, 47, 0.14);
	transform: scale(1.06);
}

.dock__ai-btn:active {
	transform: scale(0.94);
}

.dock__ai-btn--chat[aria-expanded="true"],
.dock.is-active .dock__ai-btn--chat {
	background: var(--color-accent);
	color: var(--color-bg-primary);
	box-shadow: 0 0 16px rgba(214, 255, 47, 0.4);
}

.dock__ai-btn--voice[aria-expanded="true"] {
	background: var(--color-accent);
	color: var(--color-bg-primary);
	box-shadow: 0 0 16px rgba(214, 255, 47, 0.4);
}

/* Single AI button (only chat OR only voice) */
.dock__ai-hub:has(.dock__ai-btn:only-of-type) {
	padding: 0.12rem;
}

.dock__ai-hub:has(.dock__ai-btn:only-of-type) .dock__ai-btn {
	background: rgba(214, 255, 47, 0.12);
}

.dock__ai-hub:has(.dock__ai-btn:only-of-type) .dock__ai-btn:hover {
	background: rgba(214, 255, 47, 0.22);
}

@keyframes dock-status-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.45; }
}

/* ================= AI panel (unchanged core) ================= */

.dock__panel {
	position: relative;
	width: min(92vw, 380px);
	max-height: min(68vh, 520px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 1.35rem;
	background: rgba(14, 15, 18, 0.92);
	backdrop-filter: blur(28px) saturate(1.4);
	-webkit-backdrop-filter: blur(28px) saturate(1.4);
	box-shadow: 0 28px 60px -22px rgba(0, 0, 0, 0.85);
	transform-origin: bottom center;
	opacity: 0;
	visibility: hidden;
	transform: translateY(14px) scale(0.97);
	transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.35s ease;
}

.dock__panel--open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.dock__panel-glow {
	position: absolute;
	top: -40%;
	left: 50%;
	width: 70%;
	height: 60%;
	transform: translateX(-50%);
	background: radial-gradient(circle, rgba(214, 255, 47, 0.14), transparent 70%);
	filter: blur(30px);
	pointer-events: none;
}

.dock__panel-head {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.8rem 0.9rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.dock__panel-avatar {
	display: grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: linear-gradient(135deg, rgba(214, 255, 47, 0.18), rgba(214, 255, 47, 0.04));
	border: 1px solid rgba(214, 255, 47, 0.28);
	flex-shrink: 0;
}

.dock__panel-avatar-core {
	width: 0.8rem;
	height: 0.8rem;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #fff, var(--color-accent) 60%);
	box-shadow: 0 0 10px rgba(214, 255, 47, 0.55);
}

.dock__panel-id {
	display: flex;
	flex-direction: column;
	gap: 0.05rem;
	margin-inline-end: auto;
	min-width: 0;
}

.dock__panel-name {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--color-white);
}

.dock__panel-status {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	font-size: 0.65rem;
	color: var(--color-text-muted);
}

.dock__panel-status-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--color-accent);
	box-shadow: 0 0 6px var(--color-accent);
	animation: dock-status-pulse 2s ease-in-out infinite;
}

.dock__panel-status.is-typing .dock__panel-status-dot {
	background: #ffc24d;
	box-shadow: 0 0 6px #ffc24d;
}

.dock__panel-action,
.dock__panel-close {
	display: grid;
	place-items: center;
	width: 1.85rem;
	height: 1.85rem;
	border-radius: 50%;
	color: var(--color-text-secondary);
	transition: color 0.25s ease, background-color 0.25s ease;
	flex-shrink: 0;
}

.dock__panel-action:hover,
.dock__panel-close:hover {
	color: var(--color-white);
	background: rgba(255, 255, 255, 0.06);
}

.dock__panel-action-icon {
	width: 0.95rem;
	height: 0.95rem;
}

.dock__panel-close {
	position: relative;
}

.dock__panel-close-bar {
	position: absolute;
	width: 12px;
	height: 1.5px;
	background: currentColor;
	border-radius: 2px;
}

.dock__panel-close-bar:first-child { transform: rotate(45deg); }
.dock__panel-close-bar:last-child { transform: rotate(-45deg); }

.dock__messages {
	flex: 1;
	min-height: 7rem;
	overflow-y: auto;
	padding: 0.85rem;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.dock__msg {
	display: flex;
	max-width: 88%;
	animation: dock-msg-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.dock__msg--bot { align-self: flex-start; }
.dock__msg--user { align-self: flex-end; }

.dock__bubble {
	padding: 0.6rem 0.8rem;
	border-radius: 0.95rem;
	font-size: 0.82rem;
	line-height: 1.5;
	white-space: pre-wrap;
	word-break: break-word;
}

.dock__msg--bot .dock__bubble {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.06);
	color: var(--color-text-secondary);
	border-bottom-left-radius: 0.3rem;
}

.dock__msg--user .dock__bubble {
	background: linear-gradient(135deg, rgba(214, 255, 47, 0.92), rgba(196, 242, 30, 0.85));
	color: var(--color-bg-primary);
	font-weight: 500;
	border-bottom-right-radius: 0.3rem;
}

.dock__msg--error .dock__bubble {
	background: rgba(255, 77, 77, 0.1);
	border: 1px solid rgba(255, 77, 77, 0.28);
	color: #ff9b9b;
}

.dock__typing {
	display: inline-flex;
	gap: 0.2rem;
	padding: 0.6rem 0.8rem;
}

.dock__typing span {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--color-text-muted);
	animation: dock-typing 1.2s ease-in-out infinite;
}

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

@keyframes dock-typing {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.dock__prompts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	padding: 0 0.85rem 0.45rem;
}

.dock__prompt {
	padding: 0.35rem 0.65rem;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: var(--radius-pill);
	background: rgba(255, 255, 255, 0.02);
	color: var(--color-text-secondary);
	font-size: 0.68rem;
	line-height: 1.2;
	transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.dock__prompt:hover {
	color: var(--color-accent);
	border-color: rgba(214, 255, 47, 0.3);
	background: rgba(214, 255, 47, 0.05);
}

.dock__prompts.is-hidden {
	display: none;
}

.dock__form {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.65rem;
	border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.dock__input {
	flex: 1;
	min-width: 0;
	height: 2.35rem;
	padding: 0 0.8rem;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: var(--radius-pill);
	background: rgba(255, 255, 255, 0.03);
	color: var(--color-white);
	font-size: 0.82rem;
}

.dock__input::placeholder {
	color: var(--color-text-muted);
}

.dock__input:focus {
	outline: none;
	border-color: rgba(214, 255, 47, 0.35);
}

.dock__mic,
.dock__send {
	display: grid;
	place-items: center;
	width: 2.35rem;
	height: 2.35rem;
	border-radius: 50%;
	flex-shrink: 0;
	transition: transform 0.25s ease, background-color 0.25s ease;
}

.dock__mic {
	color: var(--color-text-secondary);
	background: rgba(255, 255, 255, 0.04);
}

.dock__mic.is-recording {
	color: #ff4d4d;
	background: rgba(255, 77, 77, 0.12);
}

.dock__mic-icon,
.dock__send-icon {
	width: 1rem;
	height: 1rem;
}

.dock__send {
	color: var(--color-bg-primary);
	background: var(--color-accent);
}

.dock__send:hover {
	transform: scale(1.06);
}

.dock__send:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	transform: none;
}

/* ================= Responsive ================= */

@media (min-width: 480px) {
	.dock {
		--dock-h: 2.85rem;
		--dock-icon: 1.1rem;
		max-width: min(92vw, 440px);
	}
}

@media (max-width: 380px) {
	.dock {
		--dock-h: 2.55rem;
		--dock-icon: 0.98rem;
		width: calc(100vw - 1.25rem);
		max-width: calc(100vw - 1.25rem);
	}

	.dock__bar-inner {
		justify-content: center;
		width: 100%;
	}
}

@media (max-width: 767px) {
	.dock__panel {
		width: calc(100vw - 1rem);
	}
}

@media (hover: none) and (pointer: coarse) {
	.dock__item:active,
	.dock__ai-btn:active {
		transform: scale(0.92);
	}
}

@media (prefers-reduced-motion: reduce) {
	.dock__item,
	.dock__ai-btn,
	.dock__panel,
	.dock__msg {
		transition: none;
		animation: none;
	}

	.dock__panel-status-dot,
	.dock__typing span {
		animation: none;
	}
}
