/* ==========================================================================
   Components: buttons, inputs, chips, tags, cards, accordion, slider,
   pagination, modal, forms, share.
   ========================================================================== */

/* ---------- Buttons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 50px;
	padding: 12px 30px;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	color: #fff;
	background: var(--accent);
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	box-shadow: var(--accent-glow);
	transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.1s;
	white-space: nowrap;
}

.btn:hover {
	background: var(--accent-hover);
	border-color: var(--accent-hover);
}

.btn:active {
	transform: translateY(1px);
}

.btn:disabled,
.btn.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.btn--lg {
	font-size: 20px;
	padding: 12px 40px;
}

.btn--sm {
	font-size: 16px;
	padding: 12px 24px;
}

.btn--block {
	width: 100%;
}

.btn--outline {
	color: var(--accent);
	background: transparent;
	box-shadow: none;
}

.btn--outline:hover {
	color: #fff;
	background: var(--accent);
}

.btn--ghost {
	color: var(--text);
	background: transparent;
	border-color: var(--line-soft);
	box-shadow: none;
}

.btn--ghost:hover {
	color: var(--accent);
	background: transparent;
	border-color: var(--accent);
}

.btn--glass {
	color: #fff;
	background: linear-gradient(176deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 100%);
	border-color: rgba(255, 255, 255, 0.2);
	box-shadow: none;
	backdrop-filter: blur(21px);
}

.btn--glass:hover {
	background: rgba(255, 255, 255, 0.15);
	border-color: rgba(255, 255, 255, 0.4);
}

.btn--grey {
	color: #fff;
	background: var(--text-muted);
	border-color: var(--text-muted);
	box-shadow: none;
}

.btn--header {
	min-height: 50px;
	padding: 12px 20px;
}

/* Square icon button (share, favourites) */
.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	flex: none;
	color: var(--accent);
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	transition: background 0.2s, color 0.2s;
}

.icon-btn .icon {
	width: 24px;
	height: 24px;
}

.icon-btn:hover {
	color: #fff;
	background: var(--accent);
}

/* Favourite star */
.fav-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 39px;
	height: 39px;
	color: var(--accent);
	background: transparent;
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	transition: background 0.2s;
}

.fav-btn .icon {
	width: 39px;
	height: 39px;
}

.fav-btn:hover,
.fav-btn.is-active {
	background: var(--accent-soft);
	border-color: transparent;
}

.fav-btn.is-active .icon path {
	fill: currentColor;
}

/* ---------- Inputs ---------- */

.input {
	display: block;
	width: 100%;
	/* У макеті поле рівно 50px: line-height + padding + рамка дають саме 50. */
	min-height: 50px;
	padding: 13px 20px;
	line-height: 22px;
	font-size: 16px;
	font-weight: 300;
	color: var(--text);
	background: var(--bg-input);
	border: 1px solid var(--line-input);
	border-radius: var(--radius);
	transition: border-color 0.2s;
	appearance: none;
}

.input::placeholder {
	color: var(--text-placeholder);
	opacity: 0.9;
}

.input:focus {
	outline: none;
	border-color: var(--accent);
}

.input.is-invalid {
	border-color: var(--danger);
}

.input--area {
	min-height: 120px;
	resize: vertical;
}

.input--dark {
	color: #fff;
	background: transparent;
	border-color: rgba(229, 229, 229, 0.1);
}

.input--dark::placeholder {
	color: #a4a4a4;
}

.input--dark:focus {
	border-color: var(--accent);
}

.select {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 16px;
	font-weight: 300;
	color: var(--text);
	cursor: pointer;
}

.select select {
	appearance: none;
	background: transparent;
	border: 0;
	padding-right: 22px;
	font-weight: 500;
	cursor: pointer;
	color: inherit;
}

.select select:focus {
	outline: none;
}

.select .icon {
	position: absolute;
	right: 0;
	width: 14px;
	height: 14px;
	pointer-events: none;
	color: var(--text);
}

