/**
 * Colin Booking Chat — Widget Stylesheet
 *
 * Premium dark-themed chat widget for booking assistance.
 * All classes prefixed with `cbc-`.
 */

/* ----------------------------------------------------------------
   Custom Properties
   ---------------------------------------------------------------- */
.cbc-widget {
	--cbc-bg: #161022;
	--cbc-primary: #7c3aed;
	--cbc-primary-hover: #6d28d9;
	--cbc-text: #f1f5f9;
	--cbc-text-muted: #94a3b8;
	--cbc-surface: #1e1632;
	--cbc-border: rgba(124, 58, 237, 0.15);
	--cbc-radius: 12px;
	--cbc-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ----------------------------------------------------------------
   Layout & Positioning
   ---------------------------------------------------------------- */
.cbc-widget {
	position: fixed;
	bottom: 0;
	right: 0;
	z-index: 60;
	font-family: 'Inter', sans-serif;
}

/* ----------------------------------------------------------------
   Launcher Button
   ---------------------------------------------------------------- */
.cbc-launcher {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--cbc-primary);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	animation: cbcPulse 3s infinite;
}

.cbc-launcher:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 24px rgba(124, 58, 237, 0.55);
}

.cbc-launcher-icon {
	width: 24px;
	height: 24px;
	fill: #fff;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.cbc-launcher-icon--close {
	position: absolute;
	opacity: 0;
	transform: scale(0.5);
}

.cbc-widget.cbc-open .cbc-launcher-icon--chat {
	opacity: 0;
	transform: scale(0.5);
}

.cbc-widget.cbc-open .cbc-launcher-icon--close {
	opacity: 1;
	transform: scale(1);
}

.cbc-widget.cbc-open .cbc-launcher {
	animation: none;
}

/* ----------------------------------------------------------------
   Panel
   ---------------------------------------------------------------- */
.cbc-panel {
	position: fixed;
	bottom: 96px;
	right: 24px;
	width: 380px;
	height: 520px;
	border-radius: 16px;
	background: var(--cbc-bg);
	border: 1px solid var(--cbc-border);
	box-shadow: var(--cbc-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(16px) scale(0.95);
	pointer-events: none;
	visibility: hidden;
	transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cbc-widget.cbc-open .cbc-panel {
	opacity: 1;
	transform: none;
	pointer-events: auto;
	visibility: visible;
}

/* ----------------------------------------------------------------
   Panel Header
   ---------------------------------------------------------------- */
.cbc-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--cbc-border);
	background: var(--cbc-surface);
}

.cbc-panel-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
}

.cbc-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--cbc-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 14px;
	color: #fff;
	flex-shrink: 0;
}

.cbc-panel-title {
	font-weight: 600;
	font-size: 14px;
	color: var(--cbc-text);
}

.cbc-panel-subtitle {
	font-size: 12px;
	color: var(--cbc-text-muted);
}

.cbc-panel-close {
	width: 32px;
	height: 32px;
	background: transparent;
	border: none;
	color: var(--cbc-text-muted);
	cursor: pointer;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

.cbc-panel-close:hover {
	background: rgba(255, 255, 255, 0.05);
}

/* ----------------------------------------------------------------
   Messages Area
   ---------------------------------------------------------------- */
.cbc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	scrollbar-width: thin;
	scrollbar-color: rgba(124, 58, 237, 0.3) transparent;
}

.cbc-messages::-webkit-scrollbar {
	width: 6px;
}

.cbc-messages::-webkit-scrollbar-track {
	background: transparent;
}

.cbc-messages::-webkit-scrollbar-thumb {
	background: rgba(124, 58, 237, 0.3);
	border-radius: 3px;
}

.cbc-message {
	max-width: 85%;
	animation: cbcFadeIn 0.3s ease;
}

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

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

.cbc-message-bubble {
	padding: 12px 16px;
	border-radius: var(--cbc-radius);
	font-size: 14px;
	line-height: 1.5;
}

.cbc-message--bot .cbc-message-bubble {
	background: rgba(124, 58, 237, 0.08);
	border: 1px solid rgba(124, 58, 237, 0.12);
	color: var(--cbc-text);
	backdrop-filter: blur(8px);
}

.cbc-message--user .cbc-message-bubble {
	background: var(--cbc-primary);
	color: #fff;
	border-radius: var(--cbc-radius) var(--cbc-radius) 4px var(--cbc-radius);
}

.cbc-message-time {
	font-size: 11px;
	color: var(--cbc-text-muted);
	margin-top: 4px;
}

/* ----------------------------------------------------------------
   Typing Indicator
   ---------------------------------------------------------------- */
.cbc-typing {
	display: flex;
	gap: 4px;
	padding: 12px 16px;
	background: rgba(124, 58, 237, 0.08);
	border: 1px solid rgba(124, 58, 237, 0.12);
	backdrop-filter: blur(8px);
	border-radius: var(--cbc-radius);
	align-self: flex-start;
}

.cbc-typing-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--cbc-text-muted);
	animation: cbcBounce 1.4s infinite;
}

.cbc-typing-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.cbc-typing-dot:nth-child(3) {
	animation-delay: 0.4s;
}

/* ----------------------------------------------------------------
   Quick Replies
   ---------------------------------------------------------------- */
