/* Всплывающее окно «Отправьте задание» — см. inc/stmap-task-popup.php */

.stmap-task, .stmap-task *, .stmap-task-mbar, .stmap-task-hbtn { box-sizing: border-box; }

/* ---------- Кнопка в шапке (вставляется JS-ом в .uicore-cta-wrapper) ----------
 * Места в шапке мало: от меню до корзины ~320px на 1536, ~224 на 1440,
 * ~126 на 1280. Поэтому: >=1600 — полный текст, 1440–1599 — «Задание»,
 * <1440 — кнопки в шапке нет, вместо неё фиксированная кнопка снизу. */
.stmap-task-hbtn {
	display: none; align-items: center; gap: 8px;
	margin-right: 12px; padding: 0 20px; height: 44px;
	border: 0; border-radius: 999px; cursor: pointer;
	background: #FD6D75; color: #fff !important;
	font: 600 15px/1 Rubik, sans-serif; letter-spacing: 0;
	box-shadow: 0 6px 18px rgba(253, 109, 117, .35);
	transition: transform .15s, box-shadow .15s, background .15s;
	white-space: nowrap; vertical-align: middle;
}
.stmap-task-hbtn:hover { background: #fc5a63; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(253, 109, 117, .45); }
.stmap-task-hbtn__short { display: none; }
@media (min-width: 1440px) {
	.stmap-task-hbtn { display: inline-flex; }
	.uicore-header-wrapper .uicore-cta-wrapper { display: inline-flex; align-items: center; }
	.uicore-header-wrapper .uicore-cta-wrapper .uicore-btn { white-space: nowrap; }
}
@media (min-width: 1440px) and (max-width: 1599px) {
	.stmap-task-hbtn { padding: 0 16px; gap: 6px; margin-right: 10px; font-size: 14px; }
	.stmap-task-hbtn__full { display: none; }
	.stmap-task-hbtn__short { display: inline; }
}

/* ---------- Фиксированная кнопка снизу (<1440px) ---------- */
.stmap-task-mbar { display: none; }
@media (max-width: 1439px) {
	.stmap-task-mbar {
		display: flex; align-items: center; justify-content: center; gap: 8px;
		position: fixed; z-index: 9990;
		left: 50%; transform: translateX(-50%); bottom: 20px;
		height: 52px; padding: 0 28px; border: 0; border-radius: 999px; cursor: pointer;
		background: #FD6D75; color: #fff;
		font: 600 16px/1 Rubik, sans-serif; white-space: nowrap;
		box-shadow: 0 10px 28px rgba(253, 109, 117, .45), 0 2px 6px rgba(0, 0, 0, .12);
		transition: opacity .2s, background .15s;
	}
	.stmap-task-mbar:hover { background: #fc5a63; }
	body.stmap-task-open .stmap-task-mbar { opacity: 0; pointer-events: none; }
	/* Чтобы кнопка не перекрывала низ подвала */
	body { padding-bottom: 84px; }
}
/* Телефон: на всю ширину; Chaty (Telegram) и кнопку cookie поднимаем над ней */
@media (max-width: 767px) {
	.stmap-task-mbar {
		left: 12px; right: 12px; transform: none; padding: 0 16px;
		bottom: calc(12px + env(safe-area-inset-bottom, 0px)); border-radius: 16px;
	}
	.stmap-task-mbar:active { transform: scale(.98); }
	body { padding-bottom: 76px; }
	.chaty-widget { bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important; }
	.flexiblecookies_open_settings_button { bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ---------- Модалка ---------- */
.stmap-task[hidden] { display: none !important; }
.stmap-task {
	position: fixed; inset: 0; z-index: 1000000;
	display: flex; align-items: center; justify-content: center; padding: 16px;
	font-family: "Open Sans", sans-serif; color: #4A6375;
}
.stmap-task__overlay { position: absolute; inset: 0; background: rgba(28, 36, 66, .6); backdrop-filter: blur(3px); animation: stmapTaskFade .2s ease-out; }
.stmap-task__box {
	position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto;
	background: #fff; border-radius: 22px; padding: 36px 32px 28px;
	box-shadow: 0 30px 80px rgba(20, 30, 70, .35);
	animation: stmapTaskPop .25s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes stmapTaskFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes stmapTaskPop { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
body.stmap-task-open { overflow: hidden; }

.stmap-task__x {
	position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; padding: 0;
	border: 0; border-radius: 50%; background: #F2F5FD; color: #7A8BA8;
	font: 400 24px/36px Arial, sans-serif; cursor: pointer; transition: background .15s, color .15s;
}
.stmap-task__x:hover { background: #EAEFFB; color: #333; }

.stmap-task__file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
.stmap-task__step[hidden] { display: none !important; }

.stmap-task__cat[hidden] { display: none; }
.stmap-task__cat {
	display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 40px);
	margin: 0 0 12px; padding: 5px 12px; border-radius: 999px;
	background: #EDF2FF; color: #465EC2; font-size: 13px; font-weight: 600;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stmap-task__cat::before { content: ""; flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: #6787FE; }
.stmap-task__title { font: 800 24px/1.25 Nunito, sans-serif; color: #333; margin: 0 28px 10px 0; }
.stmap-task__lead { font-size: 15px; line-height: 1.55; margin: 0 0 22px; color: #4A6375; }
.stmap-task__center { text-align: center; margin-right: 0; }

/* Зона загрузки */
.stmap-task__drop {
	display: flex; flex-direction: column; align-items: center; gap: 10px;
	padding: 26px 18px 20px; margin: 0; cursor: pointer; text-align: center;
	border: 2px dashed #B9C7FB; border-radius: 18px; background: #F5F8FF;
	transition: border-color .15s, background .15s;
}
.stmap-task__drop:hover, .stmap-task__drop.is-over { border-color: #6787FE; background: #EDF2FF; }
.stmap-task__drop-icon {
	display: flex; align-items: center; justify-content: center;
	width: 52px; height: 52px; border-radius: 50%; background: #fff; color: #6787FE;
	box-shadow: 0 4px 14px rgba(103, 135, 254, .2);
}
.stmap-task__drop-icon svg { width: 24px; height: 24px; }
.stmap-task__drop-hint { font-size: 13px; color: #6B7C96; }
.stmap-task__formats { font-size: 12px; color: #8E9BB0; }
.stmap-task__only-mobile { display: none; }
@media (hover: none) and (pointer: coarse) {
	.stmap-task__only-desktop { display: none; }
	.stmap-task__only-mobile { display: inline; }
}

/* Кнопки */
.stmap-task__btn {
	display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
	min-height: 52px; padding: 0 22px; border: 0; border-radius: 14px; cursor: pointer;
	font: 600 16px/1.2 Rubik, sans-serif; text-decoration: none !important;
	transition: background .15s, transform .15s, box-shadow .15s;
}
/* !important: тема красит button[type=submit] в primary и скругляет в «пилюлю» */
.stmap-task .stmap-task__btn { border-radius: 14px !important; text-transform: none !important; letter-spacing: 0 !important; }
.stmap-task .stmap-task__btn--primary { background: #FD6D75 !important; color: #fff !important; box-shadow: 0 8px 20px rgba(253, 109, 117, .35); }
.stmap-task .stmap-task__btn--primary:hover { background: #fc5a63 !important; }
.stmap-task__btn--primary:disabled { opacity: .6; cursor: wait; }
.stmap-task__drop-btn { width: auto; min-height: 48px; pointer-events: none; }
.stmap-task__btn--tg { background: #EAF4FC; color: #229ED9 !important; }
.stmap-task__btn--tg:hover { background: #DCEEFB; }
.stmap-task__btn--max { background: #EFEBFF; color: #471AFF !important; }
.stmap-task__btn--max:hover { background: #E4DDFF; }
.stmap-task__max-ico { flex: none; width: 20px; height: 20px; background: url(/wp-content/themes/affirm-child/assets/max-logo.png) center / contain no-repeat; }
/* Telegram и MAX — в ряд; на узких экранах друг под другом */
.stmap-task__msgr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stmap-task__msgr .stmap-task__btn { padding: 0 10px; font-size: 15px; white-space: nowrap; }
@media (max-width: 479px) { .stmap-task__msgr { grid-template-columns: 1fr; } .stmap-task__msgr .stmap-task__btn { font-size: 16px; } }
.stmap-task .stmap-task__btn--ghost { background: transparent !important; color: #7A8BA8 !important; margin-top: 8px; min-height: 44px; box-shadow: none !important; font-weight: 500; }
.stmap-task .stmap-task__btn--ghost:hover { color: #333 !important; }

.stmap-task__or { display: flex; align-items: center; gap: 12px; margin: 18px 0; font-size: 13px; color: #9AA6BA; }
.stmap-task__or::before, .stmap-task__or::after { content: ""; flex: 1; height: 1px; background: #E6EBF5; }

/* Прогресс и ошибки */
.stmap-task__progress { margin-top: 14px; }
.stmap-task__progress[hidden], .stmap-task__error[hidden] { display: none; }
.stmap-task__bar { height: 6px; border-radius: 3px; background: #EAEFFB; overflow: hidden; }
.stmap-task__bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6787FE, #465EC2); transition: width .2s; }
.stmap-task__progress-txt { display: block; margin-top: 6px; font-size: 13px; color: #6B7C96; }
.stmap-task__error { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: #FFF0F1; color: #D63C47; font-size: 14px; line-height: 1.4; }

/* Шаг 2 */
.stmap-task__got { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.stmap-task__got .stmap-task__title { margin: 0; }
.stmap-task__check {
	flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
	width: 34px; height: 34px; border-radius: 50%; background: #E6F8EC; color: #22A04B; font-weight: 700; font-size: 18px;
}
.stmap-task__files { list-style: none; margin: 0 0 6px; padding: 0; }
.stmap-task__files li {
	display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 6px;
	border-radius: 12px; background: #F5F8FF; font-size: 14px; color: #333;
}
.stmap-task__files .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.stmap-task__files .s { flex: 0 0 auto; color: #8E9BB0; font-size: 13px; }
.stmap-task__files button { flex: 0 0 auto; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #9AA6BA; font-size: 18px; line-height: 26px; cursor: pointer; }
.stmap-task__files button:hover { background: #fff; color: #D63C47; }
.stmap-task__files-meta { font-size: 13px; color: #8E9BB0; margin-bottom: 20px; }
.stmap-task__add { color: #6787FE; cursor: pointer; font-weight: 600; margin: 0; display: inline; }
.stmap-task__add:hover { text-decoration: underline; }

.stmap-task__q { font: 700 16px/1.3 Nunito, sans-serif; color: #333; margin: 0 0 10px; }
.stmap-task__chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
@media (max-width: 420px) { .stmap-task__chips { grid-template-columns: repeat(2, 1fr); } }
.stmap-task__chip, .stmap-task__seg label { position: relative; margin: 0; cursor: pointer; }
.stmap-task__chip input, .stmap-task__seg input { position: absolute; opacity: 0; pointer-events: none; }
.stmap-task__chip span {
	display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 6px 8px;
	border: 1.5px solid #DDE4F3; border-radius: 12px; background: #fff;
	font-size: 14px; font-weight: 600; color: #4A6375; text-align: center; transition: all .15s;
}
.stmap-task__chip:hover span { border-color: #B9C7FB; }
.stmap-task__chip input:checked + span { border-color: #6787FE; background: #EDF2FF; color: #465EC2; }
.stmap-task__chip input:focus-visible + span, .stmap-task__seg input:focus-visible + span { outline: 2px solid #6787FE; outline-offset: 2px; }

.stmap-task__seg { display: inline-flex; padding: 4px; margin-bottom: 10px; border-radius: 12px; background: #F2F5FD; }
.stmap-task__seg span { display: block; padding: 8px 18px; border-radius: 9px; font-size: 14px; font-weight: 600; color: #7A8BA8; transition: all .15s; }
.stmap-task__seg input:checked + span { background: #fff; color: #333; box-shadow: 0 2px 8px rgba(20, 30, 70, .1); }

.stmap-task .stmap-task__input {
	display: block; width: 100%; height: 50px; margin: 0; padding: 0 16px;
	border: 1.5px solid #DDE4F3; border-radius: 12px; background: #fff;
	font: 400 16px/1 "Open Sans", sans-serif; color: #333; box-shadow: none; outline: none; transition: border-color .15s;
}
.stmap-task .stmap-task__input:focus { border-color: #6787FE; box-shadow: 0 0 0 3px rgba(103, 135, 254, .15); }
.stmap-task .stmap-task__input.is-bad { border-color: #FD6D75; }
.stmap-task__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.stmap-task__submit { margin-top: 18px; }
.stmap-task__legal { margin: 12px 0 0; font-size: 12px; line-height: 1.45; color: #9AA6BA; text-align: center; }
.stmap-task__legal a { color: #7A8BA8; text-decoration: underline; }

/* Шаг 3 */
.stmap-task__done-icon {
	display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; margin: 4px auto 16px;
	border-radius: 50%; background: #E6F8EC; color: #22A04B; font-size: 36px; font-weight: 700;
	animation: stmapTaskPop .35s cubic-bezier(.2, .9, .3, 1.4);
}
.stmap-task__steps { list-style: none; counter-reset: s; margin: 4px 0 16px; padding: 16px 18px; border-radius: 14px; background: #F5F8FF; }
.stmap-task__steps li { counter-increment: s; display: flex; align-items: center; gap: 12px; margin: 0; padding: 6px 0; font-size: 15px; color: #333; }
.stmap-task__steps li::before {
	content: counter(s); flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
	width: 26px; height: 26px; border-radius: 50%; background: #6787FE; color: #fff; font-size: 13px; font-weight: 700;
}
.stmap-task__note { text-align: center; font-size: 14px; color: #6B7C96; margin: 0 0 16px; }

@media (max-width: 560px) {
	.stmap-task { align-items: flex-end; padding: 0; }
	.stmap-task__box {
		max-width: none; max-height: 92vh; border-radius: 22px 22px 0 0;
		padding: 30px 20px calc(22px + env(safe-area-inset-bottom, 0px));
		animation: stmapTaskUp .28s cubic-bezier(.2, .9, .3, 1);
	}
	.stmap-task__title { font-size: 21px; }
}
@keyframes stmapTaskUp { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
	.stmap-task__box, .stmap-task__overlay, .stmap-task__done-icon { animation: none; }
}
