/* Отказ от договора и Законова гаранция — прозорци.
   Селекторите са с #id / две нива, за да не ги пренаписват глобалните стилове на темата и Elementor. */

.mwecr-modal[hidden],
.mwecr-modal [hidden] { display: none !important; }

html.mwecr-lock,
html.mwecr-lock body { overflow: hidden !important; }

.mwecr-modal {
	position: fixed; top: 0; right: 0; bottom: 0; left: 0;
	z-index: 2147483647; /* максимумът; JS слага прозореца последен в <body> — над плаващите бутони на други плъгини */
	display: flex; align-items: center; justify-content: center;
	padding: 24px;
	background: rgba(8, 10, 28, .64);
	-webkit-tap-highlight-color: transparent;
}
.mwecr-modal *,
.mwecr-modal *::before,
.mwecr-modal *::after { box-sizing: border-box; }

.mwecr-modal .mwecr-dialog {
	position: relative;
	display: flex; flex-direction: column;
	width: 100%; max-width: 720px;
	max-height: calc(100vh - 48px);
	max-height: calc(100dvh - 48px);
	margin: 0;
	background: #fff; color: #1f2430;
	border-radius: 14px;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
	overflow: hidden;
	font-family: inherit; font-size: 16px; line-height: 1.5; text-align: left;
	outline: 0;
}
.mwecr-modal.mwecr-modal--image .mwecr-dialog { max-width: 760px; }
.mwecr-modal.is-open .mwecr-dialog { animation: mwecr-in .2s ease-out; }
@keyframes mwecr-in {
	from { opacity: 0; transform: translateY(14px) scale(.985); }
	to   { opacity: 1; transform: none; }
}

