/**
 * Seeko Agent — Widget styles.
 *
 * All styles are scoped under `.seeko-agent` to avoid theme conflicts.
 * CSS custom properties allow admin-customizable colours via inline overrides.
 *
 * @package SeekoAgent
 * @since   1.0.0
 */

/* ===================================================================
   CSS Custom Properties (overridable by admin via inline <style>)
   =================================================================== */
.seeko-agent {
	--seeko-primary: #4f46e5;
	--seeko-primary-hover: #4338ca;
	--seeko-primary-text: #ffffff;
	--seeko-bg: #ffffff;
	--seeko-bg-secondary: #f3f4f6;
	--seeko-text: #1f2937;
	--seeko-text-muted: #6b7280;
	--seeko-border: #e5e7eb;
	--seeko-user-bubble: #4f46e5;
	--seeko-user-text: #ffffff;
	--seeko-bot-bubble: #f3f4f6;
	--seeko-bot-text: #1f2937;
	--seeko-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
	--seeko-radius: 16px;
	--seeko-radius-sm: 8px;
	--seeko-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	--seeko-font-size: 14px;
	--seeko-z-index: 999999;
	--seeko-window-width: 380px;
	--seeko-window-height: 560px;
	--seeko-trigger-size: 56px;
	--seeko-mobile-chat-bottom: 16px;
	--seeko-mobile-trigger-x: 16px;
	--seeko-mobile-stack-gap: 12px;
}

/* ===================================================================
   Reset / base
   =================================================================== */
.seeko-agent,
.seeko-agent *,
.seeko-agent *::before,
.seeko-agent *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

.seeko-agent {
	position: fixed;
	z-index: var(--seeko-z-index);
	font-family: var(--seeko-font-family);
	font-size: var(--seeko-font-size);
	line-height: 1.5;
	color: var(--seeko-text);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* ===================================================================
   Position variants
   =================================================================== */
.seeko-agent--bottom-right {
	bottom: 20px;
	right: 20px;
}

.seeko-agent--bottom-left {
	bottom: 20px;
	left: 20px;
}

/* ===================================================================
   Floating trigger button
   =================================================================== */
.seeko-agent-trigger {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--seeko-trigger-size);
	height: var(--seeko-trigger-size);
	border: none;
	border-radius: 50%;
	background: var(--seeko-primary);
	color: var(--seeko-primary-text);
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
	outline: none;
	position: relative;
}

.seeko-agent-call-trigger {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--seeko-trigger-size);
	height: var(--seeko-trigger-size);
	border-radius: 50%;
	background: #16a34a;
	color: #fff;
	text-decoration: none;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	position: absolute;
	right: 0;
	bottom: calc(var(--seeko-trigger-size) + 12px);
	z-index: 1;
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.seeko-agent--open .seeko-agent-call-trigger {
	opacity: 0;
	pointer-events: none;
	transform: translateY(6px);
}

.seeko-agent--bottom-left .seeko-agent-call-trigger {
	right: auto;
	left: 0;
}

.seeko-agent-call-trigger:hover {
	background: #15803d;
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.seeko-agent-call-trigger svg {
	width: 20px;
	height: 20px;
}

.seeko-agent-trigger:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
	background: var(--seeko-primary-hover);
}

.seeko-agent-trigger:active {
	transform: scale(0.95);
}

.seeko-agent-trigger svg {
	width: 24px;
	height: 24px;
	flex-shrink: 0;
}

/* ===================================================================
   Chat window
   =================================================================== */
.seeko-agent-window {
	display: none;
	flex-direction: column;
	position: absolute;
	bottom: calc(var(--seeko-trigger-size) + 12px);
	width: var(--seeko-window-width);
	height: var(--seeko-window-height);
	max-height: calc(100vh - 120px);
	background: var(--seeko-bg);
	border-radius: var(--seeko-radius);
	box-shadow: var(--seeko-shadow);
	overflow: hidden;
	border: 1px solid var(--seeko-border);
}

/* Position alignment */
.seeko-agent--bottom-right .seeko-agent-window {
	right: 0;
}

