/* ==========================================================================
   Gym Chatbot Widget — Standalone (ported from WordPress plugin)
   ========================================================================== */

:root {
	--gcb-primary: #111111;
	--gcb-primary-hover: #2a2a2a;
	--gcb-bg: #ffffff;
	--gcb-bg-secondary: #f7f7f8;
	--gcb-text: #1a1a1a;
	--gcb-text-light: #6b7280;
	--gcb-text-muted: #9ca3af;
	--gcb-border: #e5e7eb;
	--gcb-border-light: #f0f0f0;
	--gcb-green: #22c55e;
	--gcb-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
	--gcb-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
	--gcb-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.16);
	--gcb-shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.2);
	--gcb-radius: 16px;
	--gcb-radius-sm: 8px;
	--gcb-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--gcb-transition: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Launcher Button --- */
#gcb-launcher {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 60px;
	height: 60px;
	background: var(--gcb-primary);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: var(--gcb-shadow-lg);
	z-index: 10001;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.25s var(--gcb-transition), box-shadow 0.25s var(--gcb-transition);
	padding: 0;
}

#gcb-launcher:hover {
	transform: scale(1.08);
	box-shadow: var(--gcb-shadow-xl);
}

#gcb-launcher:active { transform: scale(0.95); }

#gcb-launcher svg {
	width: 28px;
	height: 28px;
	fill: #fff;
	transition: transform 0.3s var(--gcb-transition);
}

#gcb-launcher.gcb-open svg.gcb-icon-chat { display: none; }
#gcb-launcher.gcb-open svg.gcb-icon-close { display: block; }
#gcb-launcher svg.gcb-icon-close { display: none; }

/* --- Chat Container --- */
#gcb-container {
	position: fixed;
	bottom: 96px;
	right: 24px;
	width: 400px;
	height: 600px;
	max-height: 80vh;
	background: var(--gcb-bg);
	border-radius: var(--gcb-radius);
	box-shadow: var(--gcb-shadow-xl);
	z-index: 10000;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(16px) scale(0.96);
	pointer-events: none;
	transition: opacity 0.3s var(--gcb-transition), transform 0.3s var(--gcb-transition);
	box-sizing: border-box;
	border: 1px solid var(--gcb-border);
	font-family: var(--gcb-font);
}

#gcb-container.gcb-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* --- Header --- */
#gcb-header {
	background: var(--gcb-primary);
	color: #fff;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.gcb-header-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.gcb-header-title {
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.gcb-header-subtitle {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.6);
	display: flex;
	align-items: center;
	gap: 5px;
}

.gcb-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9ca3af;
	display: inline-block;
	transition: background 0.3s;
}

