/**
 * Consent Banner Styles
 *
 * Self-contained CSS with mts-cb- prefix to avoid conflicts.
 * Supports 4 positions and 4 themes.
 *
 * @package MindTheSignal\PixelManager
 * @since 1.3.0
 */

/* ==========================================================================
   CSS Custom Properties (Themes)
   ========================================================================== */

/* Light Theme (default) */
.mts-cb--light {
	--mts-cb-bg: #ffffff;
	--mts-cb-text: #1a1a2e;
	--mts-cb-text-secondary: #555566;
	--mts-cb-border: #e0e0e8;
	--mts-cb-primary: #2563eb;
	--mts-cb-primary-hover: #1d4ed8;
	--mts-cb-primary-text: #ffffff;
	--mts-cb-secondary-bg: #f3f4f6;
	--mts-cb-secondary-hover: #e5e7eb;
	--mts-cb-overlay: rgba(0, 0, 0, 0.5);
	--mts-cb-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
	--mts-cb-radius: 12px;
	--mts-cb-backdrop: none;
}

/* Dark Theme */
.mts-cb--dark {
	--mts-cb-bg: #1a1a2e;
	--mts-cb-text: #f0f0f5;
	--mts-cb-text-secondary: #a0a0b5;
	--mts-cb-border: #2d2d44;
	--mts-cb-primary: #3b82f6;
	--mts-cb-primary-hover: #60a5fa;
	--mts-cb-primary-text: #ffffff;
	--mts-cb-secondary-bg: #2d2d44;
	--mts-cb-secondary-hover: #3d3d5a;
	--mts-cb-overlay: rgba(0, 0, 0, 0.7);
	--mts-cb-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
	--mts-cb-radius: 12px;
	--mts-cb-backdrop: none;
}

/* Minimal Theme */
.mts-cb--minimal {
	--mts-cb-bg: rgba(255, 255, 255, 0.92);
	--mts-cb-text: #1a1a2e;
	--mts-cb-text-secondary: #555566;
	--mts-cb-border: rgba(0, 0, 0, 0.08);
	--mts-cb-primary: #1a1a2e;
	--mts-cb-primary-hover: #333350;
	--mts-cb-primary-text: #ffffff;
	--mts-cb-secondary-bg: rgba(0, 0, 0, 0.04);
	--mts-cb-secondary-hover: rgba(0, 0, 0, 0.08);
	--mts-cb-overlay: rgba(0, 0, 0, 0.3);
	--mts-cb-shadow: 0 -2px 16px rgba(0, 0, 0, 0.06);
	--mts-cb-radius: 16px;
	--mts-cb-backdrop: blur(12px);
}

/* Brand Theme */
.mts-cb--brand {
	--mts-cb-bg: #ffffff;
	--mts-cb-text: #1a1a2e;
	--mts-cb-text-secondary: #555566;
	--mts-cb-border: #e0e0e8;
	--mts-cb-primary: var(--mts-brand-color, #2563eb);
	--mts-cb-primary-hover: var(--mts-brand-color-hover, #1d4ed8);
	--mts-cb-primary-text: #ffffff;
	--mts-cb-secondary-bg: #f3f4f6;
	--mts-cb-secondary-hover: #e5e7eb;
	--mts-cb-overlay: rgba(0, 0, 0, 0.5);
	--mts-cb-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
	--mts-cb-radius: 12px;
	--mts-cb-backdrop: none;
}

/* ==========================================================================
   Base Banner Styles
   ========================================================================== */

.mts-cb {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--mts-cb-text);
	box-sizing: border-box;
}

.mts-cb[hidden] {
	display: none !important;
}

.mts-cb *,
.mts-cb *::before,
.mts-cb *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* ==========================================================================
   Bottom Bar Position
   ========================================================================== */

.mts-cb--bottom-bar {
	bottom: 0;
	left: 0;
	right: 0;
	animation: mts-slide-up 0.4s ease-out;
}

.mts-cb--bottom-bar .mts-cb__container {
	padding: 20px 24px;
	background: var(--mts-cb-bg);
	backdrop-filter: var(--mts-cb-backdrop);
	-webkit-backdrop-filter: var(--mts-cb-backdrop);
	box-shadow: var(--mts-cb-shadow);
	border-top: 1px solid var(--mts-cb-border);
}

.mts-cb--bottom-bar .mts-cb__inner {
	display: flex;
	align-items: center;
	gap: 24px;
	max-width: var(--mts-cb-max-width, 1140px);
	margin: 0 auto;
}

.mts-cb--bottom-bar .mts-cb__preferences {
	max-width: var(--mts-cb-max-width, 1140px);
	margin: 0 auto;
}

.mts-cb--bottom-bar .mts-cb__content {
	flex: 1;
}

.mts-cb--bottom-bar .mts-cb__actions {
	display: flex;
	gap: 10px;
	flex-shrink: 0;
}

/* ==========================================================================
   Top Bar Position
   ========================================================================== */

.mts-cb--top-bar {
	top: 0;
	left: 0;
	right: 0;
	animation: mts-slide-down 0.4s ease-out;
}

.mts-cb--top-bar .mts-cb__container {
	padding: 20px 24px;
	background: var(--mts-cb-bg);
	backdrop-filter: var(--mts-cb-backdrop);
	-webkit-backdrop-filter: var(--mts-cb-backdrop);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
	border-bottom: 1px solid var(--mts-cb-border);
}

.mts-cb--top-bar .mts-cb__inner {
	display: flex;
	align-items: center;
	gap: 24px;
	max-width: var(--mts-cb-max-width, 1140px);
	margin: 0 auto;
}

.mts-cb--top-bar .mts-cb__preferences {
	max-width: var(--mts-cb-max-width, 1140px);
	margin: 0 auto;
}

.mts-cb--top-bar .mts-cb__content {
	flex: 1;
}

.mts-cb--top-bar .mts-cb__actions {
	display: flex;
	gap: 10px;
	flex-shrink: 0;
}

/* ==========================================================================
   Center Modal Position
   ========================================================================== */

.mts-cb--center-modal {
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--mts-cb-overlay);
	animation: mts-fade-in 0.3s ease-out;
	padding: 20px;
}

