/*
 * drmed.org assistant. Colours follow the site: #0693E3 is the theme blue,
 * but white text on it is only 3.3:1, so filled surfaces use #0870B4 (5.3:1).
 */
.dpom {
	--dpom-blue: #0870b4;
	--dpom-blue-hi: #0693e3;
	--dpom-ink: #2a2f41;
	--dpom-muted: #5a6070;
	--dpom-soft: #f2f8fd;
	--dpom-line: #dcebf7;
	--dpom-bar: 0px;
	position: fixed;
	right: 20px;
	/* Above the theme's back-to-top button (54px at 25px), or above the cookie bar. */
	bottom: max(92px, calc(var(--dpom-bar) + 14px));
	z-index: 10050;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: Roboto, Arial, sans-serif;
	pointer-events: none;
}

.dpom-trigger,
.dpom-panel {
	pointer-events: auto;
}

.dpom-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 20px 0 16px;
	border: 0;
	border-radius: 999px;
	background: var(--dpom-blue);
	color: #fff;
	font: 500 15px/1 Roboto, Arial, sans-serif;
	letter-spacing: 0.02em;
	cursor: pointer;
	box-shadow: 0 10px 28px -10px rgba(8, 112, 180, 0.7);
	transition: transform 0.18s ease, background-color 0.18s ease;
}

.dpom-trigger:hover {
	background: #075f99;
	transform: translateY(-2px);
}

.dpom-trigger:focus-visible,
.dpom-close:focus-visible,
.dpom-chip:focus-visible,
.dpom-form button:focus-visible,
.dpom-log:focus-visible,
.dpom-msg a:focus-visible,
.dpom-vec summary:focus-visible {
	outline: 3px solid #f5a623;
	outline-offset: 2px;
}

.dpom.is-open .dpom-trigger {
	display: none;
}

/* Open panel sits above the NCD Buttonizer bubble (z-index 99999). */
.dpom.is-open {
	z-index: 100001;
}

/* --------------------------------------------------------------- panel */

.dpom-panel {
	width: min(400px, calc(100vw - 32px));
	height: min(600px, calc(100dvh - 140px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
	color: var(--dpom-ink);
	border: 1px solid var(--dpom-line);
	border-top: 5px solid var(--dpom-blue-hi);
	border-radius: 20px;
	box-shadow: 0 24px 60px -18px rgba(42, 47, 65, 0.45);
	animation: dpom-in 0.2s ease-out;
}

.dpom-panel[hidden] {
	display: none;
}

@keyframes dpom-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}

.dpom-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 12px 12px 20px;
	border-bottom: 1px solid var(--dpom-line);
}

.dpom-head strong {
	display: block;
	font-size: 20px;
	font-weight: 400;
	color: var(--dpom-ink);
}

.dpom-sub {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	color: var(--dpom-muted);
}

.dpom-close {
	flex: none;
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border: 1px solid var(--dpom-line);
	border-radius: 50%;
	background: #fff;
	color: var(--dpom-ink);
	cursor: pointer;
}

.dpom-close:hover {
	border-color: var(--dpom-blue);
	color: var(--dpom-blue);
}

/* ----------------------------------------------------------- messages */

.dpom-log {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--dpom-soft);
}

.dpom-msg {
	max-width: 92%;
	padding: 11px 14px;
	border-radius: 16px 16px 16px 4px;
	background: #fff;
	border: 1px solid var(--dpom-line);
	font-size: 15px;
	line-height: 1.55;
	overflow-wrap: anywhere;
}

.dpom-msg--me {
	align-self: flex-end;
	background: var(--dpom-blue);
	border-color: transparent;
	color: #fff;
	border-radius: 16px 16px 4px 16px;
}

.dpom-msg p {
	margin: 0 0 8px;
	font-size: inherit;
	line-height: inherit;
	color: inherit;
}

.dpom-msg p:last-child {
	margin-bottom: 0;
}

