/**
 * University of Bridgeport - Cookie Consent Stylesheet
 * Strict brand fidelity: Outfit typography, UB Purple #592D82, UB Blue #00A7E0, 0px border-radius.
 */

:root {
	--ub-cc-purple: #592D82;
	--ub-cc-purple-dark: #3F1D61;
	--ub-cc-purple-light: #F4EEF9;
	--ub-cc-blue: #00A7E0;
	--ub-cc-blue-dark: #007CA8;
	--ub-cc-charcoal: #1B1023;
	--ub-cc-gray-50: #F8FAFC;
	--ub-cc-gray-100: #F1F5F9;
	--ub-cc-gray-200: #E2E8F0;
	--ub-cc-gray-300: #CBD5E1;
	--ub-cc-gray-700: #334155;
	--ub-cc-gray-800: #1E293B;
	--ub-cc-font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Force 0px border-radius standard */
.ub-consent-banner,
.ub-consent-banner *,
.ub-consent-reopen,
.ub-consent-reopen * {
	border-radius: 0 !important;
	box-sizing: border-box;
}

/* Container */
.ub-consent-banner {
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100%;
	background: #ffffff;
	border-top: 3px solid var(--ub-cc-purple);
	box-shadow: 0 -4px 24px rgba(27, 16, 35, 0.12);
	font-family: var(--ub-cc-font);
	color: var(--ub-cc-gray-800);
	z-index: 999990;
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
	opacity: 1;
	transform: translateY(0);
}

.ub-consent-banner.ub-consent-hidden {
	display: none;
	opacity: 0;
	transform: translateY(100%);
	pointer-events: none;
}

/* Floating Card Layout Variation - Strictly anchored to BOTTOM-LEFT to eliminate widget collision */
.ub-consent-banner--floating,
.ub-consent-banner--bottom-left,
.ub-consent-banner--bottom-right {
	left: 24px !important;
	right: auto !important;
	bottom: 24px !important;
	width: calc(100% - 48px);
	max-width: 440px;
	border: 1px solid var(--ub-cc-gray-200);
	border-top: 3px solid var(--ub-cc-purple);
	box-shadow: 0 12px 36px rgba(27, 16, 35, 0.16);
}

/* Banner Inner */
.ub-consent-inner {
	max-width: 1320px;
	margin: 0 auto;
	padding: 18px 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}

.ub-consent-banner--floating .ub-consent-inner {
	flex-direction: column;
	align-items: stretch;
	padding: 20px;
	gap: 16px;
}

/* Main Text Section */
.ub-consent-main {
	flex: 1;
	min-width: 0;
}

.ub-consent-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
}

.ub-consent-brand {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ub-consent-icon {
	color: var(--ub-cc-purple);
	display: flex;
	align-items: center;
	line-height: 1;
}

.ub-consent-headline {
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--ub-cc-charcoal);
	margin: 0;
	letter-spacing: -0.01em;
	line-height: 1.2;
}

.ub-consent-close {
	background: none;
	border: none;
	color: var(--ub-cc-gray-700);
	font-size: 1.5rem;
	line-height: 1;
	padding: 0 4px;
	cursor: pointer;
	transition: color 0.15s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ub-consent-close:hover {
	color: var(--ub-cc-purple);
}

.ub-consent-body p {
	font-size: 0.88rem;
	color: var(--ub-cc-gray-700);
	line-height: 1.45;
	margin: 0;
}

.ub-consent-policy-link {
	color: var(--ub-cc-purple);
	text-decoration: underline;
	text-underline-offset: 3px;
	font-weight: 600;
	margin-left: 4px;
	white-space: nowrap;
	transition: color 0.15s ease;
}

.ub-consent-policy-link:hover {
	color: var(--ub-cc-blue);
}

/* Actions Section */
.ub-consent-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
	flex-wrap: wrap;
}

.ub-consent-banner--floating .ub-consent-actions {
	width: 100%;
	justify-content: flex-start;
}

/* Standard UB Button Tokens */
.ub-consent-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--ub-cc-font);
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 9px 18px;
	cursor: pointer;
	border: 1px solid transparent;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
	white-space: nowrap;
	line-height: 1.2;
}

.ub-btn-accept {
	background: var(--ub-cc-purple);
	color: #ffffff;
	border-color: var(--ub-cc-purple);
}

.ub-btn-accept:hover,
.ub-btn-accept:focus-visible {
	background: var(--ub-cc-purple-dark);
	border-color: var(--ub-cc-purple-dark);
}

.ub-btn-essential {
	background: #ffffff;
	color: var(--ub-cc-gray-800);
	border-color: var(--ub-cc-gray-300);
}

.ub-btn-essential:hover,
.ub-btn-essential:focus-visible {
	background: var(--ub-cc-gray-100);
	border-color: var(--ub-cc-gray-800);
}

.ub-btn-customize {
	background: transparent;
	color: var(--ub-cc-purple);
	border-color: transparent;
	text-decoration: underline;
	text-underline-offset: 3px;
	padding: 9px 10px;
}

.ub-btn-customize:hover,
.ub-btn-customize:focus-visible {
	color: var(--ub-cc-blue);
}

.ub-btn-save {
	background: var(--ub-cc-purple);
	color: #ffffff;
	border-color: var(--ub-cc-purple);
}

.ub-btn-save:hover,
.ub-btn-save:focus-visible {
	background: var(--ub-cc-purple-dark);
}