.seeko-agent--bottom-left .seeko-agent-window {
	left: 0;
}

.seeko-agent--open .seeko-agent-window {
	display: flex;
}

/* Window open/close animation */
.seeko-agent-window {
	animation: seekoSlideUp 0.25s ease-out;
}

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

/* ===================================================================
   Header
   =================================================================== */
.seeko-agent-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: var(--seeko-primary);
	color: var(--seeko-primary-text);
	flex-shrink: 0;
}

.seeko-agent-header__left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.seeko-agent-header__avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.3);
}

.seeko-agent-header__name {
	font-weight: 600;
	font-size: 15px;
}

.seeko-agent-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: inherit;
	cursor: pointer;
	transition: background 0.15s;
}

.seeko-agent-close:hover {
	background: rgba(255, 255, 255, 0.25);
}

.seeko-agent-close svg {
	width: 18px;
	height: 18px;
}

/* ===================================================================
   Tabs
   =================================================================== */
.seeko-agent-tabs {
	display: flex;
	width: 100%;
	margin-top: 8px;
	gap: 4px;
}

.seeko-agent-tab {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 6px 12px;
	border: none;
	border-radius: var(--seeko-radius-sm);
	background: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.7);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	font-family: inherit;
}

.seeko-agent-tab:hover {
	background: rgba(255, 255, 255, 0.2);
	color: rgba(255, 255, 255, 0.9);
}

.seeko-agent-tab--active {
	background: rgba(255, 255, 255, 0.25);
	color: #ffffff;
}

.seeko-agent-tab__icon {
	display: inline-flex;
	align-items: center;
}

.seeko-agent-tab__icon svg {
	width: 16px;
	height: 16px;
}

/* ===================================================================
   Body panels
   =================================================================== */
.seeko-agent-body {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	position: relative;
}

.seeko-agent-body--hidden {
	display: none;
}

.seeko-agent-body--chat {
	display: flex;
	flex-direction: column;
}

/* ===================================================================
   Messages
   =================================================================== */
.seeko-agent-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.seeko-msg {
	display: flex;
	gap: 8px;
	max-width: 85%;
	animation: seekoFadeIn 0.2s ease;
}

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

.seeko-msg--user {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.seeko-msg--bot {
	align-self: flex-start;
}

.seeko-msg__avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	margin-top: 2px;
}

.seeko-msg__bubble {
	padding: 10px 14px;
	border-radius: var(--seeko-radius);
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.seeko-msg--user .seeko-msg__bubble {
	background: var(--seeko-user-bubble);
	color: var(--seeko-user-text);
	border-bottom-right-radius: 4px;
}

.seeko-msg--bot .seeko-msg__bubble {
	background: var(--seeko-bot-bubble);
	color: var(--seeko-bot-text);
	border-bottom-left-radius: 4px;
}

.seeko-msg__text {
	font-size: var(--seeko-font-size);
	line-height: 1.5;
}

.seeko-msg__text strong {
	font-weight: 600;
}

.seeko-msg__text code {
	background: rgba(0, 0, 0, 0.06);
	padding: 1px 4px;
	border-radius: 3px;
	font-size: 0.9em;
	font-family: "SF Mono", "Fira Code", monospace;
}

.seeko-msg__text ul {
	margin: 4px 0;
	padding-left: 18px;
}

.seeko-msg__text li {
	margin-bottom: 2px;
}

/* ===================================================================
   Typing indicator
   =================================================================== */
.seeko-msg--typing .seeko-msg__bubble {
	padding: 12px 18px;
}

.seeko-typing {
	display: flex;
	gap: 4px;
	align-items: center;
}

.seeko-typing__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--seeko-text-muted);
	opacity: 0.4;
	animation: seekoTyping 1.4s infinite;
}

.seeko-typing__dot:nth-child(2) {
	animation-delay: 0.2s;
}

.seeko-typing__dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes seekoTyping {
	0%, 60%, 100% { opacity: 0.4; transform: scale(1); }
	30%           { opacity: 1;   transform: scale(1.2); }
}

