/* Чат форума — панель у правого края экрана (parts/forum_chat.tpl, js/forum_chat.js). Префикс fc-.
   Данные — ajax/forum_chat.php (Mircs\Forum\ForumChat → REST API форума, аддон Mircs/Chat). */

.fc {
	--fc-w: 340px;
	--fc-bg: #1c1c1f;
	--fc-panel: #232327;
	--fc-line: rgba(255, 255, 255, .06);
	--fc-accent: #da9256;
	--fc-accent-hi: #eda162;
	--fc-muted: #8e8e98;

	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 1040; /* ниже модалок bootstrap (1050) */
	display: flex;
	flex-direction: column;
	width: var(--fc-w);
	background: var(--fc-bg);
	border-left: 1px solid var(--fc-line);
	box-shadow: -12px 0 40px rgba(0, 0, 0, .35);
	font-family: Montserrat, sans-serif;
	transform: translateX(0);
	transition: transform .3s ease;
}

.fc.is-closed {
	transform: translateX(100%);
	box-shadow: none;
}

/* на широких экранах сайт уезжает влево и панель ничего не закрывает */
@media (min-width: 1680px) {
	body.fc-open {
		padding-right: 340px;
	}
}

/* всплывающие уведомления сайта (noty, правый нижний угол) не закрывают чат: открыт справа — уведомления левее панели,
   на телефоне чат на весь экран — уведомления сверху (отступы noty ставит инлайн-стилем, поэтому !important) */
body.fc-open #noty_bottomRight_layout_container {
	right: calc(var(--fc-w, 340px) + 20px) !important;
}

body.fc-full #noty_bottomRight_layout_container {
	top: calc(12px + env(safe-area-inset-top)) !important;
	bottom: auto !important;
}

/* ---------- шапка ---------- */

.fc-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 16px 14px;
	border-bottom: 1px solid var(--fc-line);
}

.fc-head__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 36px;
	height: 36px;
	border-radius: 11px;
	background: linear-gradient(23deg, #995d2b 0%, #da9256 55%);
	color: #fff;
	font-size: 18px;
}

.fc-head__text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.25;
}

.fc-head__title {
	font-family: 'Exo 2', Montserrat, sans-serif;
	font-size: 16px;
	font-weight: 800;
	font-style: italic;
	text-transform: uppercase;
	color: #fff;
}

.fc-head__sub {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--fc-muted);
	font-size: 11px;
	font-weight: 600;
}

.fc-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #3ecf6e;
	box-shadow: 0 0 8px #3ecf6e;
}

.fc-head__actions {
	display: flex;
	gap: 6px;
	margin-left: auto;
}

.fc-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 1px solid var(--fc-line);
	border-radius: 10px;
	background: var(--fc-panel);
	color: var(--fc-muted) !important;
	font-size: 17px;
	cursor: pointer;
	transition: color .2s ease, border-color .2s ease;
}

.fc-btn:hover {
	color: #fff !important;
	border-color: rgba(218, 146, 86, .4);
}

/* ---------- лента ---------- */

.fc-list {
	flex: 1 1 auto;
	margin: 0;
	padding: 10px 12px 14px;
	overflow-y: auto;
	list-style: none;
	scrollbar-width: thin;
	scrollbar-color: #3a3a40 transparent;
	overscroll-behavior: contain;
}

.fc-msg {
	display: grid;
	grid-template-columns: 34px minmax(0, 1fr);
	column-gap: 10px;
	padding: 8px 6px 2px;
	border-radius: 12px;
}

.fc-msg:hover {
	background: rgba(255, 255, 255, .025);
}

/* подряд от одного человека — без аватара и ника */
.fc-msg.is-cont {
	padding-top: 0;
}

.fc-msg.is-cont .fc-msg__ava,
.fc-msg.is-cont .fc-msg__meta {
	display: none;
}

.fc-msg__ava {
	grid-row: span 2;
	width: 34px;
	height: 34px;
	border-radius: 10px;
	object-fit: cover;
	background: var(--fc-panel);
}

.fc-msg.is-cont .fc-msg__text {
	grid-column: 2;
}

.fc-msg__meta {
	display: flex;
	align-items: baseline;
	gap: 8px;
	min-width: 0;
}

.fc-msg__name {
	overflow: hidden;
	color: #e9e9ee !important;
	font-size: 12.5px;
	font-weight: 700;
	white-space: nowrap;
	text-overflow: ellipsis;
	text-decoration: none !important;
}

