/* Exhibit Central (rsgdx) plugin — custom-storefront-chat.css
   Storefront chat widget. Same positioning/structure as the wiki's own
   chat widget (floating pill bottom-right, slide-up panel), ported to
   our color variables. Renders via wp_footer, outside #exhibitrsgdx-main,
   so every selector is prefixed with an ID anchor for the same specificity
   reasons as the popups and footer — this is a completely separate DOM
   subtree from the homepage content. */

#exhibitrsgdx-chat-floating-bar {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 999998;
}

#exhibitrsgdx-chat-floating-bar .exhibitrsgdx-chat-pill {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--exhibitrsgdx-color-primary);
	border: none;
	border-radius: 999px;
	padding: 14px 20px;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
	transition: background 0.15s ease;
	font-family: var(--exhibitrsgdx-font-sans, sans-serif);
}

#exhibitrsgdx-chat-floating-bar .exhibitrsgdx-chat-pill:hover {
	background: var(--exhibitrsgdx-color-primary-hover, #d9550f);
}

#exhibitrsgdx-chat-panel {
	position: fixed;
	bottom: 90px;
	right: 24px;
	width: 420px;
	max-height: calc(100vh - 120px);
	height: calc(100vh - 120px);
	background: #1a1a1a;
	border: 1px solid #2e2e2e;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
	display: flex;
	flex-direction: column;
	z-index: 999999;
	overflow: hidden;
}

/* Critical: the rule above sets display:flex via an ID selector, which
   has higher specificity than the browser's default [hidden] { display:
   none; } UA rule — meaning without this override, the hidden attribute
   was silently doing nothing and the panel showed on every page load.
   Same class of bug already documented elsewhere in this project. */
#exhibitrsgdx-chat-panel[hidden] {
	display: none;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	border-bottom: 1px solid #2e2e2e;
	flex: 0 0 auto;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__header-info {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #f5f5f5;
	font-weight: 700;
	font-size: 14px;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__header-info i {
	color: var(--exhibitrsgdx-color-primary);
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__close {
	background: none;
	border: none;
	color: #a8a8a8;
	cursor: pointer;
	font-size: 16px;
	padding: 4px;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__close:hover {
	color: #f5f5f5;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.5;
	color: #f5f5f5;
	overflow-wrap: break-word;
	word-break: break-word;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-msg p {
	margin: 0 0 8px;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-msg p:last-child {
	margin-bottom: 0;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-msg--assistant {
	align-self: flex-start;
	background: #242424;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-msg--user {
	align-self: flex-end;
	background: var(--exhibitrsgdx-color-primary);
	color: #fff;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-msg--typing {
	display: flex;
	gap: 4px;
	align-items: center;
	padding: 14px;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-typing-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #a8a8a8;
	animation: exhibitrsgdx-chat-typing-bounce 1.2s infinite ease-in-out;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }

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

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-link {
	color: var(--exhibitrsgdx-color-primary);
	text-decoration: underline;
	overflow-wrap: break-word;
	word-break: break-word;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-code {
	background: #2e2e2e;
	padding: 2px 5px;
	border-radius: 3px;
	font-size: 12px;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-list {
	margin: 0 0 8px;
	padding-left: 20px;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-hr {
	border: none;
	border-top: 1px solid #2e2e2e;
	margin: 8px 0;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-table-wrap {
	overflow-x: auto;
	margin: 8px 0;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-table {
	border-collapse: collapse;
	font-size: 12px;
	width: 100%;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-table th,
#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-table td {
	border: 1px solid #2e2e2e;
	padding: 6px 8px;
	text-align: left;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__sources {
	flex: 0 0 auto;
	padding: 10px 18px;
	border-top: 1px solid #2e2e2e;
	max-height: 120px;
	overflow-y: auto;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__sources-label {
	display: flex;
	align-items: center;
	gap: 6px;
	color: #a8a8a8;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin: 0 0 6px;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-source-link {
	display: block;
	color: var(--exhibitrsgdx-color-primary);
	font-size: 13px;
	text-decoration: none;
	padding: 4px 0;
	overflow-wrap: break-word;
	word-break: break-word;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-source-link:hover {
	text-decoration: underline;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__input-wrap {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 14px 18px;
	border-top: 1px solid #2e2e2e;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__input {
	flex: 1 1 auto;
	background: #242424;
	border: 1px solid #2e2e2e;
	border-radius: 8px;
	color: #f5f5f5;
	padding: 10px 12px;
	font-size: 13px;
	font-family: var(--exhibitrsgdx-font-sans, sans-serif);
	resize: none;
	max-height: 120px;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__input:focus {
	outline: none;
	border-color: var(--exhibitrsgdx-color-primary);
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__send {
	background: var(--exhibitrsgdx-color-primary);
	border: none;
	border-radius: 8px;
	width: 38px;
	height: 38px;
	padding: 0;
	line-height: 1;
	color: #fff;
	cursor: pointer;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__send:disabled {
	opacity: 0.6;
	cursor: default;
}

#exhibitrsgdx-chat-panel .exhibitrsgdx-chat-panel__footer {
	flex: 0 0 auto;
	padding: 8px 18px 12px;
	font-size: 11px;
	color: #6e6e6e;
	text-align: center;
}

@media (max-width: 480px) {
	#exhibitrsgdx-chat-floating-bar {
		bottom: 16px;
		right: 16px;
	}
	#exhibitrsgdx-chat-floating-bar .exhibitrsgdx-chat-pill span {
		display: none;
	}
	#exhibitrsgdx-chat-panel {
		width: calc(100vw - 32px);
		right: 16px;
		bottom: 80px;
		height: calc(100vh - 100px);
		max-height: calc(100vh - 100px);
	}
}