/* ===================================================================
   Suggested questions
   =================================================================== */
.seeko-agent-suggestions {
	display: none;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 16px 12px;
}

.seeko-agent-suggestions--visible {
	display: flex;
}

.seeko-agent-chip {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid var(--seeko-border);
	border-radius: 20px;
	background: var(--seeko-bg);
	color: var(--seeko-primary);
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
	white-space: nowrap;
}

.seeko-agent-chip:hover {
	background: var(--seeko-bg-secondary);
	border-color: var(--seeko-primary);
}

/* ===================================================================
   Footer (input area)
   =================================================================== */
.seeko-agent-footer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-top: 1px solid var(--seeko-border);
	background: var(--seeko-bg);
	flex-shrink: 0;
}

.seeko-agent-footer--hidden {
	display: none;
}

.seeko-agent-powered {
	padding: 8px 14px 12px;
	text-align: center;
	border-top: 1px solid var(--seeko-border);
	background: var(--seeko-bg);
	flex-shrink: 0;
}

.seeko-agent-powered--hidden {
	display: none;
}

.seeko-agent-powered__link {
	font-size: 12px;
	line-height: 1.3;
	color: var(--seeko-text-muted);
	text-decoration: none;
}

.seeko-agent-powered__link:hover {
	text-decoration: underline;
}

.seeko-agent-input {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid var(--seeko-border);
	border-radius: 24px;
	background: var(--seeko-bg);
	color: var(--seeko-text);
	font-size: var(--seeko-font-size);
	font-family: inherit;
	outline: none;
	transition: border-color 0.15s;
}

.seeko-agent-input:focus {
	border-color: var(--seeko-primary);
}

.seeko-agent-input:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.seeko-agent-input::placeholder {
	color: var(--seeko-text-muted);
}

.seeko-agent-send {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 50%;
	background: var(--seeko-primary);
	color: var(--seeko-primary-text);
	cursor: pointer;
	transition: background 0.15s, transform 0.1s;
	flex-shrink: 0;
}

.seeko-agent-send:hover {
	background: var(--seeko-primary-hover);
}

.seeko-agent-send:active {
	transform: scale(0.92);
}

.seeko-agent-send:disabled,
.seeko-agent-send--disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.seeko-agent-send svg {
	width: 18px;
	height: 18px;
}

.seeko-agent-mic {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid var(--seeko-border);
	border-radius: 50%;
	background: var(--seeko-bg-secondary);
	color: var(--seeko-text);
	cursor: pointer;
	transition: background 0.15s, transform 0.1s, border-color 0.15s;
	flex-shrink: 0;
}

.seeko-agent-mic:hover {
	background: #e5e7eb;
	border-color: #d1d5db;
}

.seeko-agent-mic:active {
	transform: scale(0.92);
}

.seeko-agent-mic--listening {
	background: #fee2e2;
	border-color: #ef4444;
	color: #b91c1c;
}

.seeko-agent-mic svg {
	width: 16px;
	height: 16px;
}

.seeko-agent-speaker {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid var(--seeko-border);
	border-radius: 50%;
	background: var(--seeko-bg-secondary);
	color: var(--seeko-text);
	cursor: pointer;
	transition: background 0.15s, transform 0.1s, border-color 0.15s;
	flex-shrink: 0;
}

.seeko-agent-speaker:hover {
	background: #e5e7eb;
	border-color: #d1d5db;
}

.seeko-agent-speaker:active {
	transform: scale(0.92);
}

.seeko-agent-speaker--muted {
	background: #fee2e2;
	border-color: #ef4444;
	color: #b91c1c;
}

.seeko-agent-speaker svg {
	width: 16px;
	height: 16px;
}

/* ===================================================================
   GDPR Consent banner
   =================================================================== */
.seeko-consent {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 24px 20px;
	gap: 12px;
}

.seeko-consent__icon {
	color: var(--seeko-primary);
}

.seeko-consent__icon svg {
	width: 32px;
	height: 32px;
}

.seeko-consent__message {
	font-size: 13px;
	color: var(--seeko-text-muted);
	line-height: 1.6;
}

