/**
 * İhale Portal Chatbot Widget Stilleri
 * Chat bubble ve chat window için CSS
 */

/* Chat Container */
#ihale-portal-chatbot-container {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* Chat Bubble */
#ihale-portal-chat-bubble {
	width: auto;
	max-width: calc(100vw - 40px); /* Mobilde taşmasın */
	background: linear-gradient(135deg, #0A5C80 0%, #E84E1B 100%);
	border-radius: 28px; /* Pill shape */
	display: flex;
	align-items: center;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transition: all 0.3s ease;
	position: relative;
	color: white;
	padding: 6px; /* Inner spacing */
	padding-right: 20px;
	box-sizing: border-box;
}

#ihale-portal-chat-bubble:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.ihale-bubble-icon {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 12px;
}

.ihale-bubble-icon svg {
	width: 24px;
	height: 24px;
}

.ihale-bubble-icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.ihale-bubble-text {
	font-weight: 600;
	font-size: 16px;
	white-space: nowrap;
	letter-spacing: 0.3px;
	overflow: hidden;
	text-overflow: ellipsis;
	flex-shrink: 1;
	min-width: 0;
}

/* Chat Window */
#ihale-portal-chat-window {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 400px; /* Biraz daha geniş */
	max-width: calc(100vw - 40px);
	height: 650px;
	max-height: calc(100vh - 120px);
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	opacity: 0;
	transform: translateY(24px) scale(0.98);
	pointer-events: none;
	visibility: hidden;
	transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1), transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

#ihale-portal-chat-window.is-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
	visibility: visible;
}

/* Minimal Header */
#ihale-portal-chat-header {
	background: #fff;
	padding: 16px 20px;
	border-bottom: 1px solid rgba(0,0,0,0.05);
	flex-shrink: 0;
}

.chat-header-top {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.header-title {
	font-size: 16px;
	font-weight: 600;
	color: #111;
	margin: 0;
}

#ihale-portal-chat-close {
	background: transparent;
	border: none;
	color: #666;
	cursor: pointer;
	padding: 4px;
	border-radius: 50%;
	transition: background 0.2s;
}

#ihale-portal-chat-close:hover {
	background: #f5f5f5;
	color: #333;
}

/* Chat Body Area */
#ihale-portal-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 0; /* Padding'i kaldırdık, iç elementler yönetecek */
	background: #fff;
	display: flex;
	flex-direction: column;
	position: relative;
}

/* Welcome Screen */
#chat-welcome-screen {
	padding: 40px 24px;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	animation: fadeIn 0.4s ease-out;
}

.welcome-brand {
	margin-bottom: 24px;
}

.welcome-logo {
	width: 64px;
	height: 64px;
	/* İkon rengi markaya göre değişebilir */
}

.welcome-text h2 {
	font-size: 24px;
	font-weight: 700;
	color: #111;
	margin: 0 0 8px 0;
}

.welcome-text p {
	font-size: 15px;
	color: #666;
	margin: 0 0 32px 0;
	line-height: 1.5;
}

/* Quick Questions */
.quick-questions {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.quick-q-btn {
	background: #fff;
	border: 1px solid #eee;
	padding: 14px 16px;
	border-radius: 12px;
	text-align: left;
	font-size: 14px;
	color: #333;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 12px;
	transition: all 0.2s ease;
	width: 100%;
}

.quick-q-btn:hover {
	background: #f9f9f9;
	border-color: #ddd;
	transform: translateY(-1px);
	box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.arrow-icon {
	color: #999;
	font-size: 16px;
	font-weight: 300;
}

/* Messages Area (Active Chat) */
.chat-messages {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.chat-message {
	display: flex;
	margin-bottom: 0;
	animation: fadeIn 0.3s ease;
	max-width: 85%;
	min-width: 0;
	flex-shrink: 1;
}

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

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

.message-content {
	padding: 12px 18px;
	border-radius: 18px;
	font-size: 15px;
	line-height: 1.5;
	word-wrap: break-word;
	overflow-wrap: break-word;
	word-break: break-word;
	overflow: hidden;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.message-content a {
	color: #6366f1;
	text-decoration: underline;
	word-break: break-all;
	font-size: 13px;
}

.message-content code,
.message-content pre {
	white-space: pre-wrap;
	word-break: break-all;
	font-size: 13px;
}

.chat-message.user .message-content {
	background: #333; /* Koyu tema veya marka rengi */
	color: #fff;
	border-bottom-right-radius: 4px;
}

.chat-message.bot .message-content {
	background: #f3f4f6;
	color: #1f2937;
	border-bottom-left-radius: 4px;
}

/* Input Area (Floating) */
#ihale-portal-chat-input-wrapper {
	padding: 16px 20px;
	background: #fff;
	/* border-top: 1px solid #f0f0f0; */
}

#ihale-portal-chat-input-container {
	display: flex;
	align-items: flex-end;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	padding: 8px 12px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.02);
	transition: border-color 0.2s;
}

#ihale-portal-chat-input-container:focus-within {
	border-color: #333;
}

#ihale-portal-chat-input {
	flex: 1;
	border: none;
	background: transparent;
	padding: 8px;
	font-size: 15px;
	outline: none;
	resize: none;
	max-height: 100px;
	font-family: inherit;
}

#ihale-portal-chat-send {
	background: #e5e7eb; /* Disabled state initially */
	border: none;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: not-allowed;
	color: #999;
	transition: all 0.2s;
	margin-left: 8px;
	margin-bottom: 2px;
}

#ihale-portal-chat-input:not(:placeholder-shown) + #ihale-portal-chat-send {
	background: #6366f1; /* Brand color active */
	color: #fff;
	cursor: pointer;
}