.gcb-status-dot.gcb-online {
	background: var(--gcb-green);
	box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.gcb-status-dot.gcb-offline {
	background: #ef4444;
	box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.gcb-header-actions {
	display: flex;
	gap: 4px;
	align-items: center;
}

.gcb-header-btn {
	width: 32px;
	height: 32px;
	border: none;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s;
	padding: 0;
}

.gcb-header-btn:hover { background: rgba(255, 255, 255, 0.22); }
.gcb-header-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* --- Messages Area --- */
#gcb-messages {
	flex: 1;
	padding: 20px;
	overflow-y: auto;
	overflow-x: hidden;
	background: var(--gcb-bg-secondary);
	display: flex;
	flex-direction: column;
	gap: 4px;
	scroll-behavior: smooth;
}

#gcb-messages::-webkit-scrollbar { width: 5px; }
#gcb-messages::-webkit-scrollbar-track { background: transparent; }
#gcb-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* --- Message Wrappers --- */
.gcb-msg-wrap {
	display: flex;
	flex-direction: column;
	margin-bottom: 12px;
	animation: gcb-msg-in 0.3s var(--gcb-transition) both;
}

.gcb-msg-wrap-user { align-items: flex-end; }
.gcb-msg-wrap-bot { align-items: flex-start; }

@keyframes gcb-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* --- Messages --- */
.gcb-msg {
	padding: 12px 16px;
	border-radius: 14px;
	max-width: 85%;
	font-size: 14px;
	line-height: 1.55;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.gcb-msg-user {
	background: var(--gcb-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.gcb-msg-bot {
	background: var(--gcb-bg);
	color: var(--gcb-text);
	border: 1px solid var(--gcb-border-light);
	border-bottom-left-radius: 4px;
	box-shadow: var(--gcb-shadow-sm);
}

.gcb-msg-bot strong { font-weight: 600; }
.gcb-msg-bot a { color: #2563eb; text-decoration: underline; }
.gcb-msg-bot a:hover { color: #1d4ed8; }
.gcb-msg-bot ul, .gcb-msg-bot ol { margin: 6px 0; padding-left: 20px; }
.gcb-msg-bot li { margin-bottom: 3px; }

.gcb-msg-time {
	font-size: 10px;
	color: var(--gcb-text-muted);
	margin-top: 4px;
	padding: 0 4px;
}

/* --- Quick Action Chips --- */
#gcb-quick-actions {
	padding: 0 20px 12px;
	background: var(--gcb-bg-secondary);
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.gcb-chip {
	background: var(--gcb-bg);
	color: var(--gcb-text);
	border: 1px solid var(--gcb-border);
	border-radius: 20px;
	padding: 7px 14px;
	font-size: 13px;
	cursor: pointer;
	transition: all 0.15s;
	font-family: var(--gcb-font);
	white-space: nowrap;
}

.gcb-chip:hover {
	background: var(--gcb-primary);
	color: #fff;
	border-color: var(--gcb-primary);
}

/* --- Input Area --- */
#gcb-input-area {
	padding: 12px 16px;
	border-top: 1px solid var(--gcb-border);
	display: flex;
	align-items: flex-end;
	gap: 8px;
	background: var(--gcb-bg);
	flex-shrink: 0;
}

#gcb-input {
	flex: 1;
	border: 1px solid var(--gcb-border);
	border-radius: 12px;
	padding: 10px 14px;
	font-size: 14px;
	line-height: 1.45;
	resize: none;
	outline: none;
	font-family: var(--gcb-font);
	background: var(--gcb-bg-secondary);
	color: var(--gcb-text);
	box-sizing: border-box;
	min-height: 42px;
	max-height: 120px;
	overflow-y: auto;
	transition: border-color 0.15s;
}

#gcb-input:focus {
	border-color: #a3a3a3;
	background: var(--gcb-bg);
}

#gcb-input::placeholder { color: var(--gcb-text-muted); }

#gcb-send {
	width: 42px;
	height: 42px;
	min-width: 42px;
	border: none;
	background: var(--gcb-primary);
	color: #fff;
	border-radius: 12px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s, transform 0.1s, opacity 0.15s;
	padding: 0;
	flex-shrink: 0;
}

#gcb-send:hover:not(:disabled) { background: var(--gcb-primary-hover); }
#gcb-send:active:not(:disabled) { transform: scale(0.92); }
#gcb-send:disabled { opacity: 0.35; cursor: default; }
#gcb-send svg { width: 18px; height: 18px; fill: currentColor; }

/* --- Toolbar --- */
#gcb-toolbar {
	padding: 6px 16px 8px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--gcb-bg);
	border-top: 1px solid var(--gcb-border-light);
	flex-shrink: 0;
}

.gcb-toolbar-actions { display: flex; gap: 2px; }

.gcb-tool-btn {
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--gcb-text-muted);
	border-radius: 6px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s, background 0.15s;
	padding: 0;
}

.gcb-tool-btn:hover {
	color: var(--gcb-text);
	background: var(--gcb-bg-secondary);
}

.gcb-tool-btn svg { width: 16px; height: 16px; fill: currentColor; }

.gcb-powered {
	font-size: 10px;
	color: var(--gcb-text-muted);
	letter-spacing: 0.02em;
}

/* --- Typing Indicator --- */
.gcb-typing-wrap {
	display: flex;
	align-items: flex-start;
	margin-bottom: 12px;
	animation: gcb-msg-in 0.3s var(--gcb-transition) both;
}