/* Custom checkbox (KB filters) */
.check {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 17px;
	color: var(--text-muted);
	cursor: pointer;
}

.check input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.check__box {
	position: relative;
	width: 20px;
	height: 20px;
	flex: none;
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	background: var(--bg-input);
}

.check__box::after {
	content: "";
	position: absolute;
	inset: 4px;
	border-radius: 2px;
	background: var(--accent);
	opacity: 0;
	transition: opacity 0.15s;
}

.check input:checked + .check__box::after {
	opacity: 1;
}

.check input:checked ~ span:last-child {
	color: var(--accent);
}

.check input:focus-visible + .check__box {
	outline: 2px solid var(--accent);
}

/* ---------- Chips (radio / toggle) ---------- */

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
}

.chip {
	position: relative;
	display: inline-flex;
	align-items: center;
	min-height: 35px;
	padding: 6px 15px;
	font-size: 15px;
	line-height: 22px;
	color: #fff;
	background: rgba(104, 112, 130, 0.5);
	border-radius: 3px;
	cursor: pointer;
	transition: background 0.2s;
	user-select: none;
}

.chip input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.chip:hover {
	background: var(--text-muted);
}

.chip:has(input:checked),
.chip.is-active {
	background: var(--accent);
}

.chip:has(input:focus-visible) {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Outlined chips (services / calculator filters) */
.chip--outline {
	color: var(--accent);
	background: transparent;
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	font-size: 15px;
	font-weight: 500;
	padding: 6px 15px;
}

.chip--outline:hover {
	background: var(--accent-soft);
}

.chip--outline:has(input:checked),
.chip--outline.is-active {
	color: #fff;
	background: var(--accent);
}

/* Hash tags */
.tags {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
}

.tag {
	display: inline-flex;
	align-items: center;
	height: 35px;
	padding: 0 15px;
	font-size: 19px;
	font-weight: 500;
	line-height: 22px;
	color: var(--accent);
	background: var(--bg-chip);
	border-radius: 3px;
	transition: background 0.2s, color 0.2s;
}

.tag:hover {
	color: #fff;
	background: var(--accent);
}

@media (max-width: 767px) {
	.tags {
		gap: 10px;
	}

	.tag {
		font-size: 15px;
	}

	.chips {
		gap: 10px;
	}
}

/* ---------- Accordion (нативні <details>/<summary>) ---------- */

summary {
	list-style: none;
	cursor: pointer;
}

summary::-webkit-details-marker {
	display: none;
}

details > summary .icon-chevron-down {
	transition: transform 0.25s;
}

details[open] > summary .icon-chevron-down {
	transform: rotate(180deg);
}

/* ---------- Slider (CSS scroll-snap) ---------- */

.slider {
	position: relative;
	overflow: hidden;
	/* Слайдів на екрані, як у старому JS: 1 (<768), 2 (768–1023),
	   3 (≥1024) — див. data-per="3" нижче. */
	--slider-per: 1;
}

.slider[data-per="3"] {
	--slider-per: 3;
}

@media (min-width: 768px) {
	.slider[data-per="3"] {
		--slider-per: 2;
	}
}

@media (min-width: 1024px) {
	.slider[data-per="3"] {
		--slider-per: 3;
	}
}

.slider__track {
	display: flex;
	gap: var(--slider-gap, 17px);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.slider__track::-webkit-scrollbar {
	display: none;
}

.slider__slide {
	flex: 0 0 calc((100% - (var(--slider-per, 3) - 1) * var(--slider-gap, 17px)) / var(--slider-per, 3));
	min-width: 0;
	scroll-snap-align: start;
}

.slider__arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	transform: translateY(-50%);
	color: #fff;
	background: rgba(0, 0, 0, 0.35);
	border-radius: 50%;
	transition: background 0.2s;
}

.slider__arrow .icon {
	width: 24px;
	height: 24px;
}

.slider__arrow:hover {
	background: var(--accent);
}

.slider__arrow--prev {
	left: 12px;
}

.slider__arrow--next {
	right: 12px;
}

.slider__arrow:disabled {
	opacity: 0.3;
	pointer-events: none;
}

.dots {
	display: flex;
	align-items: center;
	gap: 10px;
}

.dots__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--accent);
	opacity: 0.5;
	transition: transform 0.2s, opacity 0.2s;
}

