/**
 * CookieLight Front-End Styles
 *
 * Lightweight banner styles with CSS-only animations and toggles.
 * Target: < 5 KB unminified.
 *
 * @package CookieLight
 */

/* === Banner === */
.cookielight-banner {
	--cl-bg: #ffffff;
	--cl-text: #1f2937;
	--cl-accent: #2563eb;
	--cl-accent-text: #ffffff;
	--cl-radius: 12px;
	--cl-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
	--cl-muted: #6b7280;
	--cl-border: #e5e7eb;

	position: fixed;
	z-index: 999999;
	display: none;
	box-sizing: border-box;
	width: 420px;
	max-width: calc(100vw - 32px);
	padding: 24px;
	margin: 16px;
	background: var(--cl-bg);
	color: var(--cl-text);
	border-radius: var(--cl-radius);
	box-shadow: var(--cl-shadow);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.cookielight-banner *,
.cookielight-banner *::before,
.cookielight-banner *::after {
	box-sizing: border-box;
}

/* Visible state */
.cookielight-banner--visible {
	display: block;
}

.cookielight-banner--active {
	opacity: 1;
	transform: translateY(0);
}

/* Position variants */
.cookielight-banner--bottom-left {
	bottom: 0;
	left: 0;
}

.cookielight-banner--bottom-right {
	bottom: 0;
	right: 0;
}

.cookielight-banner--bottom-bar {
	bottom: 0;
	left: 0;
	right: 0;
	width: 100%;
	max-width: 100%;
	margin: 0;
	border-radius: 0;
	padding: 20px 32px;
}

.cookielight-banner--center-modal {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0.95);
	opacity: 0;
	margin: 0;
}

.cookielight-banner--center-modal.cookielight-banner--active {
	transform: translate(-50%, -50%) scale(1);
	opacity: 1;
}

/* Overlay for center-modal */
.cookielight-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999998;
	background: rgba(0, 0, 0, 0.3);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.cookielight-overlay--visible {
	display: block;
}

.cookielight-overlay--active {
	opacity: 1;
}

/* === Content === */
.cookielight-banner__title {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 8px;
	color: var(--cl-text);
}

.cookielight-banner__desc {
	margin: 0 0 18px;
	color: var(--cl-muted);
	font-size: 13px;
	line-height: 1.6;
}

.cookielight-banner__privacy {
	color: var(--cl-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cookielight-banner__privacy:hover {
	opacity: 0.8;
}

/* === Buttons === */
.cookielight-banner__actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
}

.cookielight-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 20px;
	border: none;
	border-radius: calc(var(--cl-radius) * 0.6);
	font-size: 13px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
	line-height: 1;
	text-decoration: none;
}

.cookielight-btn:hover {
	opacity: 0.9;
}

.cookielight-btn:active {
	transform: scale(0.97);
}

.cookielight-btn:focus-visible {
	outline: 2px solid var(--cl-accent);
	outline-offset: 2px;
}

.cookielight-btn--accept {
	background: var(--cl-accent);
	color: var(--cl-accent-text);
}

.cookielight-btn--accept:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cookielight-btn--customize {
	background: transparent;
	color: var(--cl-text);
	border: 1px solid var(--cl-border);
	font-weight: 500;
}

.cookielight-btn--customize:hover {
	background: rgba(0, 0, 0, 0.03);
}

.cookielight-btn--reject {
	background: transparent;
	color: var(--cl-muted);
	font-weight: 500;
	padding: 10px 12px;
}

.cookielight-btn--reject:hover {
	color: var(--cl-text);
}

/* === Detail panel === */
.cookielight-detail {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.35s ease, opacity 0.25s ease;
	opacity: 0;
}

.cookielight-detail--open {
	max-height: 500px;
	opacity: 1;
}

.cookielight-detail__list {
	list-style: none;
	margin: 0 0 16px;
	padding: 16px 0 0;
	border-top: 1px solid var(--cl-border);
}

/* === Category item === */
.cookielight-cat {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--cl-border);
}

.cookielight-cat:last-child {
	border-bottom: none;
}

.cookielight-cat__info {
	flex: 1;
	min-width: 0;
}

.cookielight-cat__label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--cl-text);
	margin-bottom: 2px;
}

.cookielight-cat__desc {
	font-size: 12px;
	color: var(--cl-muted);
	line-height: 1.5;
	margin: 0;
}

/* === CSS-only toggle switch === */
.cookielight-toggle {
	position: relative;
	flex-shrink: 0;
	width: 40px;
	height: 22px;
	margin-top: 2px;
}

.cookielight-toggle__input {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.cookielight-toggle__slider {
	position: absolute;
	inset: 0;
	background: #d1d5db;
	border-radius: 11px;
	cursor: pointer;
	transition: background 0.2s;
}

.cookielight-toggle__slider::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cookielight-toggle__input:checked + .cookielight-toggle__slider {
	background: var(--cl-accent);
}

.cookielight-toggle__input:checked + .cookielight-toggle__slider::after {
	transform: translateX(18px);
}

.cookielight-toggle__input:focus-visible + .cookielight-toggle__slider {
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

/* Disabled toggle */
.cookielight-toggle__input:disabled + .cookielight-toggle__slider {
	background: var(--cl-accent);
	opacity: 0.5;
	cursor: not-allowed;
}

/* === Save button (detail panel) === */
.cookielight-detail__save {
	margin-top: 4px;
}

/* === Floating widget === */
.cookielight-widget {
	position: fixed;
	z-index: 999997;
	display: none;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--cl-bg, #ffffff);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
	cursor: pointer;
	font-size: 22px;
	line-height: 44px;
	text-align: center;
	transition: transform 0.2s, box-shadow 0.2s;
}

.cookielight-widget:hover {
	transform: scale(1.1);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.cookielight-widget:focus-visible {
	outline: 2px solid var(--cl-accent, #2563eb);
	outline-offset: 2px;
}

.cookielight-widget--visible {
	display: block;
}

.cookielight-widget--bottom-left {
	bottom: 16px;
	left: 16px;
}

.cookielight-widget--bottom-right {
	bottom: 16px;
	right: 16px;
}

/* === Iframe Placeholder === */
.cookielight-iframe-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f1f5f9;
	border: 1px dashed #cbd5e1;
	border-radius: 8px;
	min-height: 200px;
	overflow: hidden;
	font-family: inherit;
}

.cookielight-iframe-placeholder__content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 24px;
	text-align: center;
}

.cookielight-iframe-placeholder__icon {
	font-size: 32px;
	line-height: 1;
}

.cookielight-iframe-placeholder__name {
	font-size: 14px;
	font-weight: 600;
	color: #374151;
}

.cookielight-iframe-placeholder__text {
	font-size: 13px;
	color: #6b7280;
	max-width: 280px;
	line-height: 1.5;
}

.cookielight-iframe-placeholder__btn {
	margin-top: 4px;
	padding: 8px 20px;
	border: none;
	border-radius: 6px;
	background: #2563eb;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: opacity 0.2s;
}

.cookielight-iframe-placeholder__btn:hover {
	opacity: 0.9;
}

.cookielight-iframe-placeholder__btn:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

/* === Responsive === */
@media (max-width: 480px) {
	.cookielight-banner {
		width: auto;
		max-width: none;
		margin: 8px;
		padding: 20px;
	}

	.cookielight-banner--bottom-left,
	.cookielight-banner--bottom-right {
		left: 0;
		right: 0;
	}

	.cookielight-banner__actions {
		flex-direction: column;
	}

	.cookielight-btn {
		width: 100%;
		justify-content: center;
	}
}
