/**
 * ICTI Article Submission – form styles (theme-friendly, prefixed).
 * Uses theme tokens: #095de4, #252525, #e5e7eb, 30px/15px radius, Montserrat/Roboto.
 */

/* Form and authors section: full width, no extra indents from container */
.icti-as-form {
	width: 100%;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
	box-sizing: border-box;
}

/* Form sections (section-border) — по ширине контейнера, уменьшенные горизонтальные отступы */
.icti-as-form .section-border,
.icti-as-form .publication-form__authors,
.icti-as-form .publication-info {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: 0;
}

.icti-as-form .section-border:first-child {
	margin-top: 0;
}

.icti-as-form .publication-form__authors {
	width: 100%;
}

/* Легенда «Авторы» — без отступа снизу */
.icti-as-form .publication-form__authors > .section-title {
	margin-bottom: 15px;
}

.icti-as-form #icti-as-authors-container {
	width: 100%;
	margin-top: 0;
}

/* Author block spacing and full width */
.icti-as-form .icti-as-author-block {
	margin-bottom: 20px;
	width: 100%;
}

.icti-as-form .icti-as-author-block:last-of-type {
	margin-bottom: 0;
}

.icti-as-form .publication-form__authors .section-border.icti-as-author-block {
	padding: 20px;
	width: 100%;
	box-sizing: border-box;
}

/* Add author button: full width, белый фон, синяя граница и текст */
.icti-as-form .icti-as-add-author {
	margin-top: 20px;
	background-color: #fff;
	color: #095de4;
	border: 1px solid #095de4;
}

.icti-as-form .icti-as-add-author:hover {
	background-color: #095de4;
	color: #fff;
	border-color: #095de4;
}

/* Authors fields: grid 3 columns × 3 rows */
.icti-as-authors-fields {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: auto auto auto;
	gap: 20px 25px;
	width: 100%;
}

.icti-as-authors-row {
	display: contents;
}

.icti-as-authors-row .fields-block,
.icti-as-authors-row .icti-as-responsible-cell,
.icti-as-authors-row .icti-as-remove-cell {
	min-width: 0;
}

.icti-as-authors-row .fields-block input {
	width: 100%;
	box-sizing: border-box;
}

/* Row 1: Фамилия, Имя, Отчество — по одному в колонке */
.icti-as-authors-row_first .fields-block:nth-child(1) { grid-column: 1; grid-row: 1; }
.icti-as-authors-row_first .fields-block:nth-child(2) { grid-column: 2; grid-row: 1; }
.icti-as-authors-row_first .fields-block:nth-child(3) { grid-column: 3; grid-row: 1; }

/* Row 2: Электронный адрес, Организация — две колонки */
.icti-as-authors-row_second .fields-block:nth-child(1) { grid-column: 1; grid-row: 2; }
.icti-as-authors-row_second .fields-block:nth-child(2) { grid-column: 2; grid-row: 2; }

/* Row 3: Веб-страница автора, Ответственный автор, кнопка Удалить — три колонки на десктопе */
.icti-as-authors-row_third .fields-block:nth-child(1) { grid-column: 1; grid-row: 3; }
.icti-as-authors-row_third .icti-as-responsible-cell { grid-column: 2; grid-row: 3; align-self: center; }
.icti-as-authors-row_third .icti-as-remove-cell { grid-column: 3; grid-row: 3; align-self: end; justify-self: end; }

.icti-as-responsible-cell {
	display: flex;
	align-items: center;
}

/* Отступ между радио и текстом «Ответственный автор» */
.icti-as-responsible-wrap {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	cursor: pointer;
}

.icti-as-responsible-wrap input {
	margin: 0;
	flex-shrink: 0;
}

/* Кнопка «Удалить» — приглушённая, в одной строке с веб-страницей и чекбоксом */
.icti-as-remove-cell {
	display: flex;
	justify-content: flex-end;
	align-items: center;
}

.icti-as-form .icti-as-remove-author {
	background: #e33838;
	color: #fff;
	border: 1px solid #c92f2f;
	padding: 8px 16px;
	font-size: 0.9em;
	border-radius: 20px;
	cursor: pointer;
}

.icti-as-form .icti-as-remove-author:hover {
	background: #c92f2f;
	border-color: #b02828;
	color: #fff;
}

