/**
 * Стили для виджета Grill Bot
 *
 * @package Grill_Bot
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
	--grill-bot-primary: #e65100;
	--grill-bot-primary-dark: #bf360c;
	--grill-bot-primary-light: #ff6d00;
	--grill-bot-bg: #ffffff;
	--grill-bot-bg-secondary: #f5f5f5;
	--grill-bot-text: #212121;
	--grill-bot-text-secondary: #757575;
	--grill-bot-border: #e0e0e0;
	--grill-bot-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	--grill-bot-shadow-hover: 0 6px 30px rgba(0, 0, 0, 0.2);
	--grill-bot-radius: 16px;
	--grill-bot-radius-sm: 8px;
	--grill-bot-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Theme Reset (Woodmart / WooCommerce)
   Тема применяет глобальные стили ко всем
   button, [type=submit] и SVG. Перебиваем
   через ID-селектор (#grill-bot-container).
   ======================================== */
#grill-bot-container button,
#grill-bot-container [type="submit"] {
	border-radius: 0;
	background-color: transparent;
	background-image: none;
	color: inherit;
	border: none;
	box-shadow: none;
	text-transform: none;
	font-weight: normal;
	letter-spacing: normal;
	padding: 0;
	margin: 0;
	min-height: 0;
	min-width: 0;
	gap: 0;
	line-height: normal;
}

#grill-bot-container button:hover,
#grill-bot-container [type="submit"]:hover {
	background-color: transparent;
	background-image: none;
	box-shadow: none;
}

#grill-bot-container svg {
	max-width: none;
	max-height: none;
	fill: currentColor;
}

/* ========================================
   Container
   Скрыт по умолчанию — показ только из JS после инициализации,
   чтобы не было мигания при загрузке страницы.
   ======================================== */
#grill-bot-container {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* ========================================
   Launcher Button
   ======================================== */
#grill-bot-container .grill-bot-launcher {
	width: 60px;
	height: 60px;
	border-radius: 50% !important;
	background: linear-gradient(135deg, var(--grill-bot-primary) 0%, var(--grill-bot-primary-dark) 100%) !important;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: var(--grill-bot-shadow);
	transition: var(--grill-bot-transition);
	position: relative;
	border: none;
	outline: none;
}

#grill-bot-container .grill-bot-launcher:hover {
	transform: scale(1.1);
	box-shadow: var(--grill-bot-shadow-hover);
}

#grill-bot-container .grill-bot-launcher:active {
	transform: scale(0.95);
}

#grill-bot-container .grill-bot-icon-close {
	display: none !important;
}

#grill-bot-container .grill-bot-launcher.grill-bot-active .grill-bot-icon-chat {
	display: none !important;
}

#grill-bot-container .grill-bot-launcher.grill-bot-active .grill-bot-icon-close {
	display: block !important;
}

/* Launcher с пользовательским изображением */
#grill-bot-container .grill-bot-launcher.grill-bot-launcher-has-image {
	background: none !important;
	box-shadow: none;
	overflow: hidden;
	padding: 0;
}

#grill-bot-container .grill-bot-launcher.grill-bot-launcher-has-image:hover {
	box-shadow: none;
}

#grill-bot-container .grill-bot-launcher-img {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

#grill-bot-container .grill-bot-launcher.grill-bot-launcher-has-image.grill-bot-active {
	background: linear-gradient(135deg, var(--grill-bot-primary) 0%, var(--grill-bot-primary-dark) 100%) !important;
}

/* Badge для уведомлений */
.grill-bot-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	background: #f44336;
	color: #ffffff;
	font-size: 11px;
	font-weight: 600;
	min-width: 20px;
	height: 20px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 5px;
	box-sizing: border-box;
	animation: grill-bot-pulse 2s infinite;
}

@keyframes grill-bot-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
	}
	70% {
		box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
	}
}

/* ========================================
   Chat Widget Window
   ======================================== */
.grill-bot-widget {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 380px;
	height: 520px;
	background: var(--grill-bot-bg);
	border-radius: var(--grill-bot-radius);
	box-shadow: var(--grill-bot-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: var(--grill-bot-transition);
	transform-origin: bottom right;
}

.grill-bot-widget.grill-bot-hidden {
	opacity: 0;
	visibility: hidden;
	transform: scale(0.8) translateY(20px);
	pointer-events: none;
}

.grill-bot-widget.grill-bot-visible {
	opacity: 1;
	visibility: visible;
	transform: scale(1) translateY(0);
	pointer-events: auto;
}

/* ========================================
   Header
   ======================================== */
#grill-bot-container .grill-bot-header {
	background: linear-gradient(135deg, var(--grill-bot-primary) 0%, var(--grill-bot-primary-dark) 100%);
	color: #ffffff;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

#grill-bot-container .grill-bot-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
}

#grill-bot-container .grill-bot-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

#grill-bot-container .grill-bot-avatar svg {
	width: 32px;
	height: 32px;
	fill: #ffffff;
}

#grill-bot-container .grill-bot-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

#grill-bot-container .grill-bot-header-text {
	display: flex;
	flex-direction: column;
}

#grill-bot-container .grill-bot-title {
	font-size: 16px;
	font-weight: 600;
}

#grill-bot-container .grill-bot-subtitle {
	font-size: 12px;
	opacity: 0.9;
}

#grill-bot-container .grill-bot-close {
	background: rgba(255, 255, 255, 0.2) !important;
	border: none !important;
	border-radius: 50% !important;
	width: 32px !important;
	height: 32px !important;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: var(--grill-bot-transition);
	color: #ffffff !important;
}

#grill-bot-container .grill-bot-close svg {
	width: 22px;
	height: 22px;
	fill: #ffffff;
}