.chat-footer-note {
	text-align: center;
	font-size: 11px;
	color: #9ca3af;
	margin-top: 8px;
}

/* Animations */
@keyframes fadeIn {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Typing Indicator Update */
.bot-typing {
	margin-left: 20px;
	margin-bottom: 12px;
	background: #f3f4f6;
	padding: 10px 16px;
	border-radius: 18px;
	border-bottom-left-radius: 4px;
	width: fit-content;
	display: flex;
	align-items: center;
	gap: 10px;
	box-sizing: border-box;
	color: #7a7a7a;
	font-size: 14px;
	font-weight: 500;
}

.typing-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
}

.typing-text {
	display: flex;
	align-items: center;
	gap: 2px;
	letter-spacing: 0.2px;
}

.typing-dot {
	display: inline-block;
	font-size: 18px;
	line-height: 1;
	opacity: 0.2;
	animation: dotPulse 1.6s infinite;
}

.typing-dot.dot1 { animation-delay: 0s; }
.typing-dot.dot2 { animation-delay: 0.2s; }
.typing-dot.dot3 { animation-delay: 0.4s; }

@keyframes dotPulse {
	0% { opacity: 0.2; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-2px); }
	80%, 100% { opacity: 0.2; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
	#ihale-portal-chat-bubble:hover {
		transform: none; /* Mobilde hover efekti yok */
	}
	#ihale-portal-chatbot-container {
		bottom: 15px;
		right: 15px;
		left: auto;
	}

	#ihale-portal-chat-window {
		width: calc(100vw - 30px);
		max-width: calc(100vw - 30px);
		height: calc(100vh - 100px);
		max-height: calc(100vh - 100px);
		bottom: 70px;
		right: 0;
		left: auto;
		border-radius: 12px;
	}

	#ihale-portal-chat-bubble {
		width: auto;
		min-width: 56px;
		max-width: calc(100vw - 30px);
		padding: 6px;
		padding-right: 16px;
	}

	.ihale-bubble-icon {
		width: 40px;
		height: 40px;
		margin-right: 8px;
		flex-shrink: 0;
	}

	.ihale-bubble-text {
		font-size: 14px;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 150px;
	}

	.chat-message {
		max-width: 80%;
	}

	.message-content {
		max-width: 100%;
		font-size: 14px;
		padding: 10px 16px;
	}

	#ihale-portal-chat-header {
		padding: 12px 16px;
	}

	.header-title {
		font-size: 15px;
	}

	.chat-messages {
		padding: 16px;
		gap: 12px;
	}

	#ihale-portal-chat-input-wrapper {
		padding: 12px 16px;
	}

	.welcome-text h2 {
		font-size: 20px;
	}

	.welcome-text p {
		font-size: 14px;
	}

	.quick-q-btn {
		padding: 12px 14px;
		font-size: 13px;
	}
}

@media (max-width: 480px) {
	#ihale-portal-chatbot-container {
		bottom: 12px;
		right: 12px;
		left: auto;
	}

	#ihale-portal-chat-window {
		width: 100vw;
		max-width: 100vw;
		height: 80vh;
		max-height: 80vh;
		bottom: 0;
		right: 0;
		left: 0;
		border-radius: 12px 12px 0 0;
		position: fixed;
	}

	#ihale-portal-chat-bubble {
		width: 56px;
		height: 56px;
		padding: 0;
		min-width: 56px;
		max-width: 56px;
		border-radius: 50%;
		justify-content: center;
	}

	.ihale-bubble-icon {
		width: 56px;
		height: 56px;
		margin-right: 0;
		border-radius: 50%;
	}

	.ihale-bubble-text {
		display: none; /* Mobilde sadece ikon göster */
	}

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

	.message-content {
		font-size: 14px;
		padding: 10px 14px;
		line-height: 1.4;
	}

	#ihale-portal-chat-header {
		padding: 12px 16px;
	}

	.header-title {
		font-size: 15px;
	}

	.chat-messages {
		padding: 12px;
		gap: 10px;
	}

	#ihale-portal-chat-input-wrapper {
		padding: 10px 12px;
	}

	#ihale-portal-chat-input-container {
		padding: 6px 10px;
	}

	#ihale-portal-chat-input {
		font-size: 14px;
		padding: 6px;
	}

	#ihale-portal-chat-send {
		width: 32px;
		height: 32px;
		margin-left: 6px;
	}

	.welcome-text h2 {
		font-size: 18px;
	}

	.welcome-text p {
		font-size: 13px;
		margin-bottom: 24px;
	}

	.quick-q-btn {
		padding: 10px 12px;
		font-size: 13px;
	}

	.welcome-brand {
		margin-bottom: 20px;
	}

	.welcome-logo {
		width: 56px;
		height: 56px;
	}

	#chat-welcome-screen {
		padding: 30px 20px;
	}

	.chat-footer-note {
		font-size: 10px;
		margin-top: 6px;
	}

	.bot-typing {
		margin-left: 12px;
		margin-bottom: 10px;
		padding: 8px 14px;
		font-size: 13px;
	}
}

/* Küçük ekranlar için ekstra optimizasyon */
@media (max-width: 360px) {
	#ihale-portal-chat-bubble {
		width: 52px;
		height: 52px;
		min-width: 52px;
		max-width: 52px;
	}

	.ihale-bubble-icon {
		width: 52px;
		height: 52px;
	}

	.message-content {
		font-size: 13px;
		padding: 9px 12px;
	}

	.chat-messages {
		padding: 10px;
	}

	#ihale-portal-chat-input-wrapper {
		padding: 8px 10px;
	}
}
