/* =========================================================
   VEIC 2027 — SITE-WIDE FLOATING QUICK-ACTIONS RAIL
   File: assets/css/quick-rail.css
   -----------------------------------------------------------
   Ported from the CMC Endocrinology child theme's floating
   ".endo-qa-item" quick-actions rail (assets/css/quickactions.css)
   and re-namespaced to this theme's "veic-qr-*" classes /
   colour variables so it can't collide with the existing
   homepage "Quick Action Cards" strip (.veic-qa-item, used by
   the [veic_quickactions] shortcode in PART E of functions.php
   — a different, non-floating element).

   Behaviour is unchanged from the source theme:
   - Desktop/tablet/landscape phone: fixed vertical rail,
     vertically centered on the right edge of the visible
     viewport.
   - Phones in PORTRAIT only: fixed bottom bar, items in a row.
   - Auto-hide after 6s of inactivity (see quick-rail.js).
   ========================================================= */

:root {
	/* Reuses the shared --veic-* palette declared in header.css
	   rather than introducing new colour variables. */
	--veic-qr-center-top: 50%;
}

html,
body {
	max-width: 100%;
	overflow-x: hidden;
}

.veic-quickrail * { box-sizing: border-box; }

/* ---- Desktop / tablet / landscape phone: fixed vertical rail,
   sticky and vertically centered on the right edge of the visible
   viewport. Default for every orientation/size; only narrow
   PORTRAIT phones override it below with a bottom bar. ---- */
.veic-quickrail {
	position: fixed;
	top: var(--veic-qr-center-top, 50%);
	/* Always hug the true right edge of the viewport, regardless of
	   the page's content container width — previously this was
	   calculated against an assumed 1400px container, which pushed
	   the rail inward and over narrower page content. */
	right: 16px;
	left: auto;
	bottom: auto;
	max-width: calc(100vw - 32px);
	transform: translateY(-50%);
	z-index: 950;
	display: flex;
	flex-direction: column;
	background: var(--veic-white, #FFFFFF);
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(10, 46, 115, 0.18);
	overflow: visible;
	/* Auto-hide on inactivity — see quick-rail.js. Variable-driven
	   transform so the hidden state slides the same direction the
	   panel is docked to, whichever edge that is at the current
	   breakpoint. */
	--veic-qr-hide-x: 130%;
	--veic-qr-hide-y: 0%;
	transition: transform .3s ease, opacity .3s ease, visibility .3s ease;
}
.veic-quickrail.veic-qr-hidden {
	transform: translateY(-50%) translate(var(--veic-qr-hide-x), var(--veic-qr-hide-y));
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
	.veic-quickrail { transition: opacity .15s ease, visibility .15s ease; }
}

/* ---- Closed state: user dismissed the rail via the close button.
   Fully removed (not just slid away) and stays gone for 10 minutes
   — see quick-rail.js. Takes priority over the inactivity auto-hide
   state. ---- */
.veic-quickrail.veic-qr-closed {
	display: none !important;
}

/* ---- Close ("X") button, pinned to the top of the rail. ---- */
.veic-qr-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 6px 0;
	border: none;
	border-bottom: 1px solid #EEF1F6;
	background: var(--veic-bg, #F5F8FD);
	color: var(--veic-primary, #0A2E73);
	cursor: pointer;
	line-height: 1;
}
.veic-qr-close:hover {
	background: #EEF1F6;
}
.veic-qr-close .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.veic-qr-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	width: 78px;
	padding: 14px 6px;
	text-decoration: none;
	color: var(--veic-primary, #0A2E73);
	border-bottom: 1px solid #EEF1F6;
	transition: background .15s ease;
}
.veic-qr-item:last-child { border-bottom: 0; }

.veic-qr-item:hover {
	background: var(--veic-bg, #F5F8FD);
}

.veic-qr-item .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
	color: var(--veic-secondary, #1E88E5);
}

.veic-qr-item.veic-qr-abstract .dashicons,
.veic-qr-item.veic-qr-quiz .dashicons {
	color: var(--veic-accent, #00C8FF);
}

.veic-qr-item.veic-qr-enquire .dashicons {
	color: var(--veic-secondary, #1E88E5);
}

.veic-qr-label {
	font-size: 10.5px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
}

/* ===========================================================
   RESPONSIVE
   =========================================================== */

/* ---- Tablets: shrink the rail a little. ---- */
@media (max-width: 991px) {
	.veic-qr-item {
		width: 66px;
		padding: 11px 4px;
	}
	.veic-qr-label { font-size: 9.5px; }
	.veic-qr-item .dashicons {
		font-size: 18px;
		width: 18px;
		height: 18px;
	}
}

/* ---- Phones in PORTRAIT only: convert to a fixed bottom bar. ---- */
@media (max-width: 640px) and (orientation: portrait) {
	.veic-quickrail {
		top: auto;
		bottom: 0;
		right: 0;
		left: 0;
		max-width: 100%;
		transform: none;
		flex-direction: row;
		border-radius: 0;
		box-shadow: 0 -4px 16px rgba(10, 46, 115, 0.18);
		padding-bottom: env(safe-area-inset-bottom, 0);
		--veic-qr-hide-x: 0%;
		--veic-qr-hide-y: 130%;
	}
	.veic-quickrail.veic-qr-hidden {
		transform: translate(var(--veic-qr-hide-x), var(--veic-qr-hide-y));
	}
	.veic-qr-item {
		flex: 1 1 0;
		width: auto;
		padding: 10px 4px;
		border-bottom: 0;
		border-right: 1px solid #EEF1F6;
	}
	.veic-qr-item:last-child { border-right: 0; }

	/* Close button becomes a slim column at the end of the bottom
	   bar instead of a full-width header row. */
	.veic-qr-close {
		width: 32px;
		flex: 0 0 32px;
		height: auto;
		padding: 0;
		border-bottom: 0;
		border-left: 1px solid #EEF1F6;
	}

	body {
		padding-bottom: 64px;
	}
}

/* ---- Phones in LANDSCAPE with limited height: keep the vertical
   rail, just shrink it. ---- */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
	.veic-qr-item {
		width: 56px;
		padding: 8px 4px;
	}
	.veic-qr-label { font-size: 8.5px; }
	.veic-qr-item .dashicons {
		font-size: 16px;
		width: 16px;
		height: 16px;
	}
}
