/* Обнуление базовых отступов */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	line-height: 1.6;
	color: #333;
	background-color: #f4f7f6;
}

/* Шапка сайта */
header {
	background-color: #17a3ea;
	color: white;
	padding: 20px;
	text-align: center;
}

/* Основной контейнер */
.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
}

/* Сетка для контента */
.content-grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 20px;
}

/* Главный блок */
main {
	background: white;
	padding: 30px;
	border-radius: 8px;
	box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

main h2 {
	margin-bottom: 15px;
}

/* Боковая панель (сайдбар) */
aside {
	background: #ffffff;
	padding: 20px;
	border-radius: 8px;
	box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* Подвал */
footer {
	background: #17a3ea;
	color: white;
	text-align: center;
	padding: 15px;
	margin-top: 40px;
}

/* Адаптивность для мобильных устройств (экраны менее 768px) */
@media (max-width: 768px) {
	.content-grid {
		grid-template-columns: 1fr; /* Колонки встают друг под друга */
	}

	main, aside {
		padding: 15px;
	}
}

/* Скрытие/показ экранов */
.hidden {
	display: none !important;
}

/* Экран регистрации/авторизации */
.auth-wrap {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #f4f7f6;
	padding: 20px;
	padding-top: calc(20px + env(safe-area-inset-top));
	padding-bottom: calc(20px + env(safe-area-inset-bottom));
	overflow-y: auto;
}

.auth-box {
	background: #fff;
	padding: 40px;
	border-radius: 8px;
	box-shadow: 0 4px 6px rgba(0,0,0,0.05);
	text-align: center;
	max-width: 360px;
	width: 100%;
	margin: auto;
}

.auth-box h2 {
	margin-bottom: 10px;
	color: #0076a3;
}

.auth-box p {
	color: #666;
	margin-bottom: 25px;
}

.auth-buttons {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.btn {
	padding: 12px 20px;
	border: none;
	border-radius: 6px;
	font-size: 16px;
	line-height: 1;
	font-family: inherit;
	cursor: pointer;
	transition: background-color 0.2s;
}

.btn-register {
	background-color: #17a3ea;
	color: #fff;
}

.btn-register:hover {
	background-color: #0e8bc8;
}

.btn-login {
	background-color: #17a3ea;
	color: #fff;
	border: 1px solid #1590d0;
}

.btn-login:hover {
	background-color: #0e8bc8;
}

.btn-back {
	background-color: #f5f5f5;
	color: #555;
	border: 1px solid #ddd;
}

.btn-back:hover {
	background-color: #eaeaea;
}

/* Форма авторизации */
.login-form {
	margin-top: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	text-align: left;
}

.login-form label {
	font-size: 14px;
	color: #333;
}

.login-form input {
	padding: 10px;
	border: 1px solid #c8d6ea;
	border-radius: 6px;
	font-size: 15px;
	width: 100%;
	box-sizing: border-box;
}

.login-form input:focus {
	outline: none;
	border-color: #0076a3;
}

.login-form .btn-submit {
	background-color: #17a3ea;
	color: #fff;
	margin-top: 5px;
}

.login-form .btn-submit:hover {
	background-color: #0e8bc8;
}

.login-error {
	color: #c0392b;
	font-size: 14px;
	text-align: center;
	margin-top: 5px;
}

/* Информационное уведомление об использовании cookie (все экраны).
   Куки функциональные, уведомление ничего не блокирует.
   Фиксировано внизу; padding-bottom учитывает safe-area на iOS.
   z-index 1160 — выше #notify-prompt (1150), ниже install-модалки (1200). */
.cookie-consent {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1160;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 16px;
	padding-bottom: calc(12px + env(safe-area-inset-bottom));
	background: #fff;
	box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
	font-size: 14px;
	color: #333;
}

.cookie-consent-text {
	margin: 0;
	line-height: 1.4;
}

.cookie-consent-btn {
	flex-shrink: 0;
	white-space: nowrap;
}

@media (max-width: 480px) {
	.cookie-consent {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}

	.cookie-consent-btn {
		width: 100%;
	}
}

/* Промпт включения уведомлений (контентный экран, после первого сообщения).
   Фиксирован внизу; padding-bottom учитывает safe-area на iOS. */
.notify-prompt {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1150;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 16px;
	padding-bottom: calc(12px + env(safe-area-inset-bottom));
	background: #fff;
	box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
	font-size: 14px;
	color: #333;
}

/* Авторское display перекрывает UA-стиль [hidden] — возвращаем скрытие */
.notify-prompt[hidden] {
	display: none;
}

.notify-prompt-text {
	margin: 0;
	line-height: 1.4;
}

.notify-prompt-actions {
	display: flex;
	flex-shrink: 0;
	gap: 8px;
}

.notify-prompt-actions .btn {
	white-space: nowrap;
}

@media (max-width: 480px) {
	.notify-prompt {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}

	.notify-prompt-actions {
		flex-direction: column;
	}

	.notify-prompt-actions .btn {
		width: 100%;
	}
}

/* Встроенный чат LiveChat (placeholder рендерит bitrix:imopenlines.livechat) */
.imopenlines-page-placeholder {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}

/* --- PWA: меню-шестерёнка --- */
.pwa-menu {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1000;
}

.pwa-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.pwa-menu-btn:hover,
.pwa-menu-btn:focus {
    background: #fff;
    transform: rotate(15deg);
}

/* Кнопка меню, перенесённая в шапку виджета livechat (script.js):
   три белые точки на фоне шапки вместо штатных кнопок оценить/история. */
.bx-livechat-control-box .pwa-menu {
    position: relative;
    top: auto;
    right: auto;
    z-index: 1;
    display: flex;
    align-items: center;
}

.bx-livechat-control-box .pwa-menu-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    color: #fff;
    box-shadow: none;
}

.bx-livechat-control-box .pwa-menu-btn:hover,
.bx-livechat-control-box .pwa-menu-btn:focus {
    background: rgba(255, 255, 255, 0.15);
    transform: none;
}

.bx-livechat-control-box .pwa-menu-dropdown {
    top: 44px;
    right: 0;
    z-index: 1200;
}

.pwa-menu-dropdown {
    position: fixed;
    top: 52px;
    right: 0;
    min-width: min(260px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
}

.pwa-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 15px;
    color: #333;
    cursor: pointer;
}

.pwa-menu-item:hover,
.pwa-menu-item:focus {
    background: #f0f7fb;
    color: #0076a3;
}

/* Кнопка «Установить приложение» под шестерёнкой — как штатная кнопка сайта (.btn .btn-register) */
.pwa-menu-install-btn {
    display: block;
    width: calc(100% - 24px);
    margin: 4px 12px 8px;
}

.pwa-menu-install-btn[hidden] {
    display: none;
}

/* Кнопка «Контакты» под шестерёнкой — блочная ссылка-кнопка на всю ширину */
.pwa-menu-contacts-btn {
    display: block;
    width: calc(100% - 24px);
    margin: 4px 12px 8px;
    text-align: center;
    text-decoration: none;
    padding: 11px 20px;
}

.pwa-menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.pwa-menu-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: #333;
}

.pwa-menu-label-icon {
    flex-shrink: 0;
}

.pwa-menu-note {
    padding: 8px 16px 12px;
    font-size: 13px;
    color: #777;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Переключатель уведомлений */
.pwa-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.pwa-switch-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pwa-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 24px;
    transition: background-color 0.2s;
}

.pwa-switch-slider:before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.pwa-switch-input:checked + .pwa-switch-slider {
    background-color: #17a3ea;
}

.pwa-switch-input:checked + .pwa-switch-slider:before {
    transform: translateX(20px);
}

.pwa-switch-input:disabled + .pwa-switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Авторские display-правила перекрывают UA-стиль [hidden] — возвращаем скрытие */
.pwa-modal[hidden],
.pwa-menu-item[hidden] {
    display: none;
}

/* --- PWA: модальное окно установки --- */
.pwa-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.pwa-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.pwa-modal-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    padding: 28px 24px;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.pwa-modal-title {
    margin: 0 0 12px;
    font-size: 20px;
    color: #222;
}

.pwa-modal-text {
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.5;
    color: #555;
}

.pwa-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pwa-modal-note {
    margin: 14px 0 0;
    font-size: 13px;
    color: #777;
    line-height: 1.4;
}
