/**
 * Braff Law - Spanish Language Suggestion Popup
 * Styles
 */

:root {
	--bl-brand-navy: #10204a;
	--bl-brand-blue: #3764d8;
	--bl-brand-blue-dark: #244fc2;
	--bl-brand-light-blue: #eef4ff;
	--bl-text-main: #101828;
	--bl-text-muted: #475467;
	--bl-border-soft: #d8e2ff;
	--bl-white: #ffffff;
	--bl-overlay: rgba(9, 18, 44, 0.62);
	--bl-radius-lg: 24px;
	--bl-radius-md: 14px;
	--bl-shadow-modal: 0 28px 80px rgba(16, 32, 74, 0.32);
}

.language-modal,
.language-modal * {
	box-sizing: border-box;
}

.language-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--bl-text-main);
}

.language-modal.is-visible {
	display: flex;
}

.language-modal__overlay {
	position: absolute;
	inset: 0;
	background: var(--bl-overlay);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	animation: bl-fadeIn 180ms ease-out;
}

.language-modal__card {
	position: relative;
	width: min(100%, 540px);
	background:
		radial-gradient(circle at top center, rgba(55, 100, 216, 0.14), transparent 34%),
		linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
	border: 1px solid var(--bl-border-soft);
	border-radius: var(--bl-radius-lg);
	box-shadow: var(--bl-shadow-modal);
	padding: 42px 40px 30px;
	text-align: center;
	overflow: hidden;
	animation: bl-modalIn 220ms ease-out;
}

.language-modal__card::before {
	content: "";
	position: absolute;
	top: 56px;
	left: -50px;
	width: 240px;
	height: 80px;
	border-top: 2px solid rgba(55, 100, 216, 0.12);
	border-radius: 50%;
	transform: rotate(8deg);
}

.language-modal__card::after {
	content: "";
	position: absolute;
	top: 42px;
	right: -40px;
	width: 220px;
	height: 80px;
	border-top: 2px solid rgba(55, 100, 216, 0.1);
	border-radius: 50%;
	transform: rotate(-10deg);
}

.language-modal .language-modal__close,
.language-modal .language-modal__close:hover,
.language-modal .language-modal__close:focus,
.language-modal .language-modal__close:active {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 36px !important;
	height: 36px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none;
	padding: 0 !important;
	margin: 0;
	border: 0 !important;
	border-radius: 50% !important;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 26px;
	font-weight: 400;
	line-height: 1 !important;
	text-align: center;
	cursor: pointer;
	z-index: 2;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	box-shadow: none !important;
	text-shadow: none;
	text-decoration: none !important;
	transition: background 160ms ease, transform 160ms ease;
}

.language-modal .language-modal__close {
	background: transparent !important;
}

.language-modal .language-modal__close:hover,
.language-modal .language-modal__close:focus {
	background: rgba(55, 100, 216, 0.08) !important;
	transform: scale(1.04);
}

.language-modal .language-modal__close > span,
.language-modal .language-modal__close:hover > span,
.language-modal .language-modal__close:focus > span,
.language-modal .language-modal__close:active > span {
	display: block;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 26px;
	font-weight: 400;
	line-height: 1;
	color: var(--bl-brand-navy) !important;
	background: transparent !important;
	margin-top: -2px;
	pointer-events: none;
}

.language-modal__icon-wrap {
	position: relative;
	z-index: 1;
	width: 88px;
	height: 88px;
	margin: 0 auto 22px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.language-modal__icon-bg {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, #ffffff, #eef4ff);
	border-radius: 50%;
	box-shadow: 0 14px 34px rgba(55, 100, 216, 0.18);
}

.language-modal__icon {
	position: relative;
	width: 56px;
	height: 56px;
	color: var(--bl-brand-blue);
}

.language-modal__badge {
	position: absolute;
	right: 4px;
	bottom: 11px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--bl-brand-blue);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 21px;
	font-weight: 800;
	box-shadow: 0 8px 18px rgba(55, 100, 216, 0.32);
	border: 3px solid white;
}