.dpom-msg a {
	color: var(--dpom-blue);
	font-weight: 500;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.dpom-item {
	padding: 10px 0 0;
	margin-top: 10px;
	border-top: 1px solid var(--dpom-line);
}

.dpom-msg > .dpom-item:first-child,
.dpom-msg > p + .dpom-item {
	margin-top: 4px;
}

.dpom-t {
	font-weight: 500;
}

.dpom-meta {
	font-size: 14px;
	color: var(--dpom-muted);
}

.dpom-h {
	margin-top: 4px;
	font-size: 12px !important;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--dpom-muted) !important;
}

.dpom-pretekli {
	color: #8a4b00;
	font-weight: 500;
}

.dpom-cit {
	font-size: 14px;
	color: var(--dpom-ink);
	border-left: 3px solid var(--dpom-line);
	padding-left: 10px;
}

.dpom-oznaka {
	display: inline-block;
	padding: 1px 6px;
	border-radius: 6px;
	background: var(--dpom-soft);
	color: var(--dpom-muted);
	font-size: 11px;
	font-weight: 500;
	vertical-align: 2px;
}

.dpom-vec {
	margin-top: 10px;
}

.dpom-vec summary {
	cursor: pointer;
	color: var(--dpom-blue);
	font-weight: 500;
	font-size: 14px;
	padding: 6px 0;
}

/* -------------------------------------------------------------- chips */

.dpom-chips {
	flex: none;
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding: 10px 12px;
	border-top: 1px solid var(--dpom-line);
	scrollbar-width: thin;
}

.dpom-chip {
	flex: none;
	min-height: 40px;
	padding: 0 14px;
	border: 1.5px solid var(--dpom-line);
	border-radius: 999px;
	background: #fff;
	color: var(--dpom-ink);
	font: 500 14px/1 Roboto, Arial, sans-serif;
	white-space: nowrap;
	cursor: pointer;
}

.dpom-chip:hover {
	border-color: var(--dpom-blue);
	color: var(--dpom-blue);
}

/* --------------------------------------------------------------- form */

.dpom-form {
	flex: none;
	display: flex;
	gap: 8px;
	padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--dpom-line);
	margin: 0;
}

.dpom-form input {
	flex: 1;
	min-width: 0;
	height: 48px;
	margin: 0;
	padding: 0 16px;
	border: 1.5px solid #c9dced;
	border-radius: 999px;
	background: #fff;
	color: var(--dpom-ink);
	font: 16px Roboto, Arial, sans-serif;
	box-shadow: none;
}

.dpom-form input::placeholder {
	color: #6b7280;
}

.dpom-form input:focus {
	outline: none;
	border-color: var(--dpom-blue);
	box-shadow: 0 0 0 3px rgba(8, 112, 180, 0.18);
}

.dpom-form button {
	flex: none;
	width: 48px;
	height: 48px;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--dpom-blue);
	color: #fff;
	cursor: pointer;
}

.dpom-form button:hover {
	background: #075f99;
}

/*
 * The theme draws a "+" on every submit button with two pseudo-elements and
 * keeps 67px of right padding for it (.qodef-add-plus-to-buttons, !important
 * behind a chain of :not()), so only an ID selector wins.
 */
#dpom-panel .dpom-form button[type="submit"] {
	padding: 0 !important;
	min-width: 48px;
	max-width: 48px;
}

.dpom-form button::before,
.dpom-form button::after {
	content: none !important;
	display: none !important;
}

.dpom-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* -------------------------------------------------------------- phone */

@media (max-width: 760px) {
	.dpom {
		right: 14px;
		bottom: max(90px, calc(var(--dpom-bar) + 12px));
	}

	/* Round icon only, so it covers as little content as possible. */
	.dpom-trigger {
		width: 52px;
		height: 52px;
		padding: 0;
		justify-content: center;
	}

	.dpom-trigger-text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	.dpom.is-open {
		right: 0;
		left: 0;
		bottom: 0;
	}

	.dpom-panel {
		width: 100%;
		height: min(88dvh, 640px);
		border-radius: 20px 20px 0 0;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dpom-panel {
		animation: none;
	}

	.dpom-trigger {
		transition: none;
	}

	.dpom-trigger:hover {
		transform: none;
	}
}

@media print {
	.dpom {
		display: none !important;
	}
}