.ub-btn-cancel {
	background: #ffffff;
	color: var(--ub-cc-gray-700);
	border-color: var(--ub-cc-gray-300);
}

.ub-btn-cancel:hover,
.ub-btn-cancel:focus-visible {
	background: var(--ub-cc-gray-100);
}

/* Preferences Drawer */
.ub-consent-drawer {
	border-top: 1px solid var(--ub-cc-gray-200);
	background: var(--ub-cc-gray-50);
	overflow: hidden;
	transition: max-height 0.3s ease, opacity 0.25s ease;
	max-height: 520px;
	opacity: 1;
}

.ub-consent-banner--floating .ub-consent-drawer {
	max-height: 380px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.ub-consent-drawer.ub-consent-drawer-closed,
.ub-consent-banner--floating .ub-consent-drawer.ub-consent-drawer-closed {
	max-height: 0;
	opacity: 0;
	border-top: none;
	pointer-events: none;
}

.ub-consent-drawer-inner {
	max-width: 1320px;
	margin: 0 auto;
	padding: 20px 24px;
}

.ub-consent-drawer-title {
	font-size: 1.1rem;
	font-weight: 800;
	color: var(--ub-cc-charcoal);
	margin: 0 0 6px 0;
}

.ub-consent-drawer-intro {
	font-size: 0.86rem;
	color: var(--ub-cc-gray-700);
	line-height: 1.45;
	margin: 0 0 16px 0;
	max-width: 900px;
}

/* Categories List */
.ub-consent-categories {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 16px;
	margin-bottom: 20px;
}

.ub-consent-category {
	background: #ffffff;
	border: 1px solid var(--ub-cc-gray-300);
	padding: 14px 16px;
	border-left: 3px solid var(--ub-cc-purple);
}

.ub-consent-cat-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 6px;
}

.ub-consent-cat-title {
	font-size: 0.92rem;
	font-weight: 700;
	color: var(--ub-cc-charcoal);
	margin: 0;
}

.ub-consent-cat-desc {
	font-size: 0.8rem;
	color: var(--ub-cc-gray-700);
	line-height: 1.4;
	margin: 0;
}

.ub-consent-badge {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 3px 8px;
}

.ub-badge-locked {
	background: var(--ub-cc-gray-100);
	color: var(--ub-cc-gray-800);
	border: 1px solid var(--ub-cc-gray-300);
}

/* Sharp Rectangular Toggle Switch */
.ub-toggle-switch {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	flex-shrink: 0;
}

.ub-toggle-switch input {
	opacity: 0;
	width: 0;
	height: 0;
}

.ub-toggle-slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: var(--ub-cc-gray-300);
	transition: background-color 0.2s ease;
}

.ub-toggle-slider:before {
	position: absolute;
	content: "";
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background-color: white;
	transition: transform 0.2s ease;
}

.ub-toggle-switch input:checked + .ub-toggle-slider {
	background-color: var(--ub-cc-purple);
}

.ub-toggle-switch input:focus-visible + .ub-toggle-slider {
	outline: 2px solid var(--ub-cc-blue);
	outline-offset: 2px;
}

.ub-toggle-switch input:checked + .ub-toggle-slider:before {
	transform: translateX(20px);
}

/* Drawer Actions */
.ub-consent-drawer-actions {
	display: flex;
	gap: 12px;
	align-items: center;
}

/* Floating Reopen Badge - Hidden in favor of clean footer link */
.ub-consent-reopen,
#ub-consent-reopen {
	display: none !important;
}

.ub-consent-reopen:hover,
.ub-consent-reopen:focus-visible {
	background: var(--ub-cc-purple);
	color: #ffffff;
	border-color: var(--ub-cc-purple);
	transform: translateY(-2px);
}

.ub-consent-reopen.ub-consent-hidden {
	display: none;
}

/* Accessibility helper. :not(:focus) leaves a focused one to the theme, whose
   .skip-link.screen-reader-text:focus reveals the skip link; these !important
   declarations otherwise pin it to 1px when it is focused. */
.screen-reader-text:not(:focus) {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Responsive adjustments */
@media (max-width: 900px) {
	.ub-consent-inner {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
		padding: 16px;
	}

	.ub-consent-actions {
		width: 100%;
		justify-content: flex-start;
	}

	.ub-consent-btn {
		flex: 1 1 auto;
		text-align: center;
	}

	.ub-btn-customize {
		flex: 1 1 100%;
		text-align: center;
	}

	.ub-consent-reopen {
		bottom: 12px;
		left: 12px;
		padding: 6px 10px;
		font-size: 0.72rem;
	}
}

/* Mobile Viewport (< 768px): Lift above Native Mobile Navigation Dock to eliminate overlap */
@media (max-width: 768px) {
	.ub-consent-banner {
		left: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		width: 100% !important;
		max-width: 100% !important;
		border-left: none !important;
		border-right: none !important;
		box-shadow: 0 -4px 20px rgba(27, 16, 35, 0.12) !important;
	}

	body:has(.ub-mobile-dock) .ub-consent-banner {
		bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
	}

	.ub-consent-banner--floating,
	.ub-consent-banner--bottom-left,
	.ub-consent-banner--bottom-right {
		left: 16px !important;
		right: 16px !important;
		bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
		width: auto !important;
		max-width: none !important;
		border: 1px solid var(--ub-cc-gray-200) !important;
		border-top: 3px solid var(--ub-cc-purple) !important;
		box-shadow: 0 8px 30px rgba(27, 16, 35, 0.16) !important;
	}
}
