/**
 * Add to Calendar — front-end styles.
 *
 * Scoped under .gru-atc; theming via CSS custom properties so the host theme
 * (UiCore Pro) can't bleed in and we don't leak out. Mobile-first: the
 * dropdown becomes a polished bottom sheet on small screens.
 *
 * Ethically developed by GuruMedia (https://gurumedia.ro).
 */

.gru-atc {
	--gru-atc-accent: #4f46e5;
	--gru-atc-accent-2: color-mix(in srgb, var(--gru-atc-accent) 80%, #000 12%);
	--gru-atc-on-accent: #ffffff;
	--gru-atc-surface: #ffffff;
	--gru-atc-text: #11151c;
	--gru-atc-muted: #6b7280;
	--gru-atc-hairline: rgba(17, 21, 28, 0.08);
	--gru-atc-radius: 16px;
	--gru-atc-radius-sm: 12px;
	--gru-atc-shadow: 0 24px 50px -20px rgba(17, 21, 28, 0.30), 0 8px 18px -12px rgba(17, 21, 28, 0.22);
	--gru-atc-shadow-btn: 0 10px 22px -10px color-mix(in srgb, var(--gru-atc-accent) 65%, transparent), 0 2px 6px -2px rgba(17, 21, 28, 0.25);
	--gru-atc-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
	--gru-atc-ease: cubic-bezier(0.22, 1, 0.36, 1);

	position: relative;
	display: inline-block;
	font-family: inherit;
	line-height: 1.45;
	text-align: left;
	-webkit-font-smoothing: antialiased;
}

.gru-atc *,
.gru-atc *::before,
.gru-atc *::after {
	box-sizing: border-box;
}

/* Per-brand accent for the icon chips. */
.gru-atc__item[data-service="google"]  { --brand: #4285F4; }
.gru-atc__item[data-service="apple"]    { --brand: #1d1d1f; }
.gru-atc__item[data-service="android"]  { --brand: #3DDC84; }

/* ============================ Trigger ============================ */

/* Scoped + !important on the load-bearing properties so a host/builder theme
   that styles generic `button` can't flatten our trigger. Per-instance colors
   still flow in through the custom properties, so this doesn't block theming. */
.gru-atc .gru-atc__trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0;
	padding: 1.25rem 2.5rem;
	font-family: inherit;
	font-weight: 650;
	letter-spacing: 0.005em;
	line-height: 1;
	font-size: var(--gru-atc-btn-text-size, 0.95rem);
	color: var(--gru-atc-on-accent, #fff) !important;
	background: var(--gru-atc-accent) !important;
	border: 0 !important;
	border-radius: var(--gru-atc-btn-radius, var(--gru-atc-radius));
	box-shadow: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: transform 0.22s var(--gru-atc-spring), filter 0.2s ease, box-shadow 0.2s ease;
}

.gru-atc__trigger:hover {
	transform: translateY(-2px);
	/* Solid hover colours when set; fall back to the darker accent / base text. */
	color: var(--gru-atc-btn-text-hover, var(--gru-atc-on-accent, #fff)) !important;
	background: var(--gru-atc-btn-hover, var(--gru-atc-accent-2)) !important;
}

.gru-atc__trigger:active {
	transform: translateY(0) scale(0.98);
}

.gru-atc__trigger:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--gru-atc-accent) 42%, transparent);
	outline-offset: 3px;
}

.gru-atc__trigger-icon,
.gru-atc__chevron {
	display: inline-flex;
}

.gru-atc__trigger-icon {
	opacity: 0.95;
}

.gru-atc__chevron {
	margin-left: 0.05rem;
	opacity: 0.85;
	transition: transform 0.32s var(--gru-atc-spring);
}

.gru-atc.is-open .gru-atc__chevron {
	transform: rotate(180deg);
}

/* ============================ Menu (popover) ============================ */

.gru-atc__menu {
	position: absolute;
	top: calc(100% + 0.6rem);
	left: 0;
	z-index: 9999;
	min-width: 272px;
	padding: 0.45rem;
	background: var(--gru-atc-surface);
	background: color-mix(in srgb, var(--gru-atc-surface) 86%, transparent);
	-webkit-backdrop-filter: blur(14px) saturate(1.4);
	backdrop-filter: blur(14px) saturate(1.4);
	border: 1px solid var(--gru-atc-hairline);
	border-radius: var(--gru-atc-btn-radius, var(--gru-atc-radius));
	box-shadow: var(--gru-atc-shadow);
	opacity: 0;
	visibility: hidden;
	/* display:none while closed so the absolutely-positioned menu does not extend
	   the page (it sits below the trigger and would add white space under a footer
	   when the button is near the bottom). allow-discrete keeps the open/close fade. */
	display: none;
	transform: translateY(10px) scale(0.97);
	transform-origin: top left;
	transition: opacity 0.22s var(--gru-atc-ease), transform 0.28s var(--gru-atc-spring), visibility 0.28s, display 0.28s allow-discrete;
}

.gru-atc.is-open .gru-atc__menu {
	opacity: 1;
	visibility: visible;
	display: block;
	transform: translateY(0) scale(1);
}

@starting-style {
	.gru-atc.is-open .gru-atc__menu {
		opacity: 0;
		transform: translateY(10px) scale(0.97);
	}
}

/* Flip upward when there is no room below the trigger (set by JS as .is-up), so
   the menu opens above the button instead of stretching the page downward. */
.gru-atc.is-up .gru-atc__menu {
	top: auto;
	bottom: calc(100% + 0.6rem);
	transform: translateY(-10px) scale(0.97);
	transform-origin: bottom left;
}

.gru-atc.is-up.is-open .gru-atc__menu {
	transform: translateY(0) scale(1);
}

@starting-style {
	.gru-atc.is-up.is-open .gru-atc__menu {
		opacity: 0;
		transform: translateY(-10px) scale(0.97);
	}
}

.gru-atc__sheet-handle,
.gru-atc__sheet-head {
	display: none;
}

.gru-atc__list {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

/* ============================ Items ============================ */

/* Scoped (.gru-atc …) so our link colour beats a host theme that styles a
   generic `a` (e.g. `.elementor-kit-8 a`); !important guards against aggressive
   builder rules so the dropdown options stay the chosen colour. */
.gru-atc .gru-atc__item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.8rem;
	padding: 0.6rem 0.7rem;
	color: var(--gru-atc-link, var(--gru-atc-text)) !important;
	font-size: 0.94rem;
	font-weight: 550;
	text-decoration: none;
	border-radius: var(--gru-atc-radius-sm);
	transition: background 0.16s ease, transform 0.18s var(--gru-atc-ease);
}

.gru-atc .gru-atc__item:hover,
.gru-atc .gru-atc__item:focus-visible {
	background: var(--gru-atc-link-hover, color-mix(in srgb, var(--gru-atc-accent) 8%, transparent));
	color: var(--gru-atc-link, var(--gru-atc-text)) !important;
	outline: none;
}

.gru-atc__item:focus-visible {
	box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gru-atc-accent) 38%, transparent);
}

.gru-atc__chip {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	background: none;
	border: 0;
	box-shadow: none;
	transition: transform 0.2s var(--gru-atc-spring);
}

.gru-atc__item:hover .gru-atc__chip {
	transform: scale(1.08);
}

.gru-atc__chip svg {
	width: 24px;
	height: 24px;
	display: block;
}

.gru-atc__label {
	flex: 1 1 auto;
}

.gru-atc__go {
	display: inline-flex;
	flex: 0 0 auto;
	color: var(--gru-atc-muted);
	opacity: 0;
	transform: translateX(-6px);
	transition: opacity 0.18s ease, transform 0.22s var(--gru-atc-spring), color 0.18s ease;
}

.gru-atc__item:hover .gru-atc__go,
.gru-atc__item:focus-visible .gru-atc__go {
	opacity: 1;
	transform: translateX(0);
	color: var(--gru-atc-accent);
}

/* Staggered entrance. */
.gru-atc.is-open .gru-atc__item {
	animation: gru-atc-in 0.4s var(--gru-atc-spring) backwards;
}

.gru-atc.is-open .gru-atc__item:nth-child(1) { animation-delay: 0.03s; }
.gru-atc.is-open .gru-atc__item:nth-child(2) { animation-delay: 0.06s; }
.gru-atc.is-open .gru-atc__item:nth-child(3) { animation-delay: 0.09s; }
.gru-atc.is-open .gru-atc__item:nth-child(4) { animation-delay: 0.12s; }
.gru-atc.is-open .gru-atc__item:nth-child(5) { animation-delay: 0.15s; }
.gru-atc.is-open .gru-atc__item:nth-child(6) { animation-delay: 0.18s; }

@keyframes gru-atc-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

/* ============================ Editor / invalid notice ============================ */

.gru-atc-error {
	display: inline-block;
	padding: 0.55rem 0.8rem;
	color: #9a3412;
	background: #fff7ed;
	border: 1px dashed #fdba74;
	border-radius: 10px;
	font-size: 0.85rem;
}

/* ============================ Scrim ============================ */

.gru-atc-scrim {
	position: fixed;
	inset: 0;
	z-index: 9998;
	background: rgba(8, 11, 18, 0.5);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.gru-atc-scrim.is-visible {
	opacity: 1;
	visibility: visible;
}

/* ============================ Confirmation modal (.ics) ============================ */

.gru-atc-modal {
	/* Self-contained palette: the modal lives on <body>, outside .gru-atc, so it
	   can't inherit those custom properties. openModal() overrides accent /
	   on-accent per instance; these are the safe fallbacks. */
	--gru-atc-accent: #f7c61a;
	--gru-atc-on-accent: #0b2c5c;
	--gru-atc-surface: #ffffff;
	--gru-atc-text: #11151c;
	--gru-atc-muted: #6b7280;
	--gru-atc-hairline: rgba(17, 21, 28, 0.08);
	--gru-atc-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.28s ease, visibility 0.28s ease;
}

.gru-atc-modal.is-open {
	opacity: 1;
	visibility: visible;
}

.gru-atc-modal__scrim {
	position: absolute;
	inset: 0;
	background: rgba(8, 11, 18, 0.55);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}

.gru-atc-modal__card {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 32px 28px 28px;
	text-align: center;
	color: var(--gru-atc-text);
	background: var(--gru-atc-surface);
	border-radius: 22px;
	box-shadow: 0 30px 70px -25px rgba(8, 11, 18, 0.6);
	transform: translateY(14px) scale(0.97);
	transition: transform 0.32s var(--gru-atc-spring);
}

.gru-atc-modal.is-open .gru-atc-modal__card {
	transform: translateY(0) scale(1);
}

.gru-atc-modal .gru-atc-modal__close,
.gru-atc-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	color: var(--gru-atc-text) !important;
	background: color-mix(in srgb, var(--gru-atc-text) 8%, transparent) !important;
	border: 0 !important;
	border-radius: 50% !important;
	box-shadow: none !important;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.gru-atc-modal__close:hover {
	background: color-mix(in srgb, var(--gru-atc-text) 14%, transparent) !important;
}

.gru-atc-modal__glyph {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin: 0 auto 16px;
	color: var(--gru-atc-on-accent, #fff);
	background: var(--gru-atc-accent, #4f46e5);
	border-radius: 50%;
	box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--gru-atc-accent, #4f46e5) 70%, transparent);
}

.gru-atc-modal__title {
	margin: 0 0 6px;
	font-size: 1.35rem;
	font-weight: 750;
	letter-spacing: -0.01em;
	color: var(--gru-atc-text);
}

.gru-atc-modal__sub {
	margin: 0 0 22px;
	color: var(--gru-atc-muted);
	font-size: 0.95rem;
}

.gru-atc-modal__ev {
	margin: 0 0 24px;
	padding: 22px 20px;
	background: color-mix(in srgb, var(--gru-atc-text) 4%, transparent);
	border: 1px solid var(--gru-atc-hairline);
	border-radius: 16px;
}

.gru-atc-modal__ev-title {
	margin: 0 0 12px;
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--gru-atc-text);
}

.gru-atc-modal__row {
	color: var(--gru-atc-muted);
	font-size: 0.92rem;
}

/* Beat a host theme's paragraph margins (e.g. .elementor-kit-8 p { margin-block-end })
   so the modal lines stay tight together. */
.gru-atc-modal .gru-atc-modal__title { margin: 0 0 4px !important; }
.gru-atc-modal .gru-atc-modal__sub { margin: 0 0 18px !important; }
.gru-atc-modal .gru-atc-modal__ev-title { margin: 0 0 10px !important; }
.gru-atc-modal .gru-atc-modal__row { margin: 4px 0 0 !important; }

.gru-atc-modal .gru-atc-modal__add,
.gru-atc-modal__add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.95rem 1.2rem;
	font-size: 1rem;
	font-weight: 650;
	text-decoration: none;
	color: var(--gru-atc-on-accent, #fff) !important;
	background: var(--gru-atc-accent, #4f46e5) !important;
	border: 0 !important;
	border-radius: 12px;
	cursor: pointer;
	box-shadow: 0 12px 24px -12px color-mix(in srgb, var(--gru-atc-accent, #4f46e5) 70%, transparent);
	transition: filter 0.18s ease, transform 0.18s var(--gru-atc-spring);
}

.gru-atc-modal__add:hover {
	filter: brightness(1.05);
	transform: translateY(-1px);
}

/* Our modal glyphs are stroke-drawn; stop a host theme's `svg { fill/stroke }`
   from repainting or hiding them. */
.gru-atc-modal__glyph svg,
.gru-atc-modal__close svg,
.gru-atc-modal__add svg {
	fill: none !important;
	stroke: currentColor !important;
}

/* ============================ Mobile: bottom sheet ============================ */

@media (max-width: 767px) {
	.gru-atc.is-dropdown .gru-atc__menu {
		/* Keep the sheet rendered (fixed elements never extend the page, so there
		   is no white-space bug on mobile) to preserve the slide-up animation. */
		display: block;
		position: fixed;
		top: auto;
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		min-width: 0;
		max-height: 85vh;
		overflow-y: auto;
		padding: 0.5rem 0.9rem calc(1rem + env(safe-area-inset-bottom, 0px));
		background: var(--gru-atc-surface);
		border: 0;
		border-radius: 24px 24px 0 0;
		transform: translateY(100%);
		box-shadow: 0 -20px 50px -16px rgba(0, 0, 0, 0.45);
		transition: transform 0.42s var(--gru-atc-spring), opacity 0.25s ease, visibility 0.42s;
	}

	.gru-atc.is-dropdown.is-open .gru-atc__menu {
		transform: translateY(0);
	}

	.gru-atc__sheet-handle {
		display: block;
		width: 44px;
		height: 5px;
		margin: 0.35rem auto 0.4rem;
		background: var(--gru-atc-hairline);
		border-radius: 999px;
	}

	.gru-atc__sheet-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0.25rem 0.35rem 0.7rem;
		margin-bottom: 0.35rem;
		border-bottom: 1px solid var(--gru-atc-hairline);
	}

	.gru-atc__sheet-title {
		font-size: 1.05rem;
		font-weight: 700;
		color: var(--gru-atc-text);
	}

	/* Scoped + !important so an aggressive host/builder theme that styles
	   generic `button` at high specificity can't make the close icon vanish. */
	.gru-atc .gru-atc__sheet-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		margin: 0;
		padding: 0;
		color: #11151c !important;
		background: #eef0f4 !important;
		border: 0 !important;
		border-radius: 50% !important;
		box-shadow: none !important;
		cursor: pointer;
		-webkit-appearance: none;
		appearance: none;
		-webkit-tap-highlight-color: transparent;
	}

	.gru-atc .gru-atc__sheet-close svg {
		stroke: currentColor;
	}

	.gru-atc .gru-atc__sheet-close:hover {
		background: #e2e5ea !important;
		color: #11151c !important;
	}

	.gru-atc.is-dropdown .gru-atc__item {
		padding: 0.8rem 0.6rem;
		font-size: 1.02rem;
	}

	.gru-atc.is-dropdown .gru-atc__chip {
		width: 34px;
		height: 34px;
	}

	.gru-atc.is-dropdown .gru-atc__chip svg {
		width: 28px;
		height: 28px;
	}

	.gru-atc.is-dropdown .gru-atc__go {
		opacity: 1;
		transform: none;
		color: var(--gru-atc-muted);
	}
}

/* ============================ Reduced motion ============================ */

@media (prefers-reduced-motion: reduce) {
	.gru-atc *,
	.gru-atc__menu,
	.gru-atc__chevron,
	.gru-atc__chip,
	.gru-atc__go,
	.gru-atc-modal,
	.gru-atc-modal__card,
	.gru-atc-scrim {
		transition: none !important;
		animation: none !important;
	}
}