.language-modal__sparkle {
	position: absolute;
	width: 8px;
	height: 8px;
	color: var(--bl-brand-blue);
	opacity: 0.85;
}

.language-modal__sparkle--one {
	top: 22px;
	left: -14px;
}

.language-modal__sparkle--two {
	top: 6px;
	right: -14px;
	transform: scale(0.8);
}

.language-modal__sparkle--three {
	top: 39px;
	right: -34px;
	transform: scale(0.65);
	opacity: 0.55;
}

.language-modal__title {
	position: relative;
	z-index: 1;
	margin: 0 0 16px;
	color: var(--bl-brand-navy);
	font-size: clamp(28px, 5vw, 34px);
	line-height: 1.08;
	letter-spacing: -0.03em;
	font-weight: 850;
}

.language-modal__text {
	position: relative;
	z-index: 1;
	margin: 0 auto 28px;
	max-width: 430px;
	color: #24304f;
	font-size: 17px;
	line-height: 1.5;
}

.language-modal__actions {
	position: relative;
	z-index: 1;
	display: grid;
	gap: 12px;
}

.language-modal .language-modal__button {
	width: 100%;
	min-height: 58px;
	border-radius: var(--bl-radius-md);
	font-size: 18px;
	font-weight: 800;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
	font-family: inherit;
}

.language-modal .language-modal__button:focus-visible,
.language-modal .language-modal__close:focus-visible,
.language-modal .language-modal__checkbox input:focus-visible {
	outline: 3px solid rgba(55, 100, 216, 0.35);
	outline-offset: 3px;
}

.language-modal a.language-modal__button--primary,
.language-modal a.language-modal__button--primary:link,
.language-modal a.language-modal__button--primary:visited,
.language-modal a.language-modal__button--primary:hover,
.language-modal a.language-modal__button--primary:focus,
.language-modal a.language-modal__button--primary:active {
	border: 1px solid var(--bl-brand-blue);
	background: linear-gradient(180deg, var(--bl-brand-blue) 0%, var(--bl-brand-blue-dark) 100%);
	box-shadow: 0 14px 28px rgba(55, 100, 216, 0.28);
	text-decoration: none;
}

.language-modal a.language-modal__button--primary:hover {
	transform: translateY(-1px);
	box-shadow: 0 18px 34px rgba(55, 100, 216, 0.36);
}

.language-modal a.language-modal__button--primary .language-modal__button-label,
.language-modal a.language-modal__button--primary:hover .language-modal__button-label,
.language-modal a.language-modal__button--primary:focus .language-modal__button-label,
.language-modal a.language-modal__button--primary:active .language-modal__button-label {
	color: #ffffff !important;
}

.language-modal button.language-modal__button--secondary,
.language-modal button.language-modal__button--secondary:hover,
.language-modal button.language-modal__button--secondary:focus,
.language-modal button.language-modal__button--secondary:active {
	border: 1.5px solid var(--bl-brand-blue);
	background: rgba(255, 255, 255, 0.86);
	text-decoration: none;
}

.language-modal button.language-modal__button--secondary:hover {
	background: var(--bl-brand-light-blue);
	transform: translateY(-1px);
}

.language-modal button.language-modal__button--secondary .language-modal__button-label,
.language-modal button.language-modal__button--secondary:hover .language-modal__button-label,
.language-modal button.language-modal__button--secondary:focus .language-modal__button-label,
.language-modal button.language-modal__button--secondary:active .language-modal__button-label {
	color: var(--bl-brand-blue-dark) !important;
}

.language-modal .language-modal__button-label {
	display: inline-block;
	line-height: 1;
	pointer-events: none;
}

.language-modal__footer {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 14px;
	margin-top: 24px;
	color: #3c4865;
	font-size: 15px;
}

.language-modal__footer::before,
.language-modal__footer::after {
	content: "";
	height: 1px;
	background: #dde5f8;
	flex: 1;
}

.language-modal__checkbox {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	white-space: nowrap;
	cursor: pointer;
}

.language-modal__checkbox input {
	width: 19px;
	height: 19px;
	accent-color: var(--bl-brand-blue);
	cursor: pointer;
}