.dots__dot.is-active {
	opacity: 1;
	transform: scale(1.4);
}

/* ---------- Pagination ---------- */

.pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: 40px;
}

.pagination__page,
.pagination__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	height: 30px;
	padding: 0 8px;
	font-size: 17px;
	line-height: 1;
	border-radius: 4px;
	transition: background 0.2s, color 0.2s;
}

.pagination__page:hover {
	color: var(--accent);
}

.pagination__page.is-active {
	color: #fff;
	background: var(--accent);
	box-shadow: 0 5px 20px 0 rgba(27, 150, 143, 0.2);
}

.pagination__arrow {
	width: 50px;
	height: 50px;
	background: #eff2f7;
	color: #212121;
}

.pagination__arrow .icon {
	width: 50px;
	height: 50px;
}

.pagination__arrow:disabled {
	opacity: 0.4;
	pointer-events: none;
}

.pagination__dots {
	letter-spacing: 2px;
	color: var(--text-muted);
}

/* ---------- Video card ---------- */

.video-card {
	position: relative;
	display: block;
	aspect-ratio: 385 / 257;
	border-radius: var(--radius-lg);
	overflow: hidden;
	background: var(--bg-placeholder);
}

.video-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s;
}

.video-card:hover .video-card__img {
	transform: scale(1.04);
}

.video-card__play {
	position: absolute;
	top: 50%;
	left: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	transform: translate(-50%, -50%);
	color: #fff;
	background: linear-gradient(153deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 100%);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	backdrop-filter: blur(21px);
}

.video-card__play .icon {
	width: 19px;
	height: 21px;
	margin-left: 3px;
}

/* ---------- Document card ---------- */

.doc-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
	padding: 20px 10px 0;
	border-top: 1px solid var(--line);
	border-radius: var(--radius-xl) var(--radius-xl) 0 0;
	/* Вся картка клікабельна — відкриває модалку документа (див. JS
	   document-browser.php); інтерактивні діти мають власні курсори. */
	cursor: pointer;
}

.doc-card__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.25;
	min-height: 2.5em;
}

.doc-grid--list .doc-card__title {
	-webkit-line-clamp: 3;
}

.doc-card__media {
	position: relative;
	aspect-ratio: 260 / 215;
	border-radius: var(--radius-lg);
	background: var(--bg-placeholder);
	overflow: hidden;
}

.doc-card__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 10px 40px;
}

.doc-card__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-light);
}

.doc-card__placeholder .icon {
	width: 100%;
	height: 100%;
}

.doc-card__media .fav-btn {
	position: absolute;
	top: 10px;
	right: 10px;
}

.doc-card__body {
	display: flex;
	flex-direction: column;
	gap: 20px;
	flex: 1;
}

.doc-card__cats {
	font-size: 17px;
	font-weight: 300;
	line-height: 25px;
}

.doc-card__cat {
	color: var(--accent);
	font-weight: 500;
}

.doc-card__text {
	font-size: 17px;
	font-weight: 300;
	line-height: 25px;
	flex: 1;
}

.doc-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 20px;
	align-items: center;
}

.doc-card__actions .btn {
	flex: 1 1 120px;
	min-width: 0;
	max-width: 190px;
	padding-inline: 16px;
}

/* List view */
.doc-grid--list .doc-card {
	display: grid;
	grid-template-columns: 200px 1fr;
	grid-template-areas:
		"media title"
		"media body";
	column-gap: 30px;
	row-gap: 15px;
	align-items: start;
	padding: 20px 20px 30px;
}