.cbc-quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 20px 8px;
}

.cbc-quick-replies:empty {
	display: none;
}

.cbc-quick-reply {
	padding: 8px 16px;
	border-radius: 20px;
	border: 1px solid var(--cbc-primary);
	background: transparent;
	color: var(--cbc-primary);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s ease;
	white-space: nowrap;
	animation: cbcSlideUp 0.3s ease both;
}

.cbc-quick-reply:hover {
	background: var(--cbc-primary);
	color: #fff;
}

.cbc-quick-reply:nth-child(1) { animation-delay: 0.05s; }
.cbc-quick-reply:nth-child(2) { animation-delay: 0.10s; }
.cbc-quick-reply:nth-child(3) { animation-delay: 0.15s; }
.cbc-quick-reply:nth-child(4) { animation-delay: 0.20s; }
.cbc-quick-reply:nth-child(5) { animation-delay: 0.25s; }
.cbc-quick-reply:nth-child(6) { animation-delay: 0.30s; }

/* ----------------------------------------------------------------
   Input Area
   ---------------------------------------------------------------- */
.cbc-input-area {
	border-top: 1px solid var(--cbc-border);
	background: var(--cbc-surface);
}

.cbc-input-form {
	display: flex;
	padding: 12px 16px;
	gap: 8px;
	align-items: center;
}

.cbc-input {
	flex: 1;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 24px;
	padding: 10px 16px;
	color: var(--cbc-text);
	font-size: 14px;
	outline: none;
	transition: border-color 0.15s ease;
}

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

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

.cbc-input:disabled {
	opacity: 0.5;
}

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

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

.cbc-send:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.cbc-send svg {
	width: 16px;
	height: 16px;
}

/* ----------------------------------------------------------------
   Slot Grid
   ---------------------------------------------------------------- */
.cbc-slots {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	padding: 8px 0;
}

.cbc-slot {
	padding: 8px 12px;
	border-radius: 8px;
	border: 1px solid var(--cbc-border);
	background: transparent;
	color: var(--cbc-text);
	font-size: 13px;
	cursor: pointer;
	text-align: center;
	transition: all 0.15s ease;
}

.cbc-slot:hover {
	border-color: var(--cbc-primary);
	background: rgba(124, 58, 237, 0.1);
}

.cbc-slot--selected {
	background: var(--cbc-primary);
	color: #fff;
	border-color: var(--cbc-primary);
}

/* ----------------------------------------------------------------
   Confirmation
   ---------------------------------------------------------------- */
.cbc-confirmation {
	text-align: center;
	padding: 20px 0;
}

.cbc-confirmation-icon {
	width: 48px;
	height: 48px;
	margin: 0 auto;
	border-radius: 50%;
	background: rgba(34, 197, 94, 0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #22c55e;
}

.cbc-confirmation-title {
	font-size: 16px;
	font-weight: 600;
	margin-top: 12px;
	color: var(--cbc-text);
}

.cbc-confirmation-detail {
	font-size: 13px;
	color: var(--cbc-text-muted);
	margin-top: 4px;
}

.cbc-confirmation-link {
	display: inline-block;
	margin-top: 16px;
	color: var(--cbc-primary);
	text-decoration: none;
	font-weight: 500;
}

/* ----------------------------------------------------------------
   Error State
   ---------------------------------------------------------------- */
.cbc-error {
	padding: 12px 16px;
	background: rgba(239, 68, 68, 0.1);
	border: 1px solid rgba(239, 68, 68, 0.2);
	border-radius: var(--cbc-radius);
	color: #fca5a5;
	font-size: 13px;
}

.cbc-error a {
	color: var(--cbc-primary);
}

.cbc-retry-btn {
	margin-top: 8px;
	padding: 6px 12px;
	background: transparent;
	border: 1px solid var(--cbc-primary);
	color: var(--cbc-primary);
	border-radius: 8px;
	font-size: 12px;
	cursor: pointer;
}

/* ----------------------------------------------------------------
   Animations
   ---------------------------------------------------------------- */
@keyframes cbcFadeIn {
	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes cbcSlideUp {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes cbcBounce {
	0%,
	80%,
	100% {
		transform: scale(0);
	}

	40% {
		transform: scale(1);
	}
}

@keyframes cbcPulse {
	0%,
	100% {
		box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
	}

	50% {
		box-shadow: 0 0 0 12px rgba(124, 58, 237, 0);
	}
}

/* ----------------------------------------------------------------
   Mobile Responsive
   ---------------------------------------------------------------- */
@media (max-width: 639px) {
	.cbc-panel {
		width: 100%;
		height: 100%;
		bottom: 0;
		right: 0;
		top: 0;
		position: fixed;
		border-radius: 0;
	}

	.cbc-launcher {
		bottom: 16px;
		right: 16px;
	}

	.cbc-input-area {
		padding-bottom: env(safe-area-inset-bottom);
	}

	.cbc-input {
		padding-bottom: calc(10px + env(safe-area-inset-bottom));
	}
}

/* ----------------------------------------------------------------
   Reduced Motion
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.cbc-widget,
	.cbc-widget * {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

/* ----------------------------------------------------------------
   Utility
   ---------------------------------------------------------------- */
.cbc-hidden {
	display: none;
}