.gcb-typing {
	display: flex;
	gap: 4px;
	padding: 14px 18px;
	background: var(--gcb-bg);
	border: 1px solid var(--gcb-border-light);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	box-shadow: var(--gcb-shadow-sm);
}

.gcb-dot {
	width: 7px;
	height: 7px;
	background: #b0b0b0;
	border-radius: 50%;
	animation: gcb-pulse 1.4s infinite ease-in-out;
}

.gcb-dot:nth-child(2) { animation-delay: 0.15s; }
.gcb-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes gcb-pulse {
	0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
	40% { opacity: 1; transform: scale(1.15); }
}

/* --- Email Modal --- */
#gcb-modal-overlay {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 10002;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s;
	backdrop-filter: blur(2px);
}

#gcb-modal-overlay.gcb-modal-open {
	opacity: 1;
	pointer-events: auto;
}

.gcb-modal {
	background: var(--gcb-bg);
	border-radius: var(--gcb-radius);
	padding: 28px;
	width: 340px;
	max-width: 90vw;
	box-shadow: var(--gcb-shadow-xl);
	transform: translateY(12px);
	transition: transform 0.25s var(--gcb-transition);
	font-family: var(--gcb-font);
}

#gcb-modal-overlay.gcb-modal-open .gcb-modal { transform: translateY(0); }

.gcb-modal h3 {
	margin: 0 0 6px 0;
	font-size: 17px;
	font-weight: 600;
	color: var(--gcb-text);
}

.gcb-modal p {
	margin: 0 0 18px 0;
	font-size: 13px;
	color: var(--gcb-text-light);
	line-height: 1.45;
}

.gcb-modal input[type="email"] {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--gcb-border);
	border-radius: var(--gcb-radius-sm);
	font-size: 14px;
	font-family: var(--gcb-font);
	outline: none;
	box-sizing: border-box;
	margin: 0 0 16px 0;
	transition: border-color 0.15s;
	background: var(--gcb-bg);
	color: var(--gcb-text);
}

.gcb-modal input[type="email"]:focus { border-color: #a3a3a3; }

.gcb-modal-btns { display: flex; gap: 10px; }

.gcb-modal-btns button {
	flex: 1;
	padding: 10px 16px;
	border-radius: var(--gcb-radius-sm);
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	font-family: var(--gcb-font);
	transition: background 0.15s, transform 0.1s;
}

.gcb-modal-btns button:active { transform: scale(0.97); }

.gcb-btn-primary {
	background: var(--gcb-primary);
	color: #fff;
	border: none;
}
.gcb-btn-primary:hover { background: var(--gcb-primary-hover); }
.gcb-btn-primary:disabled { opacity: 0.5; cursor: default; }

.gcb-btn-secondary {
	background: transparent;
	color: var(--gcb-text-light);
	border: 1px solid var(--gcb-border);
}
.gcb-btn-secondary:hover { background: var(--gcb-bg-secondary); }

.gcb-modal-success { text-align: center; padding: 8px 0; }
.gcb-modal-success svg { width: 48px; height: 48px; fill: var(--gcb-green); margin-bottom: 12px; }
.gcb-modal-success p { font-size: 15px; font-weight: 500; color: var(--gcb-text); margin: 0; }

/* --- Toast --- */
.gcb-toast {
	position: fixed;
	bottom: 100px;
	right: 24px;
	background: var(--gcb-primary);
	color: #fff;
	padding: 10px 20px;
	border-radius: var(--gcb-radius-sm);
	font-size: 13px;
	font-family: var(--gcb-font);
	z-index: 10003;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.2s, transform 0.2s;
	pointer-events: none;
	box-shadow: var(--gcb-shadow-md);
}

.gcb-toast.gcb-toast-show {
	opacity: 1;
	transform: translateY(0);
}

/* --- Mobile --- */
@media (max-width: 480px) {
	#gcb-container {
		width: 100vw;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		bottom: 0;
		right: 0;
		border-radius: 0;
		border: none;
	}

	#gcb-launcher {
		bottom: 16px;
		right: 16px;
	}

	.gcb-modal {
		width: calc(100vw - 32px);
	}
}
