/**
 * EMPORAS — Live chat
 * @package EMPORAS
 * @since   1.18.16
 */

.emporas-chat__btn--live {
	width: 100%;
	border: 0;
	background: var(--emporas-navy);
	font-family: inherit;
	cursor: pointer;
}

.emporas-chat__toggle { position: relative; }
.emporas-livechat__badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #D92D20;
	color: var(--white);
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
}

.emporas-chat.is-chatting .emporas-chat__panel {
	width: 340px;
	padding: 0;
	overflow: hidden;
}

.emporas-livechat[hidden],
.emporas-livechat [hidden],
.emporas-chat__menu[hidden] { display: none; }

.emporas-livechat {
	display: flex;
	flex-direction: column;
	max-height: min(560px, calc(100vh - 120px));
}

.emporas-livechat__head {
	flex: none;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 8px;
	background: var(--emporas-navy);
	color: var(--white);
}
.emporas-livechat__title {
	flex: 1;
	margin: 0;
	font-family: var(--font-display);
	font-size: 18px;
	font-weight: 700;
	color: var(--white);
}
.emporas-livechat__icon {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.emporas-livechat__icon:hover { background: rgba(255, 255, 255, 0.14); }
.emporas-livechat__close { display: none; }

/* Φόρμα έναρξης */
.emporas-livechat__start {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px;
	overflow-y: auto;
}
.emporas-livechat__field span {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	font-weight: 600;
	color: var(--emporas-navy);
}
.emporas-livechat__field input,
.emporas-livechat__field textarea,
.emporas-livechat__composer textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 9px 10px;
	border: 1px solid #C9CEDB;
	border-radius: 8px;
	background: var(--white);
	color: var(--graphite);
	font-family: inherit;
	font-size: 16px; /* Κάτω από 16px το iPhone κάνει zoom στο πεδίο. */
	line-height: 1.35;
}
.emporas-livechat__field textarea { resize: vertical; }
.emporas-livechat__field input:focus,
.emporas-livechat__field textarea:focus,
.emporas-livechat__composer textarea:focus {
	outline: 2px solid var(--emporas-steel-light);
	outline-offset: 0;
	border-color: var(--emporas-navy);
}
.emporas-livechat__hp {
	position: absolute;
	left: -9999px;
	width: 0;
	height: 0;
	overflow: hidden;
}
.emporas-livechat__consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 12px;
	line-height: 1.4;
	color: var(--graphite);
}
.emporas-livechat__consent input { flex: none; margin: 2px 0 0; }
.emporas-livechat__consent a { color: var(--emporas-navy); text-decoration: underline; }
.emporas-livechat__error {
	margin: 0;
	font-size: 13px;
	line-height: 1.4;
	color: #B42318;
}
.emporas-livechat__submit {
	min-height: 44px;
	border: 0;
	border-radius: 8px;
	background: var(--emporas-navy);
	color: var(--white);
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}
.emporas-livechat__submit:hover { background: var(--emporas-navy-light); }
.emporas-livechat__submit:disabled,
.emporas-livechat__composer button:disabled { opacity: 0.6; cursor: default; }

/* Συζήτηση */
.emporas-livechat__thread {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
}
.emporas-livechat__messages {
	flex: 1;
	min-height: 280px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	background: #F4F5F8;
	overflow-y: auto;
	overscroll-behavior: contain;
}
.emporas-livechat__note {
	margin: 0 0 4px;
	font-size: 12px;
	line-height: 1.45;
	color: var(--graphite);
	text-align: center;
}
.emporas-livechat__closed {
	margin: 4px 0 0;
	padding: 8px 11px;
	border-radius: 8px;
	background: #FEF3C7;
	color: #6B4E00;
	font-size: 13px;
	line-height: 1.4;
	text-align: center;
}
.emporas-livechat__msg {
	display: flex;
	flex-direction: column;
	max-width: 85%;
}
.emporas-livechat__msg--customer { align-self: flex-end; align-items: flex-end; }
.emporas-livechat__msg--agent { align-self: flex-start; align-items: flex-start; }
.emporas-livechat__bubble {
	padding: 8px 11px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.4;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.emporas-livechat__msg--customer .emporas-livechat__bubble { background: var(--emporas-navy); color: var(--white); border-bottom-right-radius: 4px; }
.emporas-livechat__msg--customer .emporas-livechat__bubble a { color: inherit; }
.emporas-livechat__msg--agent .emporas-livechat__bubble { background: var(--white); color: var(--graphite); border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.emporas-livechat__bubble a { text-decoration: underline; }
.emporas-livechat__msg time { margin-top: 2px; font-size: 11px; color: #6B7280; }

.emporas-livechat__thread > .emporas-livechat__error { padding: 8px 12px 0; }
.emporas-livechat__composer {
	flex: none;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	background: var(--white);
	border-top: 1px solid #E4E7EE;
}
.emporas-livechat__composer textarea { flex: 1; resize: none; overflow-y: auto; scrollbar-width: none; }
.emporas-livechat__composer button {
	flex: none;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: var(--emporas-navy);
	color: var(--white);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Στο κινητό η συζήτηση γεμίζει την οθόνη και προσαρμόζεται στο πληκτρολόγιο. */
@media (max-width: 768px) {
	.emporas-chat.is-chatting {
		top: var(--livechat-top, 0);
		right: 0;
		bottom: auto;
		left: 0;
		z-index: 9999; /* Πάνω από το header (9000) και το εικονίδιο cookies (9998). */
		height: var(--livechat-vh, 100dvh);
		gap: 0;
	}
	.emporas-chat.is-chatting .emporas-chat__launcher { display: none; }
	.emporas-chat.is-chatting .emporas-chat__panel {
		flex: 1;
		width: 100%;
		min-height: 0;
		border-radius: 0;
		box-shadow: none;
	}
	.emporas-chat.is-chatting .emporas-livechat { height: 100%; max-height: none; }
	.emporas-livechat__close { display: flex; }
	.emporas-livechat__messages { min-height: 0; }
}