.mts-cb--center-modal .mts-cb__container {
	max-width: 520px;
	width: 100%;
	padding: 32px;
	background: var(--mts-cb-bg);
	backdrop-filter: var(--mts-cb-backdrop);
	-webkit-backdrop-filter: var(--mts-cb-backdrop);
	border-radius: var(--mts-cb-radius);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
	animation: mts-scale-in 0.3s ease-out;
	max-height: 90vh;
	overflow-y: auto;
}

.mts-cb--center-modal .mts-cb__inner {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.mts-cb--center-modal .mts-cb__actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* ==========================================================================
   Floating Popup Position
   ========================================================================== */

.mts-cb--floating-popup {
	bottom: 20px;
	left: 20px;
	animation: mts-slide-up 0.4s ease-out;
}

.mts-cb--floating-popup .mts-cb__container {
	max-width: 400px;
	width: 100%;
	padding: 24px;
	background: var(--mts-cb-bg);
	backdrop-filter: var(--mts-cb-backdrop);
	-webkit-backdrop-filter: var(--mts-cb-backdrop);
	border-radius: var(--mts-cb-radius);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
	border: 1px solid var(--mts-cb-border);
}

.mts-cb--floating-popup .mts-cb__inner {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.mts-cb--floating-popup .mts-cb__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* ==========================================================================
   Content Styles
   ========================================================================== */

.mts-cb__title {
	font-size: 16px;
	font-weight: 700;
	color: var(--mts-cb-text);
	margin-bottom: 8px;
}

.mts-cb__text {
	font-size: 13px;
	color: var(--mts-cb-text-secondary);
	line-height: 1.6;
	margin-bottom: 6px;
}

.mts-cb__link {
	font-size: 13px;
	color: var(--mts-cb-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.mts-cb__link:hover {
	color: var(--mts-cb-primary-hover);
}

/* ==========================================================================
   Button Styles
   ========================================================================== */

.mts-cb__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 20px;
	font-size: 13px;
	font-weight: 600;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.1s ease;
	white-space: nowrap;
	font-family: inherit;
	line-height: 1.4;
}

.mts-cb__btn:active {
	transform: scale(0.97);
}

.mts-cb__btn--accept {
	background: var(--mts-cb-primary);
	color: var(--mts-cb-primary-text);
}

.mts-cb__btn--accept:hover {
	background: var(--mts-cb-primary-hover);
}

.mts-cb__btn--reject {
	background: var(--mts-cb-secondary-bg);
	color: var(--mts-cb-text);
}

.mts-cb__btn--reject:hover {
	background: var(--mts-cb-secondary-hover);
}

.mts-cb__btn--manage {
	background: transparent;
	color: var(--mts-cb-text-secondary);
	padding: 10px 12px;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.mts-cb__btn--manage:hover {
	color: var(--mts-cb-text);
}

.mts-cb__pref-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 12px;
}

.mts-cb__btn--save {
	background: var(--mts-cb-primary);
	color: var(--mts-cb-primary-text);
	padding: 8px 24px;
	font-size: 12px;
}

.mts-cb__btn--save:hover {
	background: var(--mts-cb-primary-hover);
}

.mts-cb__btn--cancel {
	background: var(--mts-cb-cancel-bg, #fee2e2);
	color: var(--mts-cb-cancel-text, #991b1b);
	padding: 8px 16px;
	font-size: 12px;
}

.mts-cb__btn--cancel:hover {
	background: var(--mts-cb-cancel-hover, #fecaca);
}

/* ==========================================================================
   Preferences Panel
   ========================================================================== */

.mts-cb__preferences {
	border-top: 1px solid var(--mts-cb-border);
	padding-top: 16px;
	margin-top: 16px;
	animation: mts-fade-in 0.2s ease-out;
}

.mts-cb__preferences[hidden] {
	display: none !important;
}

.mts-cb__category {
	padding: 12px 0;
	border-bottom: 1px solid var(--mts-cb-border);
}

.mts-cb__category:last-of-type {
	border-bottom: none;
}

.mts-cb__category-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.mts-cb__category-label {
	font-size: 14px;
	font-weight: 600;
	color: var(--mts-cb-text);
}

.mts-cb__category-desc {
	font-size: 12px;
	color: var(--mts-cb-text-secondary);
	margin-top: 4px;
	line-height: 1.5;
}

/* Toggle Switch — uses <div> with explicit JS handlers instead of <label>
   to avoid theme CSS breaking native label→input click forwarding. */
.mts-cb__toggle {
	position: relative;
	width: 44px;
	height: 24px;
	flex-shrink: 0;
	cursor: pointer;
	outline: none;
}

.mts-cb__toggle:focus-visible {
	outline: 2px solid var(--mts-cb-primary);
	outline-offset: 2px;
	border-radius: 24px;
}

.mts-cb__toggle input {
	display: inline !important;
	opacity: 0 !important;
	width: 0 !important;
	height: 0 !important;
	position: absolute !important;
	pointer-events: none !important;
}

.mts-cb__toggle-slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #c3c4c7;
	transition: background-color 0.2s ease;
	border-radius: 24px;
}

.mts-cb__toggle-slider::before {
	content: '';
	position: absolute;
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background-color: white;
	transition: transform 0.2s ease;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mts-cb__toggle input:checked + .mts-cb__toggle-slider {
	background-color: var(--mts-cb-primary);
}

.mts-cb__toggle input:checked + .mts-cb__toggle-slider::before {
	transform: translateX(20px);
}

.mts-cb__toggle[data-disabled="true"] {
	cursor: not-allowed;
}

.mts-cb__toggle[data-disabled="true"] .mts-cb__toggle-slider {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ==========================================================================
   Re-open Button
   ========================================================================== */

.mts-cb__reopen {
	position: fixed;
	bottom: 20px;
	left: 20px;
	z-index: 999998;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--mts-cb-bg, #ffffff);
	color: var(--mts-cb-text, #1a1a2e);
	border: 1px solid var(--mts-cb-border, #e0e0e8);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	animation: mts-fade-in 0.3s ease-out;
	padding: 0;
}

.mts-cb__reopen[hidden] {
	display: none !important;
}

.mts-cb__reopen:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.mts-cb__reopen svg {
	width: 22px;
	height: 22px;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes mts-slide-up {
	from {
		transform: translateY(100%);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

@keyframes mts-slide-down {
	from {
		transform: translateY(-100%);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

@keyframes mts-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes mts-scale-in {
	from {
		transform: scale(0.9);
		opacity: 0;
	}
	to {
		transform: scale(1);
		opacity: 1;
	}
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 768px) {
	/* Bottom/Top bars go vertical on mobile */
	.mts-cb--bottom-bar .mts-cb__inner,
	.mts-cb--top-bar .mts-cb__inner {
		flex-direction: column;
		align-items: stretch;
		gap: 16px;
	}

	.mts-cb--bottom-bar .mts-cb__actions,
	.mts-cb--top-bar .mts-cb__actions {
		flex-direction: column;
	}

	.mts-cb--bottom-bar .mts-cb__container,
	.mts-cb--top-bar .mts-cb__container {
		padding: 16px;
	}

	/* Floating popup goes full width */
	.mts-cb--floating-popup {
		left: 12px;
		right: 12px;
		bottom: 12px;
	}

	.mts-cb--floating-popup .mts-cb__container {
		max-width: none;
	}

	/* Center modal */
	.mts-cb--center-modal {
		padding: 12px;
	}

	.mts-cb--center-modal .mts-cb__container {
		padding: 24px;
	}

	/* Re-open button */
	.mts-cb__reopen {
		bottom: 12px;
		left: 12px;
		width: 44px;
		height: 44px;
	}

	.mts-cb__reopen svg {
		width: 20px;
		height: 20px;
	}
}
