/* Cookie Banner — Law 13. Self-contained, theme-agnostic, RTL-aware. */

#cbl13-root[hidden],
.cbl13-modal[hidden],
.cbl13-reopen[hidden] { display: none; }

#cbl13-root {
	--cbl13-accent: #2563eb;
	--cbl13-bg: #ffffff;
	--cbl13-fg: #1f2430;
	--cbl13-muted: #5b6472;
	--cbl13-border: #e3e6eb;
	--cbl13-radius: 14px;
	position: fixed;
	inset: 0 0 auto 0;
	z-index: 2147483647 !important; /* max 32-bit int — above every other layer */
	pointer-events: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Rubik, Arial, sans-serif;
}

.cbl13-banner {
	pointer-events: auto;
	position: fixed;
	left: 16px;
	right: 16px;
	bottom: 16px;
	margin: 0 auto;
	max-width: 1080px;
	background: var(--cbl13-bg);
	color: var(--cbl13-fg);
	border: 1px solid #e3e6eb;
	border-radius: var(--cbl13-radius);
	box-shadow: 0 12px 40px rgba(15, 23, 42, .22);
	padding: 18px 20px;
	display: flex;
	gap: 18px;
	align-items: center;
	flex-wrap: wrap;
}

.cbl13-banner[data-position="box"] {
	max-width: 400px;
	left: auto;
	right: 16px;
	flex-direction: column;
	align-items: stretch;
}
[dir="rtl"] .cbl13-banner[data-position="box"] { right: auto; left: 16px; }

.cbl13-banner__body { flex: 1 1 340px; }
.cbl13-banner__title { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.cbl13-banner__text { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--cbl13-muted); }
.cbl13-banner__text a { color: var(--cbl13-accent); text-decoration: underline; }

.cbl13-banner__actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.cbl13-btn {
	appearance: none;
	border: 1px solid transparent;
	border-radius: 10px;
	padding: 10px 18px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	line-height: 1;
	transition: filter .15s ease, background .15s ease;
}
.cbl13-btn--primary { background: var(--cbl13-accent); color: #fff; }
.cbl13-btn--primary:hover { filter: brightness(1.08); }
.cbl13-btn--ghost { background: transparent; color: var(--cbl13-fg); border-color: #ccd2db; }
.cbl13-btn--ghost:hover { background: #f3f5f8; }

/* Modal */
.cbl13-modal {
	pointer-events: auto;
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, .55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	z-index: 2147483647 !important;
}
.cbl13-modal__panel {
	background: var(--cbl13-bg);
	color: var(--cbl13-fg);
	width: 100%;
	max-width: 560px;
	max-height: 86vh;
	overflow: auto;
	border-radius: var(--cbl13-radius);
	box-shadow: 0 24px 60px rgba(15, 23, 42, .4);
}
.cbl13-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid #eceef2;
}
.cbl13-modal__head h2 { margin: 0; font-size: 17px; }
.cbl13-modal__close { background: none; border: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--cbl13-muted); }
.cbl13-modal__list { padding: 8px 20px; }
.cbl13-modal__actions {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	flex-wrap: wrap;
	padding: 16px 20px;
	border-top: 1px solid #eceef2;
	position: sticky;
	bottom: 0;
	background: var(--cbl13-bg);
}

.cbl13-cat { padding: 14px 0; border-bottom: 1px solid #f0f2f5; }
.cbl13-cat:last-child { border-bottom: none; }
.cbl13-cat__head { display: flex; align-items: center; gap: 12px; }
.cbl13-cat__title { font-weight: 700; font-size: 14px; }
.cbl13-cat__always { font-weight: 500; font-size: 12px; color: var(--cbl13-accent); font-style: normal; }
.cbl13-cat__desc { margin: 8px 0 0; font-size: 13px; line-height: 1.55; color: var(--cbl13-muted); }

/* Switch */
.cbl13-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 auto; }
.cbl13-switch input { opacity: 0; width: 0; height: 0; }
.cbl13-switch__slider {
	position: absolute; inset: 0; cursor: pointer; background: #c7ccd6;
	border-radius: 24px; transition: background .18s ease;
}
.cbl13-switch__slider::before {
	content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
	background: #fff; border-radius: 50%; transition: transform .18s ease;
}
.cbl13-switch input:checked + .cbl13-switch__slider { background: var(--cbl13-accent); }
.cbl13-switch input:checked + .cbl13-switch__slider::before { transform: translateX(20px); }
.cbl13-switch input:disabled + .cbl13-switch__slider { opacity: .65; cursor: not-allowed; }
/* RTL: anchor the knob to the right edge, then slide it left when checked. */
[dir="rtl"] .cbl13-switch__slider::before { left: auto; right: 3px; }
[dir="rtl"] .cbl13-switch input:checked + .cbl13-switch__slider::before { transform: translateX(-20px); }

/* Reopen floating button */
.cbl13-reopen {
	position: fixed;
	bottom: 16px;
	left: 16px;
	width: 46px; height: 46px;
	border-radius: 50%;
	border: 1px solid #e3e6eb;
	background: #fff;
	box-shadow: 0 6px 20px rgba(15, 23, 42, .22);
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	z-index: 2147483646 !important;
}
[dir="rtl"].cbl13-reopen, [dir="rtl"] .cbl13-reopen { left: auto; right: 16px; }

@media (max-width: 640px) {
	.cbl13-banner { flex-direction: column; align-items: stretch; }
	.cbl13-banner__actions .cbl13-btn { flex: 1 1 auto; text-align: center; }
}

@media (prefers-color-scheme: dark) {
	#cbl13-root { --cbl13-bg: #1b1f27; --cbl13-fg: #eef1f5; --cbl13-muted: #aab2bf; }
	.cbl13-btn--ghost { border-color: #3a414d; color: #eef1f5; }
	.cbl13-btn--ghost:hover { background: #262b34; }
	.cbl13-banner, .cbl13-reopen { border-color: #333a45; }
	.cbl13-modal__head, .cbl13-modal__actions, .cbl13-cat, .cbl13-cat:last-child { border-color: #2b313b; }
}
