/*
 * Live-чат поддержки Калужской филармонии — стили виджета.
 * Все классы с префиксом pc- (phil chat), чтобы не пересекаться с сайтом.
 */

#phil-chat-root {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	font-family: inherit;
	display: none;
}
#phil-chat-root.pc-ready { display: block; }

/*--- Кнопка-пузырь ---*/
.pc-bubble {
	position: relative;
	width: 62px;
	height: 62px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: #c62026;
	box-shadow: 0 4px 18px rgba(198, 32, 38, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease, background 0.15s ease;
}
.pc-bubble:hover { transform: scale(1.06); background: #a81a20; }
.pc-bubble svg { margin-left: 2px; }
.pc-bubble-active { background: #333; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }

.pc-bubble-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 22px;
	height: 22px;
	padding: 0 5px;
	border-radius: 11px;
	background: #ff9800;
	color: #fff;
	font-size: 13px;
	font-weight: bold;
	line-height: 22px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/*--- Панель ---*/
.pc-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 360px;
	max-width: calc(100vw - 24px);
	height: 520px;
	max-height: calc(100vh - 110px);
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 44px rgba(0, 0, 0, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.pc-head {
	background: #c62026;
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex: 0 0 auto;
}
.pc-head-title {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
}
.pc-head-sub {
	display: block;
	font-size: 12px;
	font-weight: 400;
	opacity: 0.85;
	margin-top: 2px;
}
.pc-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 17px;
	cursor: pointer;
	opacity: 0.85;
	padding: 4px 6px;
}
.pc-close:hover { opacity: 1; }

.pc-offline {
	background: #fff6e5;
	color: #8a6d3b;
	font-size: 12.5px;
	line-height: 1.45;
	padding: 8px 14px;
	border-bottom: 1px solid #f3e2c0;
	flex: 0 0 auto;
}

/*--- Лента сообщений ---*/
.pc-feed {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 14px 12px;
	background: #f5f5f7;
	-webkit-overflow-scrolling: touch;
}

.pc-msg { margin-bottom: 10px; display: flex; }
.pc-msg-guest { justify-content: flex-end; }
.pc-msg-system { justify-content: center; }

.pc-bubble-msg {
	max-width: 82%;
	background: #fff;
	border-radius: 12px;
	padding: 8px 12px 6px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
	font-size: 14px;
	line-height: 1.45;
	color: #222;
	overflow-wrap: break-word;
}
.pc-msg-guest .pc-bubble-msg { background: #c62026; color: #fff; }
.pc-msg-system .pc-bubble-msg {
	background: #e8eaf0;
	color: #444;
	font-size: 12.5px;
	text-align: center;
	max-width: 92%;
	padding: 6px 12px;
}
.pc-msg-who {
	font-size: 11px;
	color: #999;
	margin-bottom: 2px;
}
.pc-msg-guest .pc-msg-who { color: rgba(255, 255, 255, 0.75); }
.pc-msg-time {
	font-size: 10.5px;
	color: #aaa;
	text-align: right;
	margin-top: 3px;
}
.pc-msg-guest .pc-msg-time { color: rgba(255, 255, 255, 0.7); }

.pc-msg-text { white-space: pre-wrap; }

.pc-msg-img {
	display: block;
	max-width: 100%;
	max-height: 220px;
	border-radius: 8px;
	margin: 2px 0 4px;
	cursor: pointer;
}
.pc-msg-video {
	display: block;
	max-width: 100%;
	max-height: 220px;
	border-radius: 8px;
	margin: 2px 0 4px;
}
.pc-msg-audio { width: 230px; max-width: 100%; display: block; margin: 2px 0; }
.pc-msg-file {
	display: inline-block;
	color: #1a5fb4;
	text-decoration: none;
	font-size: 13.5px;
	padding: 3px 0;
}
.pc-msg-guest .pc-msg-file { color: #fff; text-decoration: underline; }

.pc-error {
	margin: 0 auto 10px;
	max-width: 88%;
	background: #fdecea;
	color: #b71c1c;
	border: 1px solid #f5c6c2;
	border-radius: 8px;
	padding: 6px 10px;
	font-size: 12.5px;
	text-align: center;
}

/*--- Индикатор набора ---*/
.pc-typing {
	flex: 0 0 auto;
	display: flex;
	gap: 4px;
	padding: 4px 18px 8px;
	background: #f5f5f7;
}
.pc-typing[hidden] { display: none; }
.pc-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b6b6be;
	animation: pc-blink 1.2s infinite both;
}
.pc-typing span:nth-child(2) { animation-delay: 0.2s; }
.pc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pc-blink {
	0%, 80%, 100% { opacity: 0.3; }
	40% { opacity: 1; }
}

/*--- Кнопка вызова оператора ---*/
.pc-callbar {
	flex: 0 0 auto;
	padding: 8px 12px;
	background: #f5f5f7;
	text-align: center;
	border-top: 1px solid #e8e8ec;
}
.pc-call {
	background: #fff;
	color: #c62026;
	border: 1px solid #c62026;
	border-radius: 18px;
	padding: 7px 16px;
	font-size: 13px;
	cursor: pointer;
}
.pc-call:hover { background: #fdf0f0; }
.pc-call[disabled] { opacity: 0.5; cursor: default; }

/*--- Оценка ---*/
.pc-rating {
	flex: 0 0 auto;
	padding: 12px 14px;
	background: #f5f5f7;
	border-top: 1px solid #e8e8ec;
	text-align: center;
}
.pc-rating[hidden] { display: none; }
.pc-rating-title { font-size: 13.5px; color: #333; margin-bottom: 6px; }
.pc-rating-stars { font-size: 26px; letter-spacing: 6px; }
.pc-star {
	color: #d4d4da;
	cursor: pointer;
	transition: color 0.1s;
	user-select: none;
}
.pc-star:hover, .pc-star.on { color: #f5a623; }
.pc-rating-comment {
	width: 100%;
	box-sizing: border-box;
	margin-top: 8px;
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 6px 9px;
	font-size: 13px;
	resize: none;
	height: 54px;
}
.pc-rating-send {
	margin-top: 8px;
	background: #c62026;
	color: #fff;
	border: none;
	border-radius: 18px;
	padding: 8px 18px;
	font-size: 13px;
	cursor: pointer;
}
.pc-rating-send[disabled] { opacity: 0.6; }

/*--- Поле ввода ---*/
.pc-inputbar {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 2px;
	padding: 8px;
	background: #fff;
	border-top: 1px solid #e8e8ec;
	position: relative;
}
.pc-inputbar[hidden] { display: none; }

.pc-input {
	flex: 1 1 auto;
	border: none;
	outline: none;
	resize: none;
	font-size: 14px;
	line-height: 1.4;
	max-height: 96px;
	padding: 7px 6px;
	background: transparent;
	color: #222;
}

.pc-btn {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border: none;
	background: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 17px;
	line-height: 1;
	padding: 0;
	color: #888;
}
.pc-btn:hover { background: #f0f0f4; }
.pc-btn-send {
	background: #c62026;
	display: flex;
	align-items: center;
	justify-content: center;
}
.pc-btn-send:hover { background: #a81a20; }
.pc-btn-send svg { margin-left: 2px; }

.pc-btn-mic.pc-rec {
	background: #c62026;
	animation: pc-pulse 1s infinite;
	color: #fff;
}
@keyframes pc-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(198, 32, 38, 0.5); }
	50% { box-shadow: 0 0 0 8px rgba(198, 32, 38, 0); }
}

.pc-emoji-pop {
	position: absolute;
	bottom: 52px;
	left: 8px;
	width: 264px;
	max-height: 180px;
	overflow-y: auto;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
	padding: 8px;
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 2px;
	z-index: 2;
}
.pc-emoji-pop[hidden] { display: none; }
.pc-emoji-item {
	border: none;
	background: none;
	font-size: 20px;
	padding: 4px;
	cursor: pointer;
	border-radius: 6px;
}
.pc-emoji-item:hover { background: #f0f0f4; }

.pc-note {
	flex: 0 0 auto;
	text-align: center;
	font-size: 10.5px;
	color: #b0b0b8;
	padding: 4px 0 6px;
	background: #fff;
}

/*--- Мобильные ---*/
@media (max-width: 560px) {
	#phil-chat-root {
		right: 12px;
		bottom: 12px;
	}
	.pc-bubble { width: 56px; height: 56px; }
	.pc-panel {
		position: fixed;
		left: 8px;
		right: 8px;
		bottom: 78px;
		width: auto;
		max-width: none;
		height: auto;
		top: 64px;
		max-height: none;
	}
}

/*--- Печатная версия: чат не печатаем ---*/
@media print {
	#phil-chat-root { display: none !important; }
}
