/* ── AI Scheduling Chatbot — Widget Styles v1.0.0 ── */

:root {
	--aichat-color: var(--rankd-color, #2c7a7b);
	--aichat-radius: 16px;
	--aichat-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
	--aichat-z: 999999;
}

/* ── Positioning ── */

#rankd-aichat-widget {
	position: fixed;
	bottom: 24px;
	z-index: var(--aichat-z);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

.rankd-aichat-position-bottom-right { right: 24px; }
.rankd-aichat-position-bottom-left  { left: 24px; }

/* ── Bubble ── */

#rankd-aichat-bubble {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--rankd-color, #2c7a7b);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--aichat-shadow);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	color: #fff;
	margin-left: auto;
}

#rankd-aichat-bubble:hover {
	transform: scale(1.08);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

#rankd-aichat-bubble svg {
	width: 26px;
	height: 26px;
	transition: opacity 0.15s ease, transform 0.15s ease;
}

#rankd-aichat-bubble .rankd-aichat-icon-chat  { opacity: 1; position: absolute; }
#rankd-aichat-bubble .rankd-aichat-icon-close { opacity: 0; position: absolute; transform: rotate(-90deg); }

#rankd-aichat-widget.is-open .rankd-aichat-icon-chat  { opacity: 0; transform: rotate(90deg); }
#rankd-aichat-widget.is-open .rankd-aichat-icon-close { opacity: 1; transform: rotate(0deg); }

/* ── Panel ── */

#rankd-aichat-panel {
	position: absolute;
	bottom: 70px;
	width: 360px;
	min-height: 520px;
	max-height: 640px;
	background: #fff;
	border-radius: var(--aichat-radius);
	box-shadow: var(--aichat-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform: scale(0.95) translateY(10px);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.rankd-aichat-position-bottom-right #rankd-aichat-panel { right: 0; }
.rankd-aichat-position-bottom-left  #rankd-aichat-panel { left: 0; }

#rankd-aichat-widget.is-open #rankd-aichat-panel {
	transform: scale(1) translateY(0);
	opacity: 1;
	pointer-events: all;
}

#rankd-aichat-panel[hidden] {
	display: flex; /* override hidden so CSS transition works */
}

/* ── Header ── */

#rankd-aichat-header {
	background: var(--rankd-color, #2c7a7b);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.rankd-aichat-header-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	font-weight: 700;
	flex-shrink: 0;
}

.rankd-aichat-header-info strong {
	display: block;
	font-size: 15px;
	font-weight: 600;
}

.rankd-aichat-header-info span {
	font-size: 12px;
	opacity: 0.8;
}

/* ── Messages ── */

#rankd-aichat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	scroll-behavior: smooth;
}

.rankd-aichat-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.55;
	word-wrap: break-word;
}

.rankd-aichat-msg a {
	color: inherit;
	text-decoration: underline;
}

.rankd-aichat-msg-bot {
	background: #f1f3f4;
	color: #202124;
	border-bottom-left-radius: 4px;
	align-self: flex-start;
}

.rankd-aichat-msg-user {
	background: var(--rankd-color, #2c7a7b);
	color: #fff;
	border-bottom-right-radius: 4px;
	align-self: flex-end;
}

/* Typing indicator */
.rankd-aichat-typing {
	display: flex;
	gap: 4px;
	align-items: center;
	padding: 12px 14px;
}

.rankd-aichat-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #aaa;
	animation: aichat-bounce 1.2s ease-in-out infinite;
}

.rankd-aichat-typing span:nth-child(2) { animation-delay: 0.15s; }
.rankd-aichat-typing span:nth-child(3) { animation-delay: 0.30s; }

@keyframes aichat-bounce {
	0%, 60%, 100% { transform: translateY(0); }
	30%            { transform: translateY(-5px); }
}

/* ── Input ── */

#rankd-aichat-input-wrap {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px 14px;
	border-top: 1px solid #e8eaed;
	flex-shrink: 0;
}