#grill-bot-container .grill-bot-close:hover {
	background: rgba(255, 255, 255, 0.3) !important;
}

/* ========================================
   Messages Area
   ======================================== */
.grill-bot-messages {
	flex: 1;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	background: var(--grill-bot-bg-secondary);
	scroll-behavior: smooth;
}

.grill-bot-messages::-webkit-scrollbar {
	width: 6px;
}

.grill-bot-messages::-webkit-scrollbar-track {
	background: transparent;
}

.grill-bot-messages::-webkit-scrollbar-thumb {
	background: var(--grill-bot-border);
	border-radius: 3px;
}

.grill-bot-messages::-webkit-scrollbar-thumb:hover {
	background: var(--grill-bot-text-secondary);
}

/* ========================================
   Message Bubbles
   ======================================== */
.grill-bot-message {
	display: flex;
	gap: 10px;
	max-width: 85%;
	animation: grill-bot-fade-in 0.3s ease;
}

@keyframes grill-bot-fade-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.grill-bot-message-bot {
	align-self: flex-start;
}

.grill-bot-message-user {
	align-self: flex-end;
	flex-direction: row-reverse;
}

#grill-bot-container .grill-bot-message-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--grill-bot-primary);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
}

#grill-bot-container .grill-bot-message-avatar svg {
	width: 20px;
	height: 20px;
	fill: #ffffff;
}

#grill-bot-container .grill-bot-message-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

#grill-bot-container .grill-bot-message-user .grill-bot-message-avatar {
	background: var(--grill-bot-text-secondary);
}

.grill-bot-message-content {
	min-width: 0;
	background: var(--grill-bot-bg);
	padding: 12px 16px;
	border-radius: var(--grill-bot-radius-sm);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.grill-bot-message-bot .grill-bot-message-content {
	border-bottom-left-radius: 4px;
}

.grill-bot-message-user .grill-bot-message-content {
	background: var(--grill-bot-primary);
	color: #ffffff;
	border-bottom-right-radius: 4px;
}

.grill-bot-message-content p {
	margin: 0;
	overflow-wrap: anywhere;
	word-wrap: break-word;
	white-space: pre-wrap;
}

.grill-bot-message-content a {
	overflow-wrap: anywhere;
	word-break: break-word;
}

/* ========================================
   Typing Indicator
   ======================================== */
.grill-bot-typing {
	padding: 8px 20px;
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--grill-bot-bg-secondary);
}

.grill-bot-typing-indicator {
	display: flex;
	gap: 4px;
}

.grill-bot-typing-indicator span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--grill-bot-text-secondary);
	animation: grill-bot-typing-bounce 1.4s infinite ease-in-out both;
}

.grill-bot-typing-indicator span:nth-child(1) {
	animation-delay: -0.32s;
}

.grill-bot-typing-indicator span:nth-child(2) {
	animation-delay: -0.16s;
}

@keyframes grill-bot-typing-bounce {
	0%, 80%, 100% {
		transform: scale(0.6);
		opacity: 0.5;
	}
	40% {
		transform: scale(1);
		opacity: 1;
	}
}

.grill-bot-typing-text {
	font-size: 12px;
	color: var(--grill-bot-text-secondary);
}

/* ========================================
   Input Area
   ======================================== */
.grill-bot-input-area {
	padding: 16px 20px;
	background: var(--grill-bot-bg);
	border-top: 1px solid var(--grill-bot-border);
	flex-shrink: 0;
}

.grill-bot-form {
	display: flex;
	gap: 10px;
	align-items: center;
}

#grill-bot-container .grill-bot-input {
	flex: 1;
	border: 1px solid var(--grill-bot-border) !important;
	border-radius: 24px !important;
	padding: 12px 20px !important;
	font-size: 14px;
	outline: none;
	transition: var(--grill-bot-transition);
	font-family: inherit;
	height: auto !important;
	min-height: 0 !important;
	background-color: var(--grill-bot-bg) !important;
	color: var(--grill-bot-text) !important;
}

#grill-bot-container .grill-bot-input:focus {
	border-color: var(--grill-bot-primary) !important;
	box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.1) !important;
}

#grill-bot-container .grill-bot-input::placeholder {
	color: var(--grill-bot-text-secondary);
}

#grill-bot-container .grill-bot-send {
	width: 44px !important;
	height: 44px !important;
	border-radius: 50% !important;
	background: var(--grill-bot-primary) !important;
	color: #ffffff !important;
	border: none !important;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: var(--grill-bot-transition);
	flex-shrink: 0;
}

#grill-bot-container .grill-bot-send svg {
	width: 24px;
	height: 24px;
	fill: #ffffff;
}

#grill-bot-container .grill-bot-send:hover {
	background: var(--grill-bot-primary-dark) !important;
	transform: scale(1.05);
}

#grill-bot-container .grill-bot-send:active {
	transform: scale(0.95);
}

#grill-bot-container .grill-bot-send:disabled {
	background: var(--grill-bot-border) !important;
	cursor: not-allowed;
	transform: none;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 480px) {
	#grill-bot-container {
		bottom: 10px;
		right: 10px;
	}

	.grill-bot-widget {
		width: calc(100vw - 20px);
		height: calc(100vh - 100px);
		max-height: 600px;
		bottom: 70px;
		right: 0;
	}

	.grill-bot-launcher {
		width: 56px;
		height: 56px;
	}

	#grill-bot-container .grill-bot-launcher-img {
		width: 56px;
		height: 56px;
	}
}

/* ========================================
   Error State
   ======================================== */
.grill-bot-message-error .grill-bot-message-content {
	background: #ffebee;
	color: #c62828;
	border: 1px solid #ef9a9a;
}