/* Responsive: 2 columns from 1090px — поле «Отчество» не сжимается */
@media screen and (max-width: 1090px) {
	.icti-as-authors-fields {
		grid-template-columns: repeat(2, 1fr);
		grid-template-rows: repeat(4, auto);
	}

	.icti-as-authors-row_first .fields-block:nth-child(1) { grid-column: 1; grid-row: 1; }
	.icti-as-authors-row_first .fields-block:nth-child(2) { grid-column: 2; grid-row: 1; }
	.icti-as-authors-row_first .fields-block:nth-child(3) { grid-column: 1; grid-row: 2; }
	.icti-as-authors-row_second .fields-block:nth-child(1) { grid-column: 2; grid-row: 2; }
	.icti-as-authors-row_second .fields-block:nth-child(2) { grid-column: 1; grid-row: 3; }
	.icti-as-authors-row_third .fields-block:nth-child(1) { grid-column: 2; grid-row: 3; }
	.icti-as-authors-row_third .icti-as-responsible-cell { grid-column: 1; grid-row: 4; align-self: center; }
	.icti-as-authors-row_third .icti-as-remove-cell { grid-column: 2; grid-row: 4; align-self: center; justify-self: end; }
}

/* Файл статьи — современная кнопка выбора */
.icti-as-form .icti-as-file-label {
	display: block;
	width: 100%;
	box-sizing: border-box;
}

.icti-as-form .icti-as-file-heading {
	display: block;
	margin-bottom: 8px;
}

.icti-as-form .icti-as-file-btn-wrap {
	display: block;
	margin-top: 6px;
}

.icti-as-form .icti-as-file-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: flex-start;
	gap: 10px;
	min-width: 320px;
	padding: 14px 40px;
	background: transparent;
	color: #095de4;
	border: 2px dashed #095de4;
	border-radius: 10px;
	font-family: inherit;
	font-size: 0.95em;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.1s ease;
}

.icti-as-form .icti-as-file-btn:hover {
	background: rgba(9, 93, 228, 0.06);
}

.icti-as-form .icti-as-file-btn:active {
	transform: scale(0.98);
}

.icti-as-form .icti-as-file-btn-icon {
	flex-shrink: 0;
	color: #095de4;
}

.icti-as-form .icti-as-file-btn-text {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 400px;
}

.icti-as-form .icti-as-file-label input[type="file"] {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.icti-as-form .icti-as-file-error {
	display: block;
	margin-top: 8px;
	font-size: 0.9em;
	color: #c00;
}

/* Выпадающий список «Секция конференции» — как у текстовых полей */
.icti-as-form .publication-info select {
	width: 100%;
	box-sizing: border-box;
	min-height: 44px;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.5;
	color: #000;
	font-family: inherit;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 15px;
	padding: 8px 32px 8px 10px;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(0,0,0,0.45)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	cursor: pointer;
	outline: 0;
	-webkit-appearance: none;
	appearance: none;
}

.icti-as-form .publication-info select:focus {
	border-color: rgba(0, 0, 0, 0.35);
}

/* Согласие на обработку персональных данных */
.icti-as-consent-wrap {
	margin-top: 24px;
	margin-bottom: 0;
}

.icti-as-consent-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	font-size: 14px;
	line-height: 1.5;
	color: #252525;
}

.icti-as-consent-input {
	flex-shrink: 0;
	margin-top: 3px;
}

.icti-as-consent-text {
	flex: 1;
}

.icti-as-consent-text a {
	color: #095de4;
	text-decoration: underline;
}

.icti-as-consent-text a:hover {
	text-decoration: none;
}

/* Submit button block */
.icti-as-submit-wrap {
	margin-top: 20px;
	margin-bottom: 0;
}

/* Messages */
.icti-as-message {
	margin-bottom: 25px;
}

.icti-as-message_success {
	border-color: #095de4;
	color: #095de4;
}

.icti-as-message_error {
	border-color: #c00;
	color: #c00;
}

