/**
 * Y4C Smart Support — Chat Widget Styles
 */

/* FAB Button */
.y4c-chat-fab {
	position: fixed;
	bottom: 1.5rem;
	right: 1.5rem;
	z-index: 9000;
	width: 3.5rem;
	height: 3.5rem;
	border-radius: 50%;
	border: none;
	background: linear-gradient(135deg, hsl(220, 35%, 22%), hsl(220, 40%, 15%));
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(30, 40, 60, 0.35);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s, box-shadow 0.2s;
}

.y4c-chat-fab:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 24px rgba(30, 40, 60, 0.45);
}

.y4c-chat-fab__icon--close { display: none; }
.y4c-chat-fab.is-open .y4c-chat-fab__icon--chat { display: none; }
.y4c-chat-fab.is-open .y4c-chat-fab__icon--close { display: block; }

/* Chat Panel */
.y4c-chat-panel {
	display: none;
	position: fixed;
	bottom: 5.5rem;
	right: 1.5rem;
	z-index: 9001;
	width: 370px;
	max-width: calc(100vw - 2rem);
	height: 520px;
	max-height: calc(100vh - 8rem);
	background: #fff;
	border-radius: 1rem;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
	flex-direction: column;
	overflow: hidden;
	font-family: 'Noto Kufi Arabic', 'Segoe UI', sans-serif;
}

.y4c-chat-panel.is-open {
	display: flex;
	animation: y4c-chat-slide-up 0.25s ease;
}

@keyframes y4c-chat-slide-up {
	from { opacity: 0; transform: translateY(20px) scale(0.95); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.y4c-chat-panel__header {
	background: linear-gradient(135deg, hsl(220, 35%, 22%), hsl(220, 40%, 15%));
	color: #fff;
	padding: 1rem 1.25rem;
	flex-shrink: 0;
}

.y4c-chat-panel__header-info {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.y4c-chat-panel__avatar {
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background: hsla(0, 0%, 100%, 0.15);
	display: flex;
	align-items: center;
	justify-content: center;
}

.y4c-chat-panel__name {
	font-size: 0.9375rem;
	font-weight: 700;
}

.y4c-chat-panel__status {
	font-size: 0.75rem;
	opacity: 0.8;
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.y4c-chat-panel__dot {
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
}

/* Messages */
.y4c-chat-panel__messages {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	background: hsl(35, 20%, 97%);
}

.y4c-chat-msg {
	display: flex;
	max-width: 85%;
}

.y4c-chat-msg--bot {
	align-self: flex-start;
}

.y4c-chat-msg--user {
	align-self: flex-end;
}

.y4c-chat-msg__bubble {
	padding: 0.625rem 0.875rem;
	border-radius: 0.875rem;
	font-size: 0.875rem;
	line-height: 1.6;
	word-wrap: break-word;
}

.y4c-chat-msg--bot .y4c-chat-msg__bubble {
	background: #fff;
	color: hsl(220, 25%, 18%);
	border-bottom-left-radius: 0.25rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.y4c-chat-msg--user .y4c-chat-msg__bubble {
	background: hsl(28, 65%, 45%);
	color: #fff;
	border-bottom-right-radius: 0.25rem;
}

/* Typing indicator */
.y4c-chat-msg--typing .y4c-chat-msg__bubble {
	display: flex;
	gap: 0.25rem;
	padding: 0.75rem 1rem;
}

.y4c-typing-dot {
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: hsl(220, 10%, 60%);
	animation: y4c-typing 1.2s infinite;
}

.y4c-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.y4c-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes y4c-typing {
	0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
	30% { opacity: 1; transform: scale(1); }
}

/* Escalation buttons */
.y4c-chat-panel__escalation {
	padding: 0.75rem 1rem;
	display: flex;
	gap: 0.5rem;
	border-top: 1px solid hsl(35, 15%, 90%);
	background: #fff;
	flex-shrink: 0;
}

.y4c-chat-panel__esc-btn {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	padding: 0.625rem;
	border-radius: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	text-decoration: none;
	border: none;
	transition: all 0.2s;
}

.y4c-chat-panel__esc-btn--wa {
	background: #25D366;
	color: #fff;
}

.y4c-chat-panel__esc-btn--wa:hover {
	background: #1fb855;
	color: #fff;
}

.y4c-chat-panel__esc-btn--email {
	background: hsl(28, 65%, 45%);
	color: #fff;
}

.y4c-chat-panel__esc-btn--email:hover {
	background: hsl(28, 70%, 38%);
}

/* Email form */
.y4c-chat-panel__email-form {
	padding: 0.75rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	border-top: 1px solid hsl(35, 15%, 90%);
	background: #fff;
	flex-shrink: 0;
}

.y4c-chat-panel__email-form input,
.y4c-chat-panel__email-form textarea {
	border: 1px solid hsl(35, 15%, 88%);
	border-radius: 0.375rem;
	padding: 0.5rem 0.75rem;
	font-size: 0.8125rem;
	font-family: inherit;
	outline: none;
	resize: none;
	transition: border-color 0.2s;
}

.y4c-chat-panel__email-form input:focus,
.y4c-chat-panel__email-form textarea:focus {
	border-color: hsl(28, 65%, 45%);
}

.y4c-chat-panel__send-email {
	background: hsl(28, 65%, 45%);
	color: #fff;
	border: none;
	border-radius: 0.375rem;
	padding: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.2s;
}

.y4c-chat-panel__send-email:hover {
	background: hsl(28, 70%, 38%);
}

/* Input area */
.y4c-chat-panel__input {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	border-top: 1px solid hsl(35, 15%, 90%);
	background: #fff;
	flex-shrink: 0;
}

.y4c-chat-panel__input input {
	flex: 1;
	border: 1px solid hsl(35, 15%, 88%);
	border-radius: 1.5rem;
	padding: 0.5rem 1rem;
	font-size: 0.875rem;
	font-family: inherit;
	outline: none;
	transition: border-color 0.2s;
}

.y4c-chat-panel__input input:focus {
	border-color: hsl(28, 65%, 45%);
}

.y4c-chat-panel__input button {
	width: 2.25rem;
	height: 2.25rem;
	border: none;
	background: hsl(28, 65%, 45%);
	color: #fff;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	flex-shrink: 0;
}

.y4c-chat-panel__input button:hover {
	background: hsl(28, 70%, 38%);
}

/* Hide old WhatsApp FAB if still present */
.y4c-whatsapp-fab {
	display: none !important;
}

/* Mobile */
@media (max-width: 480px) {
	.y4c-chat-panel {
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		max-height: 100vh;
		border-radius: 0;
	}

	.y4c-chat-fab {
		bottom: 1rem;
		right: 1rem;
	}
}
