/**
 * WeAI Chat Frontend Styles
 *
 * @package WeAI_Chat
 */

/* CSS Variables - can be overridden via inline styles */
:root {
	--weai-primary: #E91E8C;
	--weai-text: #1E1B4B;
	--weai-bg: #ffffff;
	--weai-user-bubble: #E91E8C;
	--weai-assistant-bubble: #f5f5f5;
	--weai-radius: 12px;
	--weai-font: inherit;
	--weai-max-height: 500px;
	--weai-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* Chat Container */
.weai-chat-container {
	display: flex;
	flex-direction: column;
	max-width: 600px;
	width: 100%;
	height: var(--weai-max-height);
	background: var(--weai-bg);
	border-radius: var(--weai-radius);
	box-shadow: var(--weai-shadow);
	overflow: hidden;
	font-family: var(--weai-font);
	color: var(--weai-text);
}

/* Chat Header */
.weai-chat-header {
	padding: 16px 20px;
	background: var(--weai-primary);
	color: #ffffff;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.weai-chat-header-content {
	display: flex;
	align-items: center;
	gap: 12px;
}

.weai-chat-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	overflow: hidden;
	background: rgba(255, 255, 255, 0.2);
	flex-shrink: 0;
}

.weai-chat-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.weai-chat-avatar-default {
	display: flex;
	align-items: center;
	justify-content: center;
}

.weai-chat-avatar-default svg {
	width: 24px;
	height: 24px;
	fill: #ffffff;
}

.weai-chat-persona-info {
	flex: 1;
}

.weai-chat-persona-name {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 4px 0;
}

.weai-chat-status {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	opacity: 0.9;
}

.weai-status-dot {
	width: 8px;
	height: 8px;
	background: #4ade80;
	border-radius: 50%;
	animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

/* Messages Container */
.weai-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	scroll-behavior: smooth;
}

.weai-chat-messages::-webkit-scrollbar {
	width: 6px;
}

.weai-chat-messages::-webkit-scrollbar-track {
	background: transparent;
}

.weai-chat-messages::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.1);
	border-radius: 3px;
}

.weai-chat-messages::-webkit-scrollbar-thumb:hover {
	background: rgba(0, 0, 0, 0.2);
}

/* Message Bubbles */
.weai-chat-message {
	display: flex;
	flex-direction: column;
	max-width: 80%;
	animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.weai-chat-message-user {
	align-self: flex-end;
	align-items: flex-end;
}

.weai-chat-message-assistant {
	align-self: flex-start;
	align-items: flex-start;
}

.weai-chat-message-content {
	padding: 12px 16px;
	border-radius: var(--weai-radius);
	word-wrap: break-word;
	line-height: 1.5;
}

.weai-chat-message-user .weai-chat-message-content {
	background: var(--weai-user-bubble);
	color: #ffffff;
}

.weai-chat-message-assistant .weai-chat-message-content {
	background: var(--weai-assistant-bubble);
	color: var(--weai-text);
}

.weai-chat-message-content p:first-child {
	margin-top: 0;
}

.weai-chat-message-content p:last-child {
	margin-bottom: 0;
}

.weai-chat-message-time {
	font-size: 11px;
	opacity: 0.6;
	margin-top: 4px;
	padding: 0 4px;
}

/* Typing Indicator */
.weai-chat-typing-indicator {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 16px;
	background: var(--weai-assistant-bubble);
	border-radius: var(--weai-radius);
	max-width: 60px;
	margin: 0 20px;
}

.weai-chat-typing-indicator span {
	width: 8px;
	height: 8px;
	background: var(--weai-text);
	opacity: 0.3;
	border-radius: 50%;
	animation: typing 1.4s ease-in-out infinite;
}

.weai-chat-typing-indicator span:nth-child(2) {
	animation-delay: 0.2s;
}

.weai-chat-typing-indicator span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typing {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.3;
	}
	30% {
		transform: translateY(-10px);
		opacity: 0.6;
	}
}