.fc-msg__time {
	flex: 0 0 auto;
	color: #6c6c75;
	font-size: 10.5px;
	font-weight: 600;
}

.fc-msg__text {
	padding-bottom: 6px;
	color: #c9c9d1;
	font-size: 12.5px;
	line-height: 1.45;
	overflow-wrap: anywhere;
}

/* цвета групп — как на форуме (username--styleN), тёмные подсвечены под тёмный фон */
.fc-u--red { color: #ff5f5f !important; }
.fc-u--blue { color: #6f8bff !important; }
.fc-u--pink { color: #ff69b4 !important; }
.fc-u--orange { color: #ffa53d !important; }
.fc-u--green { color: #4fd65a !important; }
.fc-u--cyan { color: #2cc0e6 !important; }
.fc-u--turq { color: #40e0d0 !important; }
.fc-u--olive { color: #b5b53a !important; }
.fc-u--yellow { color: #ffe14d !important; }
.fc-u--grey { color: #d6d6d6 !important; }

/* ---------- низ ---------- */

.fc-foot {
	padding: 10px 12px 14px;
	border-top: 1px solid var(--fc-line);
}

/* поле ввода — капсула с круглой «отправить», как в чате форума */
.fc-form {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 4px 4px 14px;
	border: 1px solid rgba(255, 255, 255, .09);
	border-radius: 999px;
	background: var(--fc-panel);
	transition: border-color .2s ease;
}

.fc-form:focus-within {
	border-color: rgba(218, 146, 86, .55);
}

.fc-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 36px;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	color: #f1f1f3;
	font: 500 13px/1.3 Montserrat, sans-serif;
}

.fc-input::placeholder {
	color: #6c6c75;
}

.fc-send {
	flex: 0 0 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, #c27a40 0%, #e3a165 100%);
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	transition: filter .2s ease, opacity .2s ease;
}

.fc-send:hover {
	filter: brightness(1.08);
}

.fc-send:disabled {
	opacity: .5;
	cursor: default;
}

.fc-foot__note {
	margin-top: 8px;
	color: #6c6c75;
	font-size: 11px;
	line-height: 1.4;
	text-align: center;
}

.fc-foot__note a {
	color: var(--fc-accent-hi) !important;
}

.fc-foot__note.is-error {
	color: #f08f8f;
}

/* гостю — кнопка входа вместо поля */
.fc-login {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 42px;
	border-radius: 12px;
	background: linear-gradient(135deg, #c27a40 0%, #e3a165 100%);
	color: #fff !important;
	font-size: 13px;
	font-weight: 700;
	text-decoration: none !important;
}

/* ---------- сообщения: свои, содержимое, состояния ---------- */

.fc-msg.is-own .fc-msg__name::after {
	content: " · вы";
	color: var(--fc-muted);
	font-weight: 600;
}

.fc-msg.is-own .fc-msg__text {
	color: #f3e2d3;
}

.fc-msg.is-pending {
	opacity: .55;
}

.fc-msg__text .bbWrapper {
	display: inline;
}

.fc-msg__text a {
	color: var(--fc-accent-hi) !important;
}

.fc-msg__text a.username {
	color: #f1f1f3 !important;
	font-size: inherit !important;
	font-weight: 700;
}

/* упоминание: мини-аватар у ника */
.fc-msg__text a.avatar {
	display: inline-block;
	vertical-align: -4px;
	margin-right: 2px;
}

.fc-msg__text a.avatar img {
	width: 18px !important;
	height: 18px !important;
	max-height: none !important;
	border-radius: 50% !important;
	object-fit: cover;
}

/* смайлы форума (JoyPixels) и картинки */
.fc-msg__text img.smilie,
.fc-msg__text img.emoji {
	width: 20px;
	height: 20px;
	vertical-align: -5px;
}

.fc-msg__text img:not(.smilie):not(.emoji):not([class^="avatar-"]) {
	max-width: 100%;
	max-height: 180px;
	border-radius: 8px;
}

/* ---------- реакции (те же, что в чате форума) ---------- */

.fc-msg {
	position: relative;
}

.fc-reacts {
	grid-column: 2;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	padding-bottom: 6px;
}

.fc-react {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 24px;
	padding: 0 7px 0 4px;
	border: 1px solid rgba(255, 255, 255, .08);
	border-radius: 999px;
	background: var(--fc-panel);
	color: #c9c9d1;
	font: 700 11px/1 Montserrat, sans-serif;
	cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease;
}

.fc-react img {
	width: 18px;
	height: 18px;
}

.fc-react:hover:not(:disabled) {
	border-color: rgba(218, 146, 86, .45);
}

.fc-react:disabled {
	cursor: default;
}

.fc-react.is-mine {
	border-color: rgba(218, 146, 86, .7);
	background: rgba(218, 146, 86, .16);
	color: #f3c79f;
}

.fc-react-add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--fc-muted);
	font-size: 16px;
	cursor: pointer;
	opacity: 0;
	transition: opacity .15s ease, background-color .15s ease, color .15s ease;
}

/* кнопка «реакция» — при наведении на сообщение; на тач-экранах — всегда */
.fc-msg:hover .fc-react-add,
.fc-react-add:focus-visible {
	opacity: 1;
}

@media (hover: none) {
	.fc-react-add {
		opacity: .7;
	}
}

.fc-react-add:hover {
	background: var(--fc-panel);
	color: #fff;
}

/* у сообщения без реакций — кнопка не занимает строку: справа сверху */
.fc-reacts:has(> .fc-react-add:only-child) {
	position: absolute;
	top: 6px;
	right: 6px;
	padding: 0;
}

.fc-pop {
	position: absolute;
	right: 6px;
	bottom: calc(100% - 6px);
	z-index: 3;
	display: flex;
	gap: 2px;
	padding: 4px;
	border: 1px solid rgba(255, 255, 255, .1);
	border-radius: 999px;
	background: #26262b;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

.fc-pop button {
	display: flex;
	padding: 3px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: transform .12s ease, background-color .12s ease;
}

.fc-pop button:hover {
	background: rgba(255, 255, 255, .06);
	transform: scale(1.18);
}

/* упомянули именинника — тортик у ника (на такие сообщения салют срабатывает и при наведении) */
.fc-msg__text a.username.is-bday::after {
	content: " 🎂";
}

.fc-empty {
	padding: 30px 10px;
	color: var(--fc-muted);
	font-size: 12.5px;
	text-align: center;
	list-style: none;
}

.fc-new {
	position: absolute;
	left: 50%;
	bottom: 86px;
	z-index: 2;
	display: none;
	padding: 6px 12px;
	border: 0;
	border-radius: 999px;
	background: #da9256;
	color: #fff;
	font: 700 11.5px/1.2 Montserrat, sans-serif;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
	transform: translateX(-50%);
	cursor: pointer;
}

.fc-new.is-visible {
	display: block;
}

.fc-tab b:empty {
	display: none;
}

/* ---------- язычок свёрнутой панели ---------- */

.fc-tab {
	position: fixed;
	top: 50%;
	right: 0;
	z-index: 1039;
	display: none;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 14px 8px;
	border: 1px solid rgba(218, 146, 86, .35);
	border-right: 0;
	border-radius: 14px 0 0 14px;
	background: #1c1c1f;
	color: #fff;
	cursor: pointer;
	transform: translateY(-50%);
	box-shadow: -6px 0 24px rgba(0, 0, 0, .35);
}

.fc-tab i {
	color: #eda162;
	font-size: 20px;
}

.fc-tab span {
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .5px;
	text-transform: uppercase;
}

.fc-tab b {
	min-width: 20px;
	padding: 2px 5px;
	border-radius: 10px;
	background: #da9256;
	font-size: 10px;
	text-align: center;
}

.fc-tab.is-visible {
	display: flex;
}

/* ---------- телефон/планшет: кнопка и чат на весь экран ---------- */

@media (max-width: 991px) {
	.fc {
		width: 100%;
		border-left: 0;
	}

	.fc-tab {
		top: auto;
		bottom: 18px;
		right: 16px;
		width: 54px;
		height: 54px;
		padding: 0;
		justify-content: center;
		border: 1px solid rgba(218, 146, 86, .45);
		border-radius: 50%;
		transform: none;
	}

	.fc-tab span {
		display: none;
	}

	.fc-tab b {
		position: absolute;
		top: -4px;
		right: -4px;
	}

	/* над нижней панелью вкладок (css/header.css), у вошедших */
	body:has(.hdr-tabs) .fc-tab {
		bottom: calc(80px + env(safe-area-inset-bottom));
	}

	/* открытый чат на весь экран — выше нижней панели вкладок; поле ввода над безопасной зоной iPhone */
	.fc {
		z-index: 1045;
	}

	.fc-foot {
		padding-bottom: calc(14px + env(safe-area-inset-bottom));
	}

	.fc-input {
		font-size: 16px; /* меньше 16 px — Safari приближает экран при фокусе */
	}
}