#rankd-aichat-input {
	flex: 1;
	border: 1px solid #dadce0;
	border-radius: 20px;
	padding: 9px 14px;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	outline: none;
	max-height: 120px;
	overflow-y: auto;
	line-height: 1.4;
	transition: border-color 0.15s;
}

#rankd-aichat-input:focus {
	border-color: var(--aichat-color);
}

#rankd-aichat-send {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--rankd-color, #2c7a7b);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: #fff;
	transition: background 0.15s, transform 0.1s;
}

#rankd-aichat-send:hover    { filter: brightness(1.1); }
#rankd-aichat-send:active   { transform: scale(0.92); }
#rankd-aichat-send:disabled { opacity: 0.4; cursor: not-allowed; }

#rankd-aichat-send svg {
	width: 18px;
	height: 18px;
}

/* ── Footer ── */

#rankd-aichat-footer {
	text-align: center;
	font-size: 11px;
	color: #aaa;
	padding: 6px 0 8px;
	flex-shrink: 0;
}

/* ── Mobile ── */

@media ( max-width: 420px ) {
	#rankd-aichat-panel {
		width: calc(100vw - 32px);
		max-height: 70vh;
	}
	.rankd-aichat-position-bottom-right #rankd-aichat-panel { right: 0; }
	.rankd-aichat-position-bottom-left  #rankd-aichat-panel { left: 0; }
}

/* ── Booking button ── */

.rankd-aichat-book-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	padding: 9px 16px;
	background: var(--rankd-accent, var(--rankd-color, #2c7a7b));
	color: #fff;
	border: none;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	font-family: inherit;
	transition: filter 0.15s, transform 0.1s;
}

.rankd-aichat-book-btn:hover  { filter: brightness(1.1); }
.rankd-aichat-book-btn:active { transform: scale(0.96); }

/* ── Typing label ── */

.rankd-aichat-typing-label {
	font-size: 11px;
	color: #999;
	margin-left: 6px;
	font-style: italic;
}

/* ── Footer reset button ── */

#rankd-aichat-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 14px 8px;
	flex-shrink: 0;
}

#rankd-aichat-reset {
	background: none;
	border: none;
	font-size: 11px;
	color: #aaa;
	cursor: pointer;
	padding: 0;
	font-family: inherit;
	text-decoration: underline;
}

#rankd-aichat-reset:hover { color: #666; }

#rankd-aichat-footer span {
	font-size: 11px;
	color: #aaa;
}

/* ── Elementor z-index override ── */
#rankd-aichat-widget { z-index: 999999 !important; }

/* ── Option buttons ───────────────────────────────────────────────────── */

.rankd-aichat-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 8px 0 4px 0;
	padding: 0 14px;
}

