/* ==========================================================================
   Midy Cookies
   Unități în px: tema setează html { font-size: 62.5% }, dar pluginul nu
   trebuie să depindă de asta. Culorile vin din variabilele temei, cu fallback.
   ========================================================================== */

.midy-ck {
	--midy-ck-dark: var(--dark, #000);
	--midy-ck-border: var(--gray, #eaeaea);
	--midy-ck-muted: #f5f5f5;
	--midy-ck-text: #333;
	--midy-ck-bottom: 24px;
}

.midy-ck [hidden] {
	display: none !important;
}

/* -------------------------------------------------------------- Butoane */

.midy-ck-btn {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 16px;
	border: 1px solid transparent;
	border-radius: 10px;
	background: var(--midy-ck-dark, #000);
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.midy-ck-btn:hover {
	background: transparent;
	border-color: var(--midy-ck-dark, #000);
	color: var(--midy-ck-dark, #000);
}

.midy-ck-btn:focus-visible,
.midy-ck-switch:focus-visible,
.midy-ck-modal__close:focus-visible {
	outline: 2px solid var(--primary, #5d839d);
	outline-offset: 2px;
}

.midy-ck-btn--outline {
	background: #fff;
	border-color: var(--midy-ck-dark, #000);
	color: var(--midy-ck-dark, #000);
}

.midy-ck-btn--outline:hover {
	background: var(--midy-ck-dark, #000);
	color: #fff;
}

.midy-ck-btn--ghost {
	background: var(--midy-ck-muted);
	color: var(--midy-ck-dark, #000);
}

.midy-ck-btn--ghost:hover {
	background: #fff;
}

/* --------------------------------------------------------------- Banner */

.midy-ck-banner {
	position: fixed;
	left: 24px;
	bottom: var(--midy-ck-bottom);
	z-index: 999;
	box-sizing: border-box;
	width: calc(100% - 48px);
	max-width: 380px;
	padding: 20px;
	border: 1px solid var(--midy-ck-border);
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
	color: var(--midy-ck-dark, #000);
	font-family: inherit;
	animation: midy-ck-in 0.3s ease-out;
}

.midy-ck-banner .midy-ck-banner__title {
	margin: 0 0 8px;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
}

.midy-ck-banner .midy-ck-banner__text {
	margin: 0 0 16px;
	color: var(--midy-ck-text);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
}

.midy-ck-banner__text a,
.midy-ck-modal__policy {
	color: var(--midy-ck-dark, #000);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.midy-ck-banner__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.midy-ck-btn--wide {
	grid-column: 1 / -1;
}

@keyframes midy-ck-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}

/* ---------------------------------------------------------------- Modal */

.midy-ck-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-family: inherit;
}

.midy-ck-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.midy-ck-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
	color: var(--midy-ck-dark, #000);
	outline: none;
	animation: midy-ck-in 0.25s ease-out;
}

.midy-ck-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 24px;
	border-bottom: 1px solid var(--midy-ck-border);
}

.midy-ck-modal .midy-ck-modal__title {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
}

.midy-ck-modal__close {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: var(--midy-ck-muted);
	color: var(--midy-ck-dark, #000);
	cursor: pointer;
}

.midy-ck-modal__body {
	padding: 20px 24px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.midy-ck-modal .midy-ck-modal__intro,
.midy-ck-modal .midy-ck-cat__desc,
.midy-ck-modal .midy-ck-modal__id {
	margin: 0;
	color: var(--midy-ck-text);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
}

.midy-ck-cats {
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
}

.midy-ck-cat {
	padding: 14px 0;
	border-top: 1px solid var(--midy-ck-border);
}

.midy-ck-cat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 4px;
}

.midy-ck-cat__label {
	font-size: 16px;
	font-weight: 600;
}

.midy-ck-cat__always {
	color: var(--primary, #5d839d);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

.midy-ck-modal .midy-ck-modal__id {
	margin-top: 12px;
	font-size: 12px;
	word-break: break-all;
}

.midy-ck-modal__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 24px;
	border-top: 1px solid var(--midy-ck-border);
}

.midy-ck-modal__policy {
	font-size: 14px;
}

.midy-ck-modal__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-left: auto;
}

html.midy-ck-modal-open {
	overflow: hidden;
}

/* --------------------------------------------------------------- Switch */

.midy-ck-switch {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	flex-shrink: 0;
	width: 44px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: #d4d4d4;
	cursor: pointer;
	transition: background-color 0.2s;
}

.midy-ck-switch__knob {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s;
}

.midy-ck-switch[aria-checked="true"] {
	background: var(--midy-ck-dark, #000);
}

.midy-ck-switch[aria-checked="true"] .midy-ck-switch__knob {
	transform: translateX(20px);
}

/* ------------------------------------------------- Embed-uri blocate */

.midy-ck-embed {
	position: relative;
}

.midy-ck-embed iframe {
	display: block;
}

.midy-ck-embed__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 24px;
	border-radius: inherit;
	background: #f5f5f5;
	text-align: center;
}

.midy-ck-embed__placeholder p {
	max-width: 420px;
	margin: 0;
	color: #333;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
}

/* --------------------------------------------- Politica de cookie-uri */

.midy-ck-policy h3 {
	margin: 32px 0 8px;
	font-size: 22px;
	font-weight: 600;
}

.midy-ck-policy__scroll {
	overflow-x: auto;
	margin-top: 12px;
}

.midy-ck-policy__table {
	width: 100%;
	min-width: 560px;
	border-collapse: collapse;
	font-size: 15px;
	line-height: 1.5;
}

.midy-ck-policy__table th,
.midy-ck-policy__table td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--gray, #eaeaea);
	text-align: left;
	vertical-align: top;
}

.midy-ck-policy__table th {
	background: #f8f8f8;
	font-weight: 600;
}

.midy-ck-policy__table code {
	padding: 2px 6px;
	border-radius: 6px;
	background: #f5f5f5;
	color: #333;
	font-size: 13px;
	white-space: nowrap;
}

/* ----------------------------------------------------------- Responsive */

/* Sub 991px tema are o bară de meniu fixată jos (~64px), ca butonul WhatsApp. */
@media (max-width: 991px) {
	.midy-ck {
		--midy-ck-bottom: calc(76px + env(safe-area-inset-bottom));
	}
}

@media (max-width: 575px) {
	.midy-ck-banner {
		left: 12px;
		width: calc(100% - 24px);
		max-width: none;
		padding: 16px;
	}

	/* Bannerul ocupă toată lățimea: ridicăm butonul WhatsApp deasupra lui. */
	html.midy-ck-banner-open .whatsapp_float {
		bottom: calc(76px + var(--midy-ck-offset, 0px) + 12px + env(safe-area-inset-bottom));
	}

	.midy-ck-modal {
		align-items: flex-end;
		padding: 0;
	}

	.midy-ck-modal__dialog {
		max-height: 90vh;
		max-height: 90dvh;
		border-radius: 16px 16px 0 0;
	}

	.midy-ck-modal__head,
	.midy-ck-modal__body,
	.midy-ck-modal__foot {
		padding-left: 16px;
		padding-right: 16px;
	}

	.midy-ck-modal__actions {
		width: 100%;
	}

	.midy-ck-modal__actions .midy-ck-btn {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.midy-ck-banner,
	.midy-ck-modal__dialog {
		animation: none;
	}
}