/* Заглавна лента — кръстчето е винаги видимо, не върху съдържанието. */
.mwecr-modal .mwecr-head {
	flex: 0 0 auto; position: relative;
	padding: 18px 68px 16px 24px;
	border-bottom: 1px solid #e6e8ef;
	background: #fff;
}
.mwecr-modal h2.mwecr-title {
	margin: 0; padding: 0;
	font-family: inherit; font-size: 20px; font-weight: 700; line-height: 1.3;
	letter-spacing: 0; text-transform: none;
	color: var(--mwecr-accent, #617798);
}
.mwecr-modal button.mwecr-close {
	position: absolute; top: 10px; right: 12px;
	display: flex; align-items: center; justify-content: center;
	width: 44px; height: 44px; min-width: 0; min-height: 0;
	margin: 0; padding: 0;
	border: 0; border-radius: 50%;
	background: #eef0f5; color: #1f2430;
	box-shadow: none; cursor: pointer; line-height: 1;
	transition: background-color .15s;
}
.mwecr-modal button.mwecr-close:hover { background: #dde1ea; color: #1f2430; }
.mwecr-modal button.mwecr-close svg { display: block; width: 22px; height: 22px; }

.mwecr-modal .mwecr-body {
	flex: 1 1 auto;
	overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
	padding: 20px 24px 24px;
}

/* Формуляр */
.mwecr-modal .mwecr-intro { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: #454b57; }
.mwecr-modal .mwecr-note  { margin: 0 0 18px; font-size: 13px; line-height: 1.5; color: #6b7180; }
.mwecr-modal .mwecr-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mwecr-modal .mwecr-field { min-width: 0; margin: 0; }
.mwecr-modal .mwecr-field--full { grid-column: 1 / -1; }
.mwecr-modal .mwecr-field label {
	display: block; margin: 0 0 6px;
	font-size: 14px; font-weight: 600; line-height: 1.35; color: #1f2430;
}
.mwecr-modal .mwecr-star { margin-left: 3px; color: #c0262d; }

#mwecr-withdrawal input[type="text"],
#mwecr-withdrawal input[type="email"],
#mwecr-withdrawal input[type="date"],
#mwecr-withdrawal textarea {
	display: block; width: 100%; max-width: none; min-height: 46px;
	margin: 0; padding: 11px 13px;
	border: 1px solid #c7ccd6; border-radius: 9px;
	background: #fff; color: #1f2430;
	font-family: inherit; font-size: 16px; /* 16px — iPhone не приближава при фокус */
	line-height: 1.4;
	box-shadow: none; outline: 0;
	transition: border-color .15s, box-shadow .15s;
	-webkit-appearance: none; appearance: none;
}
#mwecr-withdrawal textarea { resize: vertical; }
#mwecr-withdrawal input[type="text"]:focus,
#mwecr-withdrawal input[type="email"]:focus,
#mwecr-withdrawal input[type="date"]:focus,
#mwecr-withdrawal textarea:focus {
	border-color: var(--mwecr-accent, #617798);
	box-shadow: 0 0 0 3px rgba(97, 119, 152, .25);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--mwecr-accent, #617798) 28%, transparent);
}
#mwecr-withdrawal input[aria-invalid="true"],
#mwecr-withdrawal textarea[aria-invalid="true"],
#mwecr-withdrawal input[aria-invalid="true"]:focus,
#mwecr-withdrawal textarea[aria-invalid="true"]:focus {
	border-color: #d92d20;
	box-shadow: 0 0 0 3px rgba(217, 45, 32, .14);
}

.mwecr-modal .mwecr-help  { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; color: #6b7180; }
.mwecr-modal .mwecr-error { margin: 6px 0 0; font-size: 13px; font-weight: 600; line-height: 1.4; color: #b42318; }
.mwecr-modal .mwecr-alert {
	margin: 0 0 16px; padding: 11px 14px;
	border: 1px solid #fecdca; border-radius: 9px;
	background: #fef3f2; color: #b42318;
	font-size: 14px; font-weight: 600; line-height: 1.45;
}

.mwecr-modal .mwecr-check {
	display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start;
	margin: 20px 0 0; padding: 14px;
	border: 1px solid #e6e8ef; border-radius: 10px; background: #f7f8fb;
}
#mwecr-withdrawal .mwecr-check input[type="checkbox"] {
	width: 22px; height: 22px; margin: 1px 0 0; padding: 0;
	accent-color: var(--mwecr-accent, #617798); cursor: pointer;
}
.mwecr-modal .mwecr-check label { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.5; cursor: pointer; }
.mwecr-modal .mwecr-check .mwecr-error { grid-column: 2; }

/* Поле-капан за ботове — невидимо за хора и екранни четци. */
.mwecr-modal .mwecr-hp {
	position: absolute !important; left: -10000px !important; top: auto;
	width: 1px; height: 1px; overflow: hidden;
}

#mwecr-withdrawal button.mwecr-submit {
	display: block; width: 100%; min-height: 50px;
	margin: 20px 0 0; padding: 14px 22px;
	border: 0; border-radius: 10px;
	background: var(--mwecr-accent, #617798); color: #fff;
	font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1.2;
	letter-spacing: .2px; text-transform: none;
	box-shadow: none; cursor: pointer;
	transition: filter .15s, opacity .15s;
}
#mwecr-withdrawal button.mwecr-submit:hover { background: var(--mwecr-accent, #617798); color: #fff; filter: brightness(1.08); }
#mwecr-withdrawal button.mwecr-submit:disabled { opacity: .7; cursor: progress; filter: none; }

/* Успех */
.mwecr-modal .mwecr-success { padding: 28px 8px 20px; text-align: center; }
.mwecr-modal .mwecr-success__icon {
	display: flex; align-items: center; justify-content: center;
	width: 68px; height: 68px; margin: 0 auto 16px;
	border-radius: 50%; background: #ecfdf3; color: #079455;
}
.mwecr-modal .mwecr-success__icon svg { display: block; width: 36px; height: 36px; }
.mwecr-modal .mwecr-success__title { margin: 0 0 8px; font-size: 20px; font-weight: 700; line-height: 1.3; color: #1f2430; }
.mwecr-modal .mwecr-success__text  { margin: 0; font-size: 15px; line-height: 1.55; color: #454b57; }

/* Законова гаранция */
.mwecr-modal a.mwecr-poster-link { display: block; cursor: zoom-in; text-decoration: none; }
.mwecr-modal .mwecr-poster { display: block; }
.mwecr-modal .mwecr-zoom-hint { display: none; margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: #6b7180; text-align: center; }
.mwecr-modal .mwecr-poster img {
	display: block; width: 100%; max-width: 100%; height: auto; margin: 0 auto;
	border: 1px solid #e6e8ef; border-radius: 6px; background: #f3f4f7;
}
.mwecr-modal .mwecr-more { margin: 14px 0 0; font-size: 14px; line-height: 1.5; color: #454b57; text-align: center; }
.mwecr-modal .mwecr-more a { color: var(--mwecr-accent, #617798); text-decoration: underline; }

/* Фокус от клавиатура */
.mwecr-modal button:focus-visible,
.mwecr-modal a:focus-visible,
#mwecr-withdrawal input[type="checkbox"]:focus-visible {
	outline: 3px solid var(--mwecr-accent, #617798); outline-offset: 2px;
}
.mwecr-modal .mwecr-dialog:focus,
.mwecr-modal .mwecr-dialog:focus-visible { outline: 0; }

/* Телефон: цял екран, лентата със заглавието и кръстчето остава горе. */
@media (max-width: 640px) {
	.mwecr-modal { padding: 0; align-items: stretch; }
	.mwecr-modal .mwecr-dialog { max-width: none; height: 100%; max-height: none; border-radius: 0; }
	.mwecr-modal.mwecr-modal--image .mwecr-dialog { max-width: none; }
	.mwecr-modal .mwecr-head { padding: 14px 62px 12px 16px; }
	.mwecr-modal h2.mwecr-title { font-size: 18px; }
	.mwecr-modal button.mwecr-close { top: 6px; right: 8px; }
	.mwecr-modal .mwecr-body { padding: 16px 16px calc(28px + env(safe-area-inset-bottom, 0px)); }
	.mwecr-modal .mwecr-grid { grid-template-columns: 1fr; gap: 14px; }
	.mwecr-modal.mwecr-modal--image .mwecr-body { padding: 12px 12px calc(20px + env(safe-area-inset-bottom, 0px)); }
	.mwecr-modal .mwecr-zoom-hint { display: block; } /* на телефон плакатът е дребен — отваря се в пълен размер */
}
@media (min-width: 641px) {
	#mwecr-withdrawal button.mwecr-submit { width: auto; min-width: 260px; }
}
@media (prefers-reduced-motion: reduce) {
	.mwecr-modal.is-open .mwecr-dialog { animation: none; }
}

/* Шорткод [mw_legal_links] — за сайтове, където линковете не са в съществуващ списък. */
.mwecr-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; }
.mwecr-links a.mwecr-links__a { color: inherit; text-decoration: none; }
.mwecr-links a.mwecr-links__a:hover,
.mwecr-links a.mwecr-links__a:focus-visible { text-decoration: underline; }
.mwecr-links .mwecr-links__sep { opacity: .5; }
