/**
 * v2.25.0 — Floating bubble + calendar modal.
 * v2.25.3 — bubble shown on all viewports (no 1025px hide), wider modal on
 * tablet/desktop, lighter backdrop blur (2px) for smoother iOS Safari open.
 *
 * Bubble: fixed right-edge mid-height calendar button on all viewports.
 * Modal: overlay panel with chips + mini calendar + day events list.
 * Lessons applied: no geometry-changing hover effects per
 * feedback_has_selector_to_suppress_overlapping_hover_conflict.md.
 *
 * @package Tobalt_Renginiai
 * @author  Tobalt — https://tobalt.lt
 */

/* --------------------------------------------------------------------- */
/* Bubble — right edge vertically centered, all viewports (v2.25.3)      */
/* --------------------------------------------------------------------- */
.tr-bubble {
	position: fixed !important;
	right: 16px !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	z-index: 9990 !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	gap: 4px !important;
	font-family: var(--tr-font-family, 'Roboto', system-ui, sans-serif) !important;
}

/* v2.25.2: explicit display:flex on closed/default states so iOS Safari
 * can't de-render the fixed-position bubble after the body scroll-lock
 * toggle (known quirk). Only data-state="hidden" hides it (set only by
 * the now-removed × dismiss button). */
.tr-bubble[data-state="closed"],
.tr-bubble[data-state="open"],
.tr-bubble:not([data-state]) {
	display: flex !important;
}
.tr-bubble[data-state="hidden"] { display: none !important; }

/* v2.25.1: bubble color → lime/chartreuse per Tomas. Icon stays navy
 * for AA contrast (lime + navy = ~7:1, well above 4.5:1 threshold). */
.tr-bubble__btn,
.tr-bubble__btn:hover,
.tr-bubble__btn:focus,
.tr-bubble__btn:focus-visible,
.tr-bubble__btn:active {
	all: unset !important;
	box-sizing: border-box !important;
	width: 56px !important;
	height: 56px !important;
	border-radius: 50% !important;
	background: #a8d834 !important;
	color: var(--tr-color-primary, #001c46) !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	box-shadow: 0 6px 20px -6px rgba(168, 216, 52, 0.55), 0 2px 6px rgba(0, 0, 0, 0.10) !important;
	transition: none !important;
}
.tr-bubble__btn svg {
	color: inherit !important;
	/* v2.25.2: bigger icon — 30×30 fills the 56px lime button more visibly. */
	width: 30px !important;
	height: 30px !important;
	stroke-width: 2 !important;
}
.tr-bubble__btn:focus-visible {
	outline: 3px solid #a8d834 !important;
	outline-offset: 3px !important;
}
/* v2.25.1: bubble dismiss × hidden per Tomas. Markup retained in case the
 * admin re-enables `tr_bubble_dismissable` (PHP still emits the button), but
 * CSS hides it unconditionally. */
.tr-bubble__dismiss {
	display: none !important;
}

/* --------------------------------------------------------------------- */
/* Modal — backdrop + panel                                               */
/* --------------------------------------------------------------------- */
.tr-bubble-modal {
	position: fixed !important;
	inset: 0 !important;
	z-index: 9999 !important;
	font-family: var(--tr-font-family, 'Roboto', system-ui, sans-serif) !important;
}
.tr-bubble-modal[data-state="closed"] { display: none !important; }
.tr-bubble-modal[hidden]              { display: none !important; }

.tr-bubble-modal__backdrop {
	position: absolute !important;
	inset: 0 !important;
	/* v2.25.3: blur 4px → 2px. backdrop-filter is the dominant paint cost
	 * for modal open on iOS Safari; 2px keeps the depth cue without the
	 * heavy compositor work. Slightly darker base color compensates. */
	background: rgba(0, 28, 70, 0.62) !important;
	backdrop-filter: blur(2px) !important;
	-webkit-backdrop-filter: blur(2px) !important;
}

.tr-bubble-modal__panel {
	position: absolute !important;
	left: 50% !important;
	top: 50% !important;
	transform: translate(-50%, -50%) !important;
	width: 92vw !important;
	max-width: 480px !important;
	max-height: 88vh !important;
	background: #ffffff !important;
	border-radius: 12px !important;
	box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.30) !important;
	display: flex !important;
	flex-direction: column !important;
	overflow: hidden !important;
}
/* v2.25.3: wider panel on tablet/desktop. Mobile stays 92vw / 480px cap. */
@media (min-width: 768px) {
	.tr-bubble-modal__panel { max-width: 640px !important; }
}
@media (min-width: 1280px) {
	.tr-bubble-modal__panel { max-width: 760px !important; }
}

/* v2.25.4: tighten modal contents on tablet/desktop. The wider panel was
 * letting `aspect-ratio: 1/1` calendar cells bloat to ~85px squares + the
 * 16px body padding ate the wins. Cap calendar width, tighten body padding,
 * shrink day-cell aspect ratio so the whole calendar is more compact. */