/* GDPR Consent Modal */
.weai-chat-consent-modal {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
}

.weai-chat-consent-content {
	background: var(--weai-bg);
	padding: 24px;
	border-radius: var(--weai-radius);
	max-width: 400px;
	margin: 20px;
	text-align: center;
}

.weai-chat-consent-content h3 {
	margin: 0 0 12px 0;
	color: var(--weai-text);
	font-size: 18px;
}

.weai-chat-consent-content p {
	margin: 0 0 20px 0;
	color: var(--weai-text);
	opacity: 0.8;
	font-size: 14px;
	line-height: 1.6;
}

.weai-chat-consent-buttons {
	display: flex;
	gap: 12px;
	justify-content: center;
}

.weai-chat-consent-buttons button {
	padding: 10px 20px;
	border-radius: calc(var(--weai-radius) / 2);
	border: none;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.weai-chat-consent-agree {
	background: var(--weai-primary);
	color: #ffffff;
}

.weai-chat-consent-agree:hover {
	opacity: 0.9;
}

.weai-chat-consent-anonymous {
	background: transparent;
	color: var(--weai-text);
	border: 1px solid rgba(0, 0, 0, 0.1);
}

.weai-chat-consent-anonymous:hover {
	background: rgba(0, 0, 0, 0.05);
}

/* Input Container */
.weai-chat-input-container {
	padding: 16px 20px;
	border-top: 1px solid rgba(0, 0, 0, 0.05);
	background: var(--weai-bg);
}

.weai-chat-form {
	display: flex;
	gap: 12px;
	align-items: flex-end;
}

.weai-chat-input {
	flex: 1;
	padding: 12px 16px;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: calc(var(--weai-radius) / 1.5);
	font-family: inherit;
	font-size: 14px;
	color: var(--weai-text);
	resize: none;
	max-height: 100px;
	overflow-y: auto;
	transition: border-color 0.2s ease;
}

.weai-chat-input:focus {
	outline: none;
	border-color: var(--weai-primary);
}

.weai-chat-input::placeholder {
	opacity: 0.5;
}

.weai-chat-send {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: none;
	background: var(--weai-primary);
	color: #ffffff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.weai-chat-send:hover {
	transform: scale(1.05);
}

.weai-chat-send:active {
	transform: scale(0.95);
}

.weai-chat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.weai-chat-send svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

/* Error Message */
.weai-chat-error {
	padding: 12px;
	background: #fee;
	color: #c00;
	border-radius: var(--weai-radius);
	margin: 20px;
	text-align: center;
	font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
	.weai-chat-container {
		max-width: 100%;
		height: auto;
		min-height: 400px;
		border-radius: 0;
	}

	.weai-chat-message {
		max-width: 90%;
	}
}

/* ======================================
   CARD LAYOUT (Jane Wick Style)
   ====================================== */

.weai-chat-layout-card {
	max-width: 400px;
	height: auto;
	min-height: 600px;
}

/* Card Header - Large Avatar on Top */
.weai-chat-layout-card .weai-chat-header {
	flex-direction: column;
	align-items: center;
	padding: 32px 20px;
	text-align: center;
}

.weai-chat-layout-card .weai-chat-header-content {
	flex-direction: column;
	align-items: center;
	width: 100%;
}

.weai-chat-layout-card .weai-chat-avatar {
	width: 120px;
	height: 120px;
	margin-bottom: 16px;
	border: 4px solid rgba(255, 255, 255, 0.3);
}

.weai-chat-layout-card .weai-chat-persona-info {
	width: 100%;
}

.weai-chat-layout-card .weai-chat-persona-name {
	font-size: 24px;
	font-weight: 700;
	margin-bottom: 8px;
}

.weai-chat-layout-card .weai-chat-status {
	justify-content: center;
}

/* Card Messages */
.weai-chat-layout-card .weai-chat-messages {
	padding: 24px 20px;
	min-height: 300px;
}

/* Card Input */
.weai-chat-layout-card .weai-chat-input-container {
	padding: 20px;
}

/* Card Responsive */
@media (max-width: 768px) {
	.weai-chat-layout-card {
		max-width: 100%;
		min-height: auto;
	}

	.weai-chat-layout-card .weai-chat-avatar {
		width: 100px;
		height: 100px;
	}

	.weai-chat-layout-card .weai-chat-persona-name {
		font-size: 20px;
	}
}

/* ======================================
   FLOATING LAYOUT (Bubble in corner)
   ====================================== */

.weai-chat-layout-floating {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99999;
	max-width: 380px;
	width: 380px;
	height: auto;
	max-height: 550px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
	transition: all 0.3s ease;
}

.weai-chat-layout-floating.weai-chat-minimized {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	cursor: pointer;
	overflow: hidden;
}

.weai-chat-layout-floating.weai-chat-minimized .weai-chat-messages,
.weai-chat-layout-floating.weai-chat-minimized .weai-chat-input-container,
.weai-chat-layout-floating.weai-chat-minimized .weai-chat-persona-info {
	display: none;
}

.weai-chat-layout-floating.weai-chat-minimized .weai-chat-header {
	padding: 0;
	width: 60px;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.weai-chat-layout-floating.weai-chat-minimized .weai-chat-avatar {
	width: 40px;
	height: 40px;
	margin: 0;
}

/* Floating Toggle Button */
.weai-chat-toggle {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 28px;
	height: 28px;
	background: rgba(255, 255, 255, 0.2);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-size: 16px;
	transition: background 0.2s;
}

.weai-chat-toggle:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* Floating Responsive */
@media (max-width: 768px) {
	.weai-chat-layout-floating {
		bottom: 12px;
		right: 12px;
		left: 12px;
		width: auto;
		max-width: none;
	}
}

/* ======================================
   FULLWIDTH LAYOUT (Full page width)
   ====================================== */

.weai-chat-layout-fullwidth {
	max-width: 100%;
	width: 100%;
	border-radius: 0;
	height: auto;
	min-height: 500px;
	max-height: 700px;
}

.weai-chat-layout-fullwidth .weai-chat-header {
	padding: 20px 40px;
}

.weai-chat-layout-fullwidth .weai-chat-messages {
	padding: 24px 40px;
}

.weai-chat-layout-fullwidth .weai-chat-input-container {
	padding: 20px 40px;
}

.weai-chat-layout-fullwidth .weai-chat-message {
	max-width: 60%;
}

@media (max-width: 768px) {
	.weai-chat-layout-fullwidth .weai-chat-header,
	.weai-chat-layout-fullwidth .weai-chat-messages,
	.weai-chat-layout-fullwidth .weai-chat-input-container {
		padding-left: 16px;
		padding-right: 16px;
	}

	.weai-chat-layout-fullwidth .weai-chat-message {
		max-width: 85%;
	}
}

/* ======================================
   MINIMAL LAYOUT (No header)
   ====================================== */

.weai-chat-layout-minimal {
	max-width: 500px;
}

.weai-chat-layout-minimal .weai-chat-header {
	display: none;
}

.weai-chat-layout-minimal .weai-chat-messages {
	padding-top: 24px;
	border-top-left-radius: var(--weai-radius);
	border-top-right-radius: var(--weai-radius);
}

.weai-chat-layout-minimal .weai-chat-input-container {
	border-top: none;
	background: var(--weai-assistant-bubble);
}

.weai-chat-layout-minimal .weai-chat-input {
	background: var(--weai-bg);
}

/* Minimal - show small avatar in messages */
.weai-chat-layout-minimal .weai-chat-message-assistant {
	flex-direction: row;
	gap: 8px;
	align-items: flex-start;
}

.weai-chat-layout-minimal .weai-message-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--weai-primary);
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.weai-chat-layout-minimal .weai-message-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.weai-chat-layout-minimal .weai-message-avatar svg {
	width: 16px;
	height: 16px;
	fill: white;
}
