/**
 * TBK Chat AI - Widget Styles
 */

/* ===========================
   VARIABLES
   =========================== */
:root {
	--tbk-chat-primary: #2ecc71;
	--tbk-chat-primary-dark: #27ae60;
	--tbk-chat-bg: #ffffff;
	--tbk-chat-msg-bg: #f0f2f5;
	--tbk-chat-user-bg: #2ecc71;
	--tbk-chat-user-text: #ffffff;
	--tbk-chat-text: #1a1a1a;
	--tbk-chat-text-light: #6b7280;
	--tbk-chat-border: #e5e7eb;
	--tbk-chat-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
	--tbk-chat-radius: 16px;
	--tbk-chat-width: 380px;
	--tbk-chat-height: 520px;
}

/* ===========================
   WIDGET CONTAINER
   =========================== */
.tbk-chat-widget {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.5;
}

/* ===========================
   TOGGLE BUTTON
   =========================== */
.tbk-chat-toggle {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--tbk-chat-primary);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
	transition: transform 0.2s, box-shadow 0.2s;
}

.tbk-chat-toggle:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 20px rgba(46, 204, 113, 0.5);
}

.tbk-chat-icon-close {
	display: none;
}

.tbk-chat-widget:not(.tbk-chat-closed) .tbk-chat-icon-open {
	display: none;
}

.tbk-chat-widget:not(.tbk-chat-closed) .tbk-chat-icon-close {
	display: block;
}

/* ===========================
   CHAT WINDOW
   =========================== */
.tbk-chat-window {
	position: absolute;
	bottom: 75px;
	right: 0;
	width: var(--tbk-chat-width);
	height: var(--tbk-chat-height);
	background: var(--tbk-chat-bg);
	border-radius: var(--tbk-chat-radius);
	box-shadow: var(--tbk-chat-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: opacity 0.25s, transform 0.25s;
	opacity: 1;
	transform: translateY(0);
}

.tbk-chat-closed .tbk-chat-window {
	opacity: 0;
	transform: translateY(20px);
	pointer-events: none;
}

/* ===========================
   HEADER
   =========================== */
.tbk-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--tbk-chat-primary);
	color: #fff;
}

.tbk-chat-header-info {
	display: flex;
	align-items: center;
	gap: 8px;
}

.tbk-chat-header-info strong {
	font-size: 15px;
}

.tbk-chat-header-info small {
	opacity: 0.85;
	font-size: 12px;
}

.tbk-chat-header-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
	animation: tbk-pulse 2s infinite;
}

@keyframes tbk-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.4; }
}

.tbk-chat-minimize {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 4px;
	opacity: 0.8;
	transition: opacity 0.2s;
}

.tbk-chat-minimize:hover {
	opacity: 1;
}

/* ===========================
   MESSAGES AREA
   =========================== */
.tbk-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tbk-chat-messages::-webkit-scrollbar {
	width: 5px;
}

.tbk-chat-messages::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 3px;
}

/* ===========================
   MESSAGE BUBBLES
   =========================== */
.tbk-chat-msg {
	display: flex;
	max-width: 85%;
}

.tbk-chat-msg-assistant {
	align-self: flex-start;
}

.tbk-chat-msg-user {
	align-self: flex-end;
}

.tbk-chat-bubble {
	padding: 10px 14px;
	border-radius: 12px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.tbk-chat-msg-assistant .tbk-chat-bubble {
	background: var(--tbk-chat-msg-bg);
	color: var(--tbk-chat-text);
	border-bottom-left-radius: 4px;
}

.tbk-chat-msg-user .tbk-chat-bubble {
	background: var(--tbk-chat-user-bg);
	color: var(--tbk-chat-user-text);
	border-bottom-right-radius: 4px;
}

.tbk-chat-bubble a {
	color: inherit;
	text-decoration: underline;
	font-weight: 600;
}

.tbk-chat-msg-assistant .tbk-chat-bubble a {
	color: var(--tbk-chat-primary-dark);
}

/* ===========================
   TYPING INDICATOR
   =========================== */
.tbk-chat-dots {
	display: inline-flex;
	gap: 4px;
	padding: 4px 0;
}

.tbk-chat-dots span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--tbk-chat-text-light);
	animation: tbk-bounce 1.2s infinite;
}

.tbk-chat-dots span:nth-child(2) {
	animation-delay: 0.15s;
}

.tbk-chat-dots span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes tbk-bounce {
	0%, 60%, 100% { transform: translateY(0); }
	30% { transform: translateY(-6px); }
}

/* ===========================
   INPUT FORM
   =========================== */
.tbk-chat-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--tbk-chat-border);
	background: var(--tbk-chat-bg);
}

.tbk-chat-input {
	flex: 1;
	border: 1px solid var(--tbk-chat-border);
	border-radius: 12px;
	padding: 10px 14px;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	outline: none;
	max-height: 100px;
	line-height: 1.4;
	transition: border-color 0.2s;
}

.tbk-chat-input:focus {
	border-color: var(--tbk-chat-primary);
}

.tbk-chat-input::placeholder {
	color: var(--tbk-chat-text-light);
}

.tbk-chat-send {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--tbk-chat-primary);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.2s, opacity 0.2s;
}

.tbk-chat-send:hover:not(:disabled) {
	background: var(--tbk-chat-primary-dark);
}

.tbk-chat-send:disabled {
	opacity: 0.4;
	cursor: default;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 480px) {
	.tbk-chat-widget {
		bottom: 10px;
		right: 10px;
		left: 10px;
	}

	.tbk-chat-window {
		width: calc(100vw - 20px);
		height: calc(100vh - 140px);
		max-height: 500px;
		right: 0;
	}

	.tbk-chat-toggle {
		width: 52px;
		height: 52px;
	}
}