.doc-grid--list .doc-card__title {
	grid-area: title;
	min-height: 0;
	padding-right: 60px;
}

.doc-grid--list .doc-card__media {
	grid-area: media;
	aspect-ratio: 200 / 165;
}

.doc-grid--list .doc-card__media .fav-btn {
	top: 0;
	right: 0;
	position: absolute;
}

.doc-grid--list .doc-card__body {
	grid-area: body;
}

.doc-grid--list .doc-card {
	position: relative;
}

.doc-grid--list .doc-card .fav-btn {
	position: absolute;
	top: 20px;
	right: 20px;
}

/* У списку зірка кріпиться до картки, а не до прев'ю (як у макеті). */
.doc-grid--list .doc-card__media {
	position: static;
}

/* ---------- Modal (нативний <dialog>) ---------- */

/* Діалог на всю площу екрана: картка всередині (.modal__dialog), темне тло —
   ::backdrop. Відкритий — flex, закритий ховає UA-стиль (display: none). */
.modal {
	width: 100%;
	max-width: 100%;
	height: 100%;
	max-height: 100%;
	padding: 60px 20px;
	border: none;
	background: none;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.modal[open] {
	display: flex;
	align-items: flex-start;
	justify-content: center;
}

.modal::backdrop {
	background: var(--overlay);
}

.modal__dialog {
	position: relative;
	width: 100%;
	max-width: 1180px;
	margin: auto;
	animation: modal-in 0.25s ease;
}

.modal__close {
	position: absolute;
	/* Макет: іконка 23x23, права грань врівень з карткою, 30px над нею. */
	top: -53px;
	right: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 23px;
	height: 23px;
	color: #fff;
	transition: transform 0.2s;
}

/* Зона натискання більша за іконку. */
.modal__close::before {
	content: '';
	position: absolute;
	inset: -11px;
}

.modal__close .icon {
	width: 23px;
	height: 23px;
}

.modal__close:hover {
	transform: rotate(90deg);
}

.modal__box {
	position: relative;
	margin: 0 auto;
	padding: 40px;
	background: var(--bg-card);
	color: var(--text);
	border-radius: var(--radius-xl);
}

/* Картки повідомлень за макетом: «Доступ обмежено» 730 (README ряд. 53). */
.modal__box--message {
	max-width: 730px;
	padding: 50px 60px;
	text-align: center;
}

.modal__box--share {
	max-width: 525px;
	padding: 30px 40px;
	text-align: center;
}

/* «Заявку надіслано» (макет components.css:795–816, хвіст L10). */
.modal__box--sent {
	max-width: 525px;
	padding: 30px 27px 50px;
}

.modal__box--sent .modal__status {
	margin-bottom: 29px;
}

.modal__box--sent .modal__status .icon {
	width: 53px;
	height: 53px;
}

.modal__box--sent .modal__title {
	margin-bottom: 29px;
}

.modal__box--sent .modal__text {
	max-width: 470px;
	margin-bottom: 29px;
}

.modal__box--sent .btn {
	min-width: 238px;
}

.modal__box--auth,
.modal__box--request {
	max-width: 1180px;
	padding: 0;
	background: transparent;
}

/* У макеті попап замовлення — така сама картка 1181, як вхід і заявка. */
.modal__box--order {
	max-width: 1180px;
	padding: 0 60px;
}

.modal__box--video {
	max-width: 960px;
	padding: 10px;
	background: var(--accent);
}

.modal__box--doc {
	max-width: 1180px;
}

.modal__status {
	display: inline-flex;
	margin-bottom: 25px;
}

.modal__status .icon {
	width: 60px;
	height: 60px;
}

.modal__status--ok {
	color: var(--accent);
}

.modal__status--lock {
	color: var(--danger);
}

.modal__title {
	font-size: 40px;
	font-weight: 700;
	line-height: 1.2;
	margin-bottom: 25px;
}

.modal__title--sm {
	font-size: 25px;
	margin-bottom: 30px;
}

.modal__title--accent {
	color: var(--accent);
	font-size: 25px;
}

.modal__title--danger {
	color: var(--danger);
	text-transform: uppercase;
}

.modal__text {
	font-size: 20px;
	font-weight: 500;
	line-height: 30px;
	margin: 0 auto 35px;
	max-width: 600px;
}

.modal__box--message .modal__text {
	font-size: 18px;
	line-height: 25px;
}

.modal__actions {
	display: flex;
	justify-content: center;
	gap: 20px;
}

.modal__actions .btn {
	min-width: 238px;
}

@keyframes modal-in {
	from {
		opacity: 0;
		transform: translateY(20px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.embed {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: var(--radius-lg);
	overflow: hidden;
}

.embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Share */
.share {
	display: flex;
	justify-content: center;
	gap: 30px;
}

.share__btn {
	display: inline-flex;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	transition: transform 0.2s;
}

.share__btn .icon {
	width: 50px;
	height: 50px;
}

.share__btn:hover {
	transform: scale(1.1);
}

.share__hint {
	min-height: 24px;
	margin-top: 15px;
	font-size: 15px;
	color: var(--accent);
}

/* ---------- Forms ---------- */

.form {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.form__row {
	display: grid;
	gap: 20px;
}

.form__row--2 {
	grid-template-columns: 1fr 1fr;
}

.form__label {
	font-size: 18px;
	font-weight: 700;
	line-height: 22px;
}

.form__message {
	display: none;
	font-size: 15px;
	line-height: 1.4;
	margin: -5px 0 0;
}

.form__message.is-error {
	display: block;
	color: var(--danger);
}

.form__message.is-success {
	display: block;
	color: var(--accent);
}

.form__links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px 20px;
	font-size: 16px;
	font-weight: 500;
	color: var(--accent);
	text-align: center;
}

.form__links a:hover {
	text-decoration: underline;
}

.form__file {
	display: flex;
	align-items: center;
	gap: 20px;
	font-size: 15px;
	color: var(--text-muted);
}

.form__file input {
	position: absolute;
	width: 0;
	height: 0;
	opacity: 0;
}

.form__file .btn {
	min-height: 40px;
	padding: 8px 25px;
	font-size: 14px;
}

.notice {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	font-size: 15px;
	font-weight: 500;
	border: 1px dashed;
	border-radius: var(--radius);
}

.notice .icon {
	width: 16px;
	height: 16px;
}

.notice--ok {
	color: var(--accent);
	border-color: var(--accent);
	background: rgba(27, 150, 143, 0.06);
}

.notice--error {
	color: var(--danger);
	border-color: var(--danger);
	background: rgba(175, 0, 0, 0.05);
}

@media (max-width: 767px) {
	.form__row--2 {
		grid-template-columns: 1fr;
	}

	.modal {
		padding: 60px 15px 30px;
	}

	.modal__box {
		padding: 25px 20px;
	}

	/* Двоколонкові картки (вхід, заявка, замовлення) на мобільному займають
	   усю ширину діалогу — у них власні поля всередині. */
	.modal__box--auth,
	.modal__box--request,
	.modal__box--order {
		padding: 0;
	}

	.modal__box--message {
		padding: 35px 20px;
	}

	.modal__title {
		font-size: 26px;
	}

	.modal__text {
		font-size: 16px;
		line-height: 24px;
	}

	.modal__actions {
		flex-direction: column;
	}

	.modal__actions .btn {
		min-width: 0;
	}

	.share {
		gap: 15px;
	}

	.doc-card__actions .btn {
		max-width: none;
	}

	.btn {
		white-space: normal;
	}

	.btn--lg {
		font-size: 17px;
		padding-inline: 20px;
	}

	.doc-grid--list .doc-card {
		grid-template-columns: 1fr;
		grid-template-areas:
			"title"
			"media"
			"body";
	}
}