.language-modal__community {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 18px -40px -30px;
	padding: 14px 24px;
	background: #f4f6fb;
	border-top: 1px solid #e3e8f3;
	border-radius: 0 0 var(--bl-radius-lg) var(--bl-radius-lg);
	font-size: 14px;
	color: #3c4865;
}

.language-modal__pin {
	width: 18px;
	height: 18px;
	color: var(--bl-brand-navy);
	flex-shrink: 0;
}

.language-modal__community-text {
	line-height: 1.3;
}

.language-modal__flag {
	display: inline-block;
	width: 28px;
	height: 19px;
	border-radius: 2px;
	box-shadow: 0 1px 2px rgba(16, 32, 74, 0.15);
	flex-shrink: 0;
	object-fit: cover;
	vertical-align: middle;
}

@media (max-width: 560px) {
	.language-modal {
		padding: 16px;
		/* Use safe-area at the top for notched phones.
		   Reserve extra space at the bottom for floating chat/CTA bars
		   so the modal visually centers within the viewable area
		   above the bar instead of sitting flush against it. */
		padding-top: max(16px, env(safe-area-inset-top));
		padding-bottom: calc(80px + env(safe-area-inset-bottom));
	}

	.language-modal__card {
		width: 100%;
		padding: 32px 20px 20px;
		border-radius: 22px;
		/* Cap height accounting for top+bottom padding so the card never
		   grows past what fits, and lets it scroll internally if needed. */
		max-height: calc(100vh - 112px);
		max-height: calc(100svh - 112px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
	}

	.language-modal__icon-wrap {
		width: 72px;
		height: 72px;
		margin-bottom: 16px;
	}

	.language-modal__icon {
		width: 46px;
		height: 46px;
	}

	.language-modal__badge {
		width: 28px;
		height: 28px;
		font-size: 18px;
		bottom: 8px;
		right: 2px;
	}

	.language-modal__title {
		font-size: 24px;
		margin-bottom: 12px;
	}

	.language-modal__text {
		font-size: 15px;
		margin-bottom: 20px;
	}

	.language-modal__button,
	html body .language-modal .language-modal__button {
		min-height: 50px !important;
		font-size: 16px !important;
	}

	.language-modal__footer {
		margin-top: 18px;
		font-size: 14px;
	}

	.language-modal__community {
		margin: 16px -20px -20px;
		padding: 12px 16px;
		font-size: 12.5px;
		gap: 8px;
		border-radius: 0 0 22px 22px;
	}

	/* Decorative arcs are too wide for small cards — hide them */
	.language-modal__card::before,
	.language-modal__card::after {
		display: none;
	}

	.language-modal__sparkle--three {
		display: none;
	}
}

/* Tiny screens (older / smaller phones): even tighter */
@media (max-width: 360px) {
	.language-modal__card {
		padding: 28px 16px 16px;
	}

	.language-modal__community {
		margin: 14px -16px -16px;
	}

	.language-modal__title {
		font-size: 22px;
	}
}

/*
 * Suppress :hover styles on touch-only devices so the X button (and any
 * other hover state) doesn't get "stuck" after a tap on mobile.
 */
@media (hover: none) {
	.language-modal .language-modal__close:hover,
	.language-modal .language-modal__close:focus,
	html body .language-modal .language-modal__close:hover,
	html body .language-modal .language-modal__close:focus {
		background: transparent !important;
		background-color: transparent !important;
		transform: none !important;
	}

	.language-modal .language-modal__button--primary:hover,
	html body .language-modal .language-modal__button--primary:hover {
		transform: none !important;
	}

	.language-modal .language-modal__button--secondary:hover,
	html body .language-modal .language-modal__button--secondary:hover {
		background: rgba(255, 255, 255, 0.86) !important;
		background-color: rgba(255, 255, 255, 0.86) !important;
		transform: none !important;
	}
}

@keyframes bl-fadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes bl-modalIn {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.language-modal__overlay,
	.language-modal__card {
		animation: none;
	}
}