/* Success popup — поверх формы */
.icti-as-popup {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.icti-as-popup__backdrop {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: rgba(0, 0, 0, 0.5);
}

.icti-as-popup__box {
	position: relative;
	background: #fff;
	border-radius: 15px;
	padding: 32px 40px;
	max-width: 440px;
	width: 100%;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.icti-as-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	background: transparent;
	font-size: 28px;
	line-height: 1;
	color: #666;
	cursor: pointer;
	transition: color 0.2s ease;
}

.icti-as-popup__close:hover {
	color: #252525;
}

.icti-as-popup__title {
	margin: 0 0 20px;
	font-size: 22px;
	font-weight: 500;
	line-height: 1.4;
	color: #095de4;
}

.icti-as-popup__title_success {
	text-align: center;
	margin-top: 16px;
}

.icti-as-popup__actions {
	margin: 24px 0 0;
	text-align: center;
}

.icti-as-popup__btn-home {
	display: inline-block;
	text-decoration: none;
}

/* Состояние: загрузка */
.icti-as-popup__state_loading {
	text-align: center;
	padding: 8px 0 0;
}

.icti-as-popup__loader {
	width: 48px;
	height: 48px;
	margin: 0 auto 20px;
	border: 4px solid #e8e8e8;
	border-top-color: #095de4;
	border-radius: 50%;
	animation: icti-as-spin 0.9s linear infinite;
}

@keyframes icti-as-spin {
	to { transform: rotate(360deg); }
}

.icti-as-popup__loading-text {
	margin: 0;
	font-size: 18px;
	font-weight: 500;
	color: #252525;
}

/* Состояние: успех — зелёный круг с галочкой */
.icti-as-popup__state_success {
	text-align: center;
}

.icti-as-popup__success-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	background: #2e7d32;
	border-radius: 50%;
	color: #fff;
	box-sizing: border-box;
}

.icti-as-popup__success-check {
	width: 32px;
	height: 32px;
	stroke: #fff;
}

/* Snackbar (Material-like) — справа снизу */
.icti-as-snackbar-container {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 10001;
	display: flex;
	flex-direction: column;
	gap: 8px;
	pointer-events: none;
}

.icti-as-snackbar-container > * {
	pointer-events: auto;
}

.icti-as-snackbar {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 288px;
	max-width: 568px;
	padding: 14px 16px;
	background: #323232;
	color: #fff;
	border-radius: 4px;
	box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);
	font-size: 14px;
	line-height: 1.4;
	transform: translateX(120%);
	opacity: 0;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.icti-as-snackbar_visible {
	transform: translateX(0);
	opacity: 1;
}

.icti-as-snackbar__message {
	flex: 1;
}

.icti-as-snackbar__close {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	padding: 0;
	border: none;
	background: transparent;
	color: rgba(255, 255, 255, 0.8);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.2s ease;
}

.icti-as-snackbar__close:hover {
	color: #fff;
}

/* Responsive: single column on small screens */
@media screen and (max-width: 768px) {
	.icti-as-authors-fields {
		grid-template-columns: 1fr;
		grid-template-rows: repeat(8, auto);
	}

	.icti-as-authors-row_first .fields-block:nth-child(1) { grid-column: 1; grid-row: 1; }
	.icti-as-authors-row_first .fields-block:nth-child(2) { grid-column: 1; grid-row: 2; }
	.icti-as-authors-row_first .fields-block:nth-child(3) { grid-column: 1; grid-row: 3; }
	.icti-as-authors-row_second .fields-block:nth-child(1) { grid-column: 1; grid-row: 4; }
	.icti-as-authors-row_second .fields-block:nth-child(2) { grid-column: 1; grid-row: 5; }
	.icti-as-authors-row_third .fields-block:nth-child(1) { grid-column: 1; grid-row: 6; }
	.icti-as-authors-row_third .icti-as-responsible-cell { grid-column: 1; grid-row: 7; }
	.icti-as-authors-row_third .icti-as-remove-cell { grid-column: 1; grid-row: 8; justify-self: start; }

	.icti-as-form .publication-form__button_remove,
	.icti-as-form .publication-form__button {
		min-height: 44px;
		padding: 12px 24px;
	}
}

@media screen and (max-width: 480px) {
	.icti-as-form .publication-form__authors .section-border.icti-as-author-block {
		padding: 15px;
	}

	.icti-as-form .icti-as-submit-wrap .publication-form__button {
		width: 100%;
		min-height: 48px;
	}
}

@media screen and (max-width: 400px) {
	.icti-as-form .publication-form__authors .section-border.icti-as-author-block {
		padding: 12px;
	}
}

@media screen and (max-width: 320px) {
	.icti-as-form .section-border {
		padding: 15px;
	}
}

@media screen and (max-width: 480px) {
	.icti-as-popup__box {
		padding: 24px 20px;
	}

	.icti-as-snackbar-container {
		left: 16px;
		right: 16px;
		bottom: 16px;
		min-width: 0;
	}

	.icti-as-snackbar {
		min-width: 0;
		max-width: none;
	}
}