.seeko-consent__privacy-link {
	color: var(--seeko-primary);
	text-decoration: underline;
	text-decoration-color: transparent;
	transition: text-decoration-color 0.15s;
}

.seeko-consent__privacy-link:hover {
	text-decoration-color: currentColor;
}

.seeko-consent__buttons {
	display: flex;
	gap: 8px;
}

.seeko-consent__btn {
	padding: 8px 20px;
	border: none;
	border-radius: 24px;
	font-size: 13px;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s, transform 0.1s;
}

.seeko-consent__btn:active {
	transform: scale(0.96);
}

.seeko-consent__btn--accept {
	background: var(--seeko-primary);
	color: var(--seeko-primary-text);
}

.seeko-consent__btn--accept:hover {
	background: var(--seeko-primary-hover);
}

.seeko-consent__btn--decline {
	background: var(--seeko-bg-secondary);
	color: var(--seeko-text-muted);
}

.seeko-consent__btn--decline:hover {
	background: var(--seeko-border);
}

.seeko-consent--declined {
	gap: 12px;
}

.seeko-consent__declined-text {
	font-size: 13px;
	color: var(--seeko-text-muted);
}

.seeko-consent__btn--retry {
	background: transparent;
	color: var(--seeko-primary);
	border: 1px solid var(--seeko-primary);
	padding: 6px 16px;
}

.seeko-consent__btn--retry:hover {
	background: var(--seeko-primary);
	color: var(--seeko-primary-text);
}

/* ===================================================================
   Product cards — shared
   =================================================================== */
.seeko-product-cards {
	margin-top: 10px;
}

.seeko-product-card {
	border: 1px solid var(--seeko-border);
	border-radius: var(--seeko-radius-sm);
	overflow: hidden;
	background: var(--seeko-bg);
	transition: box-shadow 0.15s;
}

.seeko-product-card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.seeko-product-card__img-link {
	display: block;
	text-decoration: none;
}

.seeko-product-card__img {
	display: block;
	width: 100%;
	height: 120px;
	object-fit: cover;
}

.seeko-product-card__body {
	padding: 10px;
}

.seeko-product-card__title {
	font-weight: 600;
	font-size: 13px;
	color: var(--seeko-text);
	margin-bottom: 2px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.seeko-product-card__price {
	font-size: 13px;
	font-weight: 600;
	color: var(--seeko-primary);
	margin-bottom: 4px;
}

.seeko-product-card__price del {
	color: var(--seeko-text-muted);
	font-weight: 400;
	margin-right: 4px;
}

.seeko-product-card__price ins {
	text-decoration: none;
}

.seeko-product-card__desc {
	font-size: 12px;
	color: var(--seeko-text-muted);
	margin-bottom: 8px;
	line-height: 1.4;
}

.seeko-product-card__actions {
	display: flex;
	gap: 6px;
	align-items: center;
}

.seeko-product-card__link {
	display: inline-block;
	padding: 4px 10px;
	border: 1px solid var(--seeko-border);
	border-radius: 4px;
	color: var(--seeko-text);
	text-decoration: none;
	font-size: 12px;
	font-weight: 500;
	transition: border-color 0.15s, background 0.15s;
}

.seeko-product-card__link:hover {
	border-color: var(--seeko-primary);
	color: var(--seeko-primary);
}

.seeko-product-card__cart {
	display: inline-block;
	padding: 4px 10px;
	border: none;
	border-radius: 4px;
	background: var(--seeko-primary);
	color: var(--seeko-primary-text);
	font-size: 12px;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s;
}

.seeko-product-card__cart:hover {
	background: var(--seeko-primary-hover);
}

.seeko-product-card__cart:disabled {
	opacity: 0.6;
	cursor: wait;
}

.seeko-product-card__cart--added {
	background: #10b981;
}

/* ===================================================================
   Product cards — carousel layout
   =================================================================== */
.seeko-product-cards--carousel {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 4px;
}

.seeko-product-cards--carousel::-webkit-scrollbar {
	height: 4px;
}

.seeko-product-cards--carousel::-webkit-scrollbar-track {
	background: transparent;
}

.seeko-product-cards--carousel::-webkit-scrollbar-thumb {
	background: var(--seeko-border);
	border-radius: 2px;
}

.seeko-product-cards--carousel .seeko-product-card {
	flex: 0 0 160px;
	scroll-snap-align: start;
}

.seeko-product-cards--dragging {
	cursor: grabbing;
	scroll-snap-type: none;
	user-select: none;
}

.seeko-product-cards--carousel:not(.seeko-product-cards--dragging) {
	cursor: grab;
}

/* ===================================================================
   Product cards — list layout
   =================================================================== */
.seeko-product-cards--list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.seeko-product-cards--list .seeko-product-card {
	display: flex;
	flex-direction: row;
}

.seeko-product-cards--list .seeko-product-card__img {
	width: 80px;
	height: 80px;
	flex-shrink: 0;
}

.seeko-product-cards--list .seeko-product-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* ===================================================================
   WhatsApp tab
   =================================================================== */
.seeko-agent-body--whatsapp {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 32px 20px;
	overflow-y: hidden;
}

.seeko-agent-body--whatsapp.seeko-agent-body--hidden,
.seeko-agent-body--chat.seeko-agent-body--hidden {
	display: none;
}

.seeko-wa-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 12px;
	padding: 24px;
	background: var(--seeko-bg-secondary);
	border-radius: var(--seeko-radius);
	width: 100%;
	max-width: 280px;
}