.rankd-aichat-option-btn {
	display: inline-flex;
	align-items: center;
	padding: 7px 16px;
	border-radius: 20px;
	border: 2px solid var(--rankd-accent, var(--rankd-color, #2c7a7b)) !important;
	background: #fff !important;
	color: var(--rankd-accent, var(--rankd-color, #2c7a7b)) !important;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, color 0.15s, transform 0.1s;
	line-height: 1.3;
	white-space: nowrap;
}

.rankd-aichat-option-btn:hover:not(:disabled) {
	background: var(--rankd-accent, var(--rankd-color, #2c7a7b));
	color: #fff;
}

.rankd-aichat-option-btn:active:not(:disabled) {
	transform: scale(0.96);
}

.rankd-aichat-option-btn:disabled {
	cursor: default;
}

/* ── Mini Calendar ────────────────────────────────────────────────────── */

.rankd-aichat-cal {
	width: 100%;
	max-width: 280px;
	margin: 8px 0 4px;
	font-size: 13px;
	user-select: none;
}

.rankd-cal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.rankd-cal-title {
	font-weight: 600;
	font-size: 13px;
	color: #202124;
}

.rankd-cal-nav {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	padding: 2px 6px;
	color: #646970;
	border-radius: 4px;
	transition: background 0.15s;
}

.rankd-cal-nav:hover:not(:disabled) {
	background: #f0f0f0;
	color: #202124;
}

.rankd-cal-grid {
	display: grid;
	grid-template-columns: repeat( 7, 1fr );
	gap: 2px;
}

.rankd-cal-dow span {
	text-align: center;
	font-size: 11px;
	font-weight: 600;
	color: #8c8f94;
	padding: 2px 0;
}

.rankd-cal-day,
.rankd-cal-empty {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-size: 12px;
	font-weight: 500;
}

/* Available date — clickable */
button.rankd-cal-day.rankd-cal-avail {
	background: var(--accent, var(--rankd-accent, var(--rankd-color, #2c7a7b)));
	color: #fff !important;
	border: none;
	cursor: pointer;
	transition: filter 0.15s, transform 0.1s;
}

button.rankd-cal-day.rankd-cal-avail:hover {
	filter: brightness( 1.15 );
	transform: scale( 1.1 );
}

button.rankd-cal-day.rankd-cal-avail:active {
	transform: scale( 0.95 );
}

/* No slots on this day */
span.rankd-cal-day.rankd-cal-none {
	color: #c0c0c0;
}

/* Past date */
span.rankd-cal-day.rankd-cal-past {
	color: #d0d0d0;
}

/* Calendar wrapper inside message area */
.rankd-aichat-cal-wrap {
	padding: 4px 14px 8px;
}

/* ── Mini Calendar ─────────────────────────────────────────────────────── */

.rankd-aichat-cal-wrap {
	margin: 4px 8px 8px;
}

.rankd-cal {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	width: 100%;
	max-width: 260px;
	font-size: 12px;
	box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.rankd-cal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 8px;
	background: var(--rankd-color, #2c7a7b) !important;
	color: #fff !important;
}

.rankd-cal-title {
	font-weight: 600;
	font-size: 12px;
	color: #fff !important;
}

.rankd-cal-nav {
	background: rgba(0,0,0,.18) !important;
	border: none !important;
	color: #fff !important;
	font-size: 20px;
	font-weight: 700;
	cursor: pointer;
	padding: 2px 8px;
	line-height: 1;
	border-radius: 4px;
	transition: background 0.15s;
	box-shadow: none !important;
	min-width: 28px;
	text-align: center;
}

.rankd-cal-nav:hover:not(:disabled) {
	background: rgba(0,0,0,.35) !important;
}

.rankd-cal-nav:disabled {
	opacity: 0.25;
	cursor: default;
}

.rankd-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 1px;
	padding: 4px;
}

.rankd-cal-dow {
	text-align: center;
	font-size: 9px;
	font-weight: 700;
	color: #999;
	padding: 2px 0 3px;
	text-transform: uppercase;
}

.rankd-cal-blank {
	/* empty spacer cell */
}

/* Base day cell — reset ALL theme styles */
#rankd-aichat-widget .rankd-cal-day,
#rankd-aichat-widget .rankd-cal-day:focus,
#rankd-aichat-widget .rankd-cal-day:active {
	all: unset;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1;
	border-radius: 50%;
	font-size: 11px;
	font-weight: 500;
	cursor: default;
	font-family: inherit;
	box-sizing: border-box;
	transition: background 0.12s, color 0.12s;
	background: transparent !important;
	color: #333 !important;
	border: none !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
}

#rankd-aichat-widget .rankd-cal-avail {
	background: color-mix(in srgb, var(--rankd-color, #2c7a7b) 18%, white) !important;
	color: var(--rankd-color, #2c7a7b) !important;
	cursor: pointer !important;
	font-weight: 700 !important;
}

#rankd-aichat-widget .rankd-cal-avail:hover {
	background: var(--rankd-color, #2c7a7b) !important;
	color: #fff !important;
}

#rankd-aichat-widget .rankd-cal-selected {
	background: var(--rankd-color, #2c7a7b) !important;
	color: #fff !important;
}

#rankd-aichat-widget .rankd-cal-past,
#rankd-aichat-widget .rankd-cal-unavail {
	color: #ccc !important;
	font-weight: 400 !important;
	background: transparent !important;
}