@media (min-width: 768px) {
	.tr-bubble-modal__body { padding: 12px 18px 16px !important; }
	.tr-bubble-cal {
		max-width: 420px !important;
		margin-left: auto !important;
		margin-right: auto !important;
	}
	.tr-bubble-cal__day { aspect-ratio: 1.4 / 1 !important; }
	.tr-bubble-events__list { gap: 6px !important; }
	.tr-bubble-event { padding: 6px !important; }
	.tr-bubble-event__thumb { flex-basis: 48px !important; width: 48px !important; height: 60px !important; }
}

.tr-bubble-modal__header {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	padding: 14px 16px !important;
	border-bottom: 1px solid rgba(0, 28, 70, 0.08) !important;
}
.tr-bubble-modal__title {
	margin: 0 !important;
	font-size: 17px !important;
	font-weight: 700 !important;
	color: var(--tr-color-primary, #001c46) !important;
	letter-spacing: -0.01em !important;
}
.tr-bubble-modal__close,
.tr-bubble-modal__close:hover,
.tr-bubble-modal__close:focus,
.tr-bubble-modal__close:focus-visible,
.tr-bubble-modal__close:active {
	all: unset !important;
	width: 32px !important;
	height: 32px !important;
	border-radius: 50% !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	font-size: 22px !important;
	line-height: 1 !important;
	cursor: pointer !important;
	color: var(--tr-color-primary, #001c46) !important;
	background: transparent !important;
}
.tr-bubble-modal__close:hover { background: rgba(0, 28, 70, 0.05) !important; }

.tr-bubble-modal__body {
	flex: 1 1 auto !important;
	overflow-y: auto !important;
	padding: 14px 16px 18px !important;
	-webkit-overflow-scrolling: touch !important;
}

/* --------------------------------------------------------------------- */
/* Chip rows                                                              */
/* --------------------------------------------------------------------- */
.tr-bubble-chips {
	display: flex !important;
	gap: 8px !important;
	margin: 0 0 12px !important;
	padding: 0 !important;
	flex-wrap: nowrap !important;
	overflow-x: auto !important;
	-webkit-overflow-scrolling: touch !important;
	scrollbar-width: none !important;
}
.tr-bubble-chips::-webkit-scrollbar { display: none !important; }
.tr-bubble-chips--cats { margin-bottom: 16px !important; }

.tr-bubble-chip,
.tr-bubble-chip:hover,
.tr-bubble-chip:focus,
.tr-bubble-chip:focus-visible,
.tr-bubble-chip:active {
	all: unset !important;
	box-sizing: border-box !important;
	display: inline-flex !important;
	align-items: center !important;
	flex: 0 0 auto !important;
	padding: 6px 12px !important;
	background: transparent !important;
	border: 1px solid rgba(0, 28, 70, 0.15) !important;
	border-radius: 999px !important;
	color: var(--tr-color-primary, #001c46) !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	letter-spacing: 0.01em !important;
	line-height: 1.2 !important;
	cursor: pointer !important;
	white-space: nowrap !important;
}
.tr-bubble-chip[aria-pressed="true"],
.tr-bubble-chip--active {
	background: var(--tr-color-primary, #001c46) !important;
	border-color: var(--tr-color-primary, #001c46) !important;
	color: #ffffff !important;
}
.tr-bubble-chip:focus-visible {
	outline: 2px solid var(--tr-color-primary, #001c46) !important;
	outline-offset: 2px !important;
}

/* --------------------------------------------------------------------- */
/* Calendar — month nav + weekdays + grid                                 */
/* --------------------------------------------------------------------- */
.tr-bubble-cal {
	margin: 0 0 18px !important;
	padding: 0 !important;
}
.tr-bubble-cal__nav {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	margin-bottom: 8px !important;
}
.tr-bubble-cal__title {
	font-size: 14px !important;
	font-weight: 700 !important;
	color: var(--tr-color-primary, #001c46) !important;
	text-transform: capitalize !important;
}
.tr-bubble-cal__nav-btn,
.tr-bubble-cal__nav-btn:hover,
.tr-bubble-cal__nav-btn:focus,
.tr-bubble-cal__nav-btn:focus-visible,
.tr-bubble-cal__nav-btn:active {
	all: unset !important;
	width: 32px !important;
	height: 32px !important;
	border-radius: 6px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	font-size: 20px !important;
	line-height: 1 !important;
	cursor: pointer !important;
	color: var(--tr-color-primary, #001c46) !important;
	background: transparent !important;
}
.tr-bubble-cal__nav-btn:hover { background: rgba(0, 28, 70, 0.05) !important; }

.tr-bubble-cal__weekdays {
	display: grid !important;
	grid-template-columns: repeat(7, 1fr) !important;
	gap: 2px !important;
	margin-bottom: 6px !important;
}
.tr-bubble-cal__weekdays span {
	text-align: center !important;
	font-size: 10px !important;
	font-weight: 700 !important;
	letter-spacing: 0.05em !important;
	text-transform: uppercase !important;
	color: rgba(0, 28, 70, 0.50) !important;
	padding: 4px 0 !important;
}

.tr-bubble-cal__grid {
	display: grid !important;
	grid-template-columns: repeat(7, 1fr) !important;
	gap: 2px !important;
}
.tr-bubble-cal__day,
.tr-bubble-cal__day:hover,
.tr-bubble-cal__day:focus,
.tr-bubble-cal__day:focus-visible,
.tr-bubble-cal__day:active {
	all: unset !important;
	box-sizing: border-box !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: center !important;
	aspect-ratio: 1 / 1 !important;
	padding: 4px 0 !important;
	background: transparent !important;
	border-radius: 6px !important;
	color: var(--tr-color-primary, #001c46) !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	line-height: 1 !important;
	cursor: pointer !important;
	font-variant-numeric: tabular-nums !important;
	position: relative !important;
}
.tr-bubble-cal__day--out {
	color: rgba(0, 28, 70, 0.25) !important;
	cursor: default !important;
}
.tr-bubble-cal__day--today {
	color: var(--tr-color-primary, #001c46) !important;
	font-weight: 700 !important;
}
.tr-bubble-cal__day--today::after {
	content: '' !important;
	position: absolute !important;
	inset: 2px !important;
	border: 1.5px dashed rgba(0, 28, 70, 0.30) !important;
	border-radius: 6px !important;
	pointer-events: none !important;
}
.tr-bubble-cal__day--has-events::before {
	content: '' !important;
	position: absolute !important;
	bottom: 3px !important;
	left: 50% !important;
	transform: translateX(-50%) !important;
	width: 4px !important;
	height: 4px !important;
	border-radius: 50% !important;
	background: #a8d834 !important;
}
.tr-bubble-cal__day--selected {
	background: var(--tr-color-primary, #001c46) !important;
	color: #ffffff !important;
}
.tr-bubble-cal__day--selected::before {
	background: #ffffff !important;
}
.tr-bubble-cal__day:focus-visible {
	outline: 2px solid var(--tr-color-primary, #001c46) !important;
	outline-offset: 1px !important;
}

/* --------------------------------------------------------------------- */
/* Day events list                                                        */
/* --------------------------------------------------------------------- */
.tr-bubble-events__heading {
	margin: 0 0 8px !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	letter-spacing: 0.1em !important;
	text-transform: uppercase !important;
	color: rgba(0, 28, 70, 0.65) !important;
}
.tr-bubble-events__list {
	display: flex !important;
	flex-direction: column !important;
	gap: 8px !important;
}
.tr-bubble-events__empty {
	margin: 16px 0 !important;
	padding: 16px !important;
	text-align: center !important;
	color: rgba(0, 28, 70, 0.60) !important;
	font-size: 13px !important;
	background: rgba(0, 28, 70, 0.03) !important;
	border-radius: 8px !important;
}

.tr-bubble-event,
.tr-bubble-event:hover,
.tr-bubble-event:focus,
.tr-bubble-event:focus-visible {
	display: flex !important;
	gap: 12px !important;
	padding: 8px !important;
	background: #ffffff !important;
	border: 1px solid rgba(0, 28, 70, 0.08) !important;
	border-radius: 8px !important;
	text-decoration: none !important;
	color: var(--tr-color-primary, #001c46) !important;
	align-items: stretch !important;
}
.tr-bubble-event:hover,
.tr-bubble-event:focus-visible {
	border-color: var(--tr-color-primary, #001c46) !important;
	text-decoration: none !important;
}
.tr-bubble-event__thumb {
	flex: 0 0 56px !important;
	width: 56px !important;
	height: 72px !important;
	border-radius: 4px !important;
	overflow: hidden !important;
	background: rgba(0, 28, 70, 0.06) !important;
	display: block !important;
}
.tr-bubble-event__thumb img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block !important;
}
.tr-bubble-event__body {
	flex: 1 1 auto !important;
	display: flex !important;
	flex-direction: column !important;
	justify-content: center !important;
	gap: 2px !important;
	min-width: 0 !important;
}
.tr-bubble-event__cat {
	font-size: 9px !important;
	font-weight: 700 !important;
	letter-spacing: 0.15em !important;
	text-transform: uppercase !important;
	color: rgba(0, 28, 70, 0.55) !important;
}
.tr-bubble-event__title {
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.25 !important;
	color: var(--tr-color-primary, #001c46) !important;
	display: -webkit-box !important;
	-webkit-line-clamp: 2 !important;
	-webkit-box-orient: vertical !important;
	overflow: hidden !important;
}
.tr-bubble-event__meta {
	display: inline-flex !important;
	gap: 8px !important;
	font-size: 11px !important;
	font-weight: 600 !important;
	color: rgba(0, 28, 70, 0.65) !important;
	font-variant-numeric: tabular-nums !important;
}

/* Body scroll lock when modal open. */
body.tr-bubble-open { overflow: hidden !important; }