.seeko-wa-card__icon svg {
	width: 48px;
	height: 48px;
}

.seeko-wa-card__info {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.seeko-wa-card__name {
	font-weight: 600;
	font-size: 16px;
	color: var(--seeko-text);
}

.seeko-wa-card__status {
	font-size: 12px;
	color: var(--seeko-text-muted);
}

.seeko-wa-hint {
	margin-top: 16px;
	font-size: 12px;
	color: var(--seeko-text-muted);
	text-align: center;
}

/* Send button WhatsApp variant */
.seeko-agent-send--whatsapp {
	background: #25d366;
}

.seeko-agent-send--whatsapp:hover {
	background: #1ebe5d;
}

/* ===================================================================
   Mobile responsive
   =================================================================== */
@media (max-width: 480px) {
	.seeko-agent {
		bottom: 0 !important;
		right: 0 !important;
		left: 0 !important;
	}

	.seeko-agent-trigger {
		position: fixed;
		bottom: var(--seeko-mobile-chat-bottom);
		right: var(--seeko-mobile-trigger-x);
	}

	.seeko-agent-call-trigger {
		position: fixed;
		bottom: calc(var(--seeko-mobile-chat-bottom) + var(--seeko-trigger-size) + var(--seeko-mobile-stack-gap));
		right: var(--seeko-mobile-trigger-x);
	}

	.seeko-agent-call-trigger--mobile {
		display: flex;
	}

	.seeko-agent--bottom-left .seeko-agent-trigger {
		right: auto;
		left: var(--seeko-mobile-trigger-x);
	}

	.seeko-agent--bottom-left .seeko-agent-call-trigger {
		right: auto;
		left: var(--seeko-mobile-trigger-x);
	}

	.seeko-agent-window {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		max-height: 100vh;
		border-radius: 0;
		border: none;
	}

	.seeko-agent--open .seeko-agent-trigger {
		display: none;
	}
}

@media (min-width: 481px) {
	.seeko-agent-call-trigger--mobile {
		display: none;
	}
}

/* ===================================================================
   Print: hide widget
   =================================================================== */
@media print {
	.seeko-agent {
		display: none !important;
	}
}

/* ===================================================================
   Reduced motion
   =================================================================== */
@media (prefers-reduced-motion: reduce) {
	.seeko-agent-window {
		animation: none;
	}

	.seeko-msg {
		animation: none;
	}

	.seeko-typing__dot {
		animation: none;
		opacity: 0.6;
	}

	.seeko-agent-trigger {
		transition: none;
	}
}
