.ai-chat-wrapper {
	position: relative;
	z-index: 5;
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	padding: 90px 20px 30px;
	box-sizing: border-box;
}

.ai-chat-panel {
	width: 100%;
	max-width: 720px;
	height: 78vh;
	max-height: 780px;
	display: flex;
	flex-direction: column;
	background-color: var(--settingsection-background-color);
	border: 1px solid var(--border-color);
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.ai-chat-tabs {
	display: flex;
	gap: 6px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--hr-background);
	flex-shrink: 0;
}

.ai-chat-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border-radius: 100em;
	border: 1px solid var(--border-color);
	background: var(--button-reg-background-color);
	color: var(--hover-text-color);
	font-family: 'DM Sans', sans-serif;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.ai-chat-tab:hover {
	background: var(--button-reg-hover-background-color);
	color: var(--text-color);
}

.ai-chat-tab.active {
	background: var(--button-gradient-color);
	color: #fff;
	border-color: transparent;
}

.ai-chat-tab.locked {
	opacity: 0.6;
}

.ai-chat-clear {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid var(--border-color);
	background: var(--button-reg-background-color);
	color: var(--hover-text-color);
	cursor: pointer;
	transition: all 0.2s ease;
}

.ai-chat-clear:hover {
	background: rgba(255, 0, 0, 0.15);
	color: #ff6b6b;
	border-color: rgba(255, 0, 0, 0.3);
}

.ai-chat-lock {
	display: none;
}

.ai-chat-tab.locked .ai-chat-lock {
	display: inline-block;
}

.ai-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 18px 18px 6px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ai-chat-empty {
	margin: auto;
	color: var(--hover-text-color);
	font-size: 14px;
	text-align: center;
}

.ai-msg {
	max-width: 78%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14.5px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-break: break-word;
}

.ai-msg-user {
	align-self: flex-end;
	background: var(--button-gradient-color);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.ai-msg-assistant {
	align-self: flex-start;
	background: var(--input-background-color);
	color: var(--text-color);
	border: 1px solid var(--border-color);
	border-bottom-left-radius: 4px;
}

.ai-msg-error {
	align-self: flex-start;
	background: rgba(255, 0, 0, 0.12);
	color: #ff8080;
	border: 1px solid rgba(255, 0, 0, 0.3);
}

.ai-msg-typing {
	align-self: flex-start;
	display: inline-flex;
	gap: 4px;
	padding: 12px 16px;
	background: var(--input-background-color);
	border: 1px solid var(--border-color);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
}

.ai-msg-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--hover-text-color);
	animation: ai-typing 1.2s infinite ease-in-out;
}

.ai-msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-msg-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-typing {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.ai-chat-inputrow {
	display: flex;
	gap: 10px;
	padding: 14px 16px;
	border-top: 1px solid var(--hr-background);
	flex-shrink: 0;
}

.ai-chat-input {
	flex: 1;
	height: 44px;
	padding: 0 16px;
	border-radius: 10px;
	border: 2px solid transparent;
	outline: none;
	background-color: var(--input-background-color);
	color: var(--text-color);
	font-family: 'DM Sans', sans-serif;
	font-size: 14.5px;
}

.ai-chat-input:focus {
	border-color: var(--border-color);
}

.ai-chat-send {
	height: 44px;
	padding: 0 22px;
	border-radius: 10px;
	border: 0;
	background-color: var(--button-reg-background-color);
	color: var(--text-color);
	outline: #ffffff17 1px solid;
	font-family: 'DM Sans', sans-serif;
	font-size: 14.5px;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.ai-chat-send:hover:not(:disabled) {
	background-color: var(--button-reg-hover-background-color);
}

.ai-chat-send:disabled,
.ai-chat-tab:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

@media (max-width: 520px) {
	.ai-chat-panel {
		height: 85vh;
	}
	.ai-msg {
		max-width: 88%;
	}
}
