/* MediBot front-end styles */

/* ---- Floating launcher + popup ---- */

.medibot-float {
	position: fixed;
	right: max(16px, env(safe-area-inset-right, 16px));
	bottom: max(16px, env(safe-area-inset-bottom, 16px));
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.medibot-launcher-wrap {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.medibot-launcher-label {
	position: absolute;
	bottom: calc(100% + 8px);
	right: 0;
	max-width: min(220px, 70vw);
	padding: 6px 12px;
	border-radius: 999px;
	background: #1f6feb;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	box-shadow: 0 4px 14px rgba(31, 111, 235, 0.35);
	pointer-events: none;
	user-select: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.medibot-launcher-wrap.is-open .medibot-launcher-label {
	opacity: 0;
	transform: translateY(4px);
	visibility: hidden;
}

.medibot-launcher {
	width: 60px;
	height: 60px;
	border: none;
	border-radius: 50%;
	background: #1f6feb;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 24px rgba(31, 111, 235, 0.45);
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
	padding: 0;
}

.medibot-launcher:hover {
	transform: scale(1.06);
	box-shadow: 0 8px 28px rgba(31, 111, 235, 0.55);
	background: #1a5fd4;
}

.medibot-launcher:focus-visible {
	outline: 3px solid #1f6feb;
	outline-offset: 3px;
}

.medibot-launcher svg {
	width: 28px;
	height: 28px;
	fill: currentColor;
}

.medibot-launcher.is-open {
	background: #495057;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.medibot-launcher.is-open svg {
	transform: rotate(0deg);
}

.medibot-popup {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	z-index: 999998;
}

.medibot-popup.is-open {
	pointer-events: auto;
	opacity: 1;
	visibility: visible;
}

.medibot-popup-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.medibot-popup-panel {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: min(85vh, 720px);
	margin: 0;
	display: flex;
	flex-direction: column;
	transform: translateY(16px) scale(0.98);
	transition: transform 0.25s ease;
	z-index: 1;
}

.medibot-popup.is-open .medibot-popup-panel {
	transform: translateY(0) scale(1);
}

/* Chat widget inside popup */
.medibot-widget {
	width: 100%;
	height: 100%;
	max-height: min(85vh, 720px);
	border: 1px solid #e2e6ea;
	border-radius: 16px 16px 0 0;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	background: #fff;
	display: flex;
	flex-direction: column;
}

.medibot-header {
	background: #1f6feb;
	color: #fff;
	padding: 14px 18px;
	font-weight: 600;
	font-size: 15px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-shrink: 0;
}

.medibot-header-title {
	flex: 1;
	min-width: 0;
	line-height: 1.3;
}

.medibot-close {
	background: transparent;
	border: none;
	color: #fff;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s ease;
	padding: 0;
}

.medibot-close:hover {
	background: rgba(255, 255, 255, 0.18);
}

.medibot-reset {
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.35);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	padding: 6px 10px;
	border-radius: 999px;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s ease;
}

.medibot-reset:hover {
	background: rgba(255, 255, 255, 0.22);
}

.medibot-close svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.medibot-body {
	padding: 16px;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

body.medibot-popup-open {
	overflow: hidden;
}

/* Tablet / desktop: popup anchored near launcher */
@media (min-width: 481px) {
	.medibot-popup {
		align-items: flex-end;
		justify-content: flex-end;
		padding: 0 max(16px, env(safe-area-inset-right, 16px)) max(88px, calc(16px + env(safe-area-inset-bottom, 16px)));
	}

	.medibot-popup-panel {
		max-width: 400px;
		border-radius: 16px;
	}

	.medibot-widget {
		border-radius: 16px;
		max-height: min(80vh, 680px);
	}
}

/* Mobile: full-width bottom sheet */
@media (max-width: 480px) {
	.medibot-popup {
		align-items: stretch;
		justify-content: flex-end;
		padding: 0;
	}

	.medibot-popup-panel {
		max-width: 100%;
		max-height: 92vh;
		max-height: 92dvh;
	}

	.medibot-widget {
		border-radius: 16px 16px 0 0;
		max-height: 92vh;
		max-height: 92dvh;
		border-left: none;
		border-right: none;
		border-bottom: none;
	}

	.medibot-launcher {
		width: 56px;
		height: 56px;
	}

	.medibot-launcher svg {
		width: 26px;
		height: 26px;
	}
}

.medibot-msg {
	padding: 10px 14px;
	border-radius: 14px;
	max-width: 85%;
	font-size: 14px;
	line-height: 1.4;
}

.medibot-bot {
	background: #f1f3f5;
	color: #1a1a1a;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}

.medibot-user {
	background: #1f6feb;
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}

.medibot-options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 4px;
}

.medibot-option {
	background: #fff;
	border: 1.5px solid #1f6feb;
	color: #1f6feb;
	border-radius: 20px;
	padding: 10px 16px;
	min-height: 44px;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	touch-action: manipulation;
}

.medibot-option:hover {
	background: #1f6feb;
	color: #fff;
}

.medibot-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f8f9fa;
	padding: 14px;
	border-radius: 10px;
}

.medibot-input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ced4da;
	border-radius: 8px;
	font-size: 14px;
	box-sizing: border-box;
}

.medibot-consent {
	font-size: 12px;
	line-height: 1.4;
	color: #495057;
	display: flex;
	gap: 8px;
	align-items: flex-start;
}

.medibot-primary {
	background: #1f6feb;
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 11px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.medibot-primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.medibot-secondary {
	background: transparent;
	color: #6c757d;
	border: 1px solid #ced4da;
	border-radius: 8px;
	padding: 9px;
	font-size: 13px;
	cursor: pointer;
}

.medibot-error {
	color: #b32d2e;
	font-size: 12px;
}

.medibot-status,
.medibot-success {
	color: #1a7f37;
	font-size: 14px;
	font-weight: 600;
}

/* Booking page */
.medibot-booking-page {
	margin: 0;
	background: #f1f3f5;
}

.medibot-booking-shell {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.medibot-booking-card {
	background: #fff;
	border-radius: 16px;
	padding: 32px;
	max-width: 920px;
	width: 100%;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.medibot-booking-card h1 {
	margin-top: 0;
	font-size: 22px;
	color: #1a1a1a;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.medibot-booking-doctor {
	margin: 0 0 12px;
	font-size: 15px;
	line-height: 1.5;
	color: #1a1a1a;
}

.medibot-booking-doctor span {
	color: #6c757d;
	font-size: 14px;
}

.medibot-booking-patient {
	margin: 0 0 20px;
	padding: 12px 14px;
	background: #f1f3f5;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.5;
	color: #495057;
}

.medibot-loading {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: #495057;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.medibot-booking-card .medibot-error {
	text-transform: uppercase;
}

/* Calendar + booking layout */
.medibot-booking-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.95fr);
	gap: 24px;
	align-items: start;
	margin-top: 8px;
}

.medibot-booking-dates {
	min-width: 0;
}

.medibot-booking-times {
	min-width: 0;
	min-height: 280px;
	padding: 16px;
	background: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 12px;
}

.medibot-booking-times-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 220px;
	text-align: center;
	color: #868e96;
	font-size: 14px;
	line-height: 1.5;
	text-transform: uppercase;
}

.medibot-booking-times-empty p {
	margin: 0;
}

.medibot-calendar {
	margin-top: 0;
}

.medibot-cal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.medibot-cal-title {
	font-weight: 600;
	font-size: 16px;
	color: #1a1a1a;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.medibot-cal-nav {
	background: #f1f3f5;
	border: none;
	border-radius: 8px;
	width: 36px;
	height: 36px;
	font-size: 20px;
	cursor: pointer;
	color: #495057;
	line-height: 1;
}

.medibot-cal-nav:hover {
	background: #e9ecef;
}

.medibot-cal-weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
	margin-bottom: 6px;
	text-align: center;
}

.medibot-cal-wd {
	font-size: 12px;
	font-weight: 600;
	color: #868e96;
	text-transform: uppercase;
}

.medibot-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
}

.medibot-cal-day {
	aspect-ratio: 1;
	border: none;
	border-radius: 8px;
	background: #f8f9fa;
	font-size: 14px;
	color: #adb5bd;
	cursor: default;
}

.medibot-cal-day.empty {
	background: transparent;
}

.medibot-cal-day.has-slots {
	background: #e7f0ff;
	color: #1f6feb;
	font-weight: 600;
	cursor: pointer;
}

.medibot-cal-day.has-slots:hover {
	background: #cfe0fc;
}

.medibot-cal-day.selected {
	background: #1f6feb;
	color: #fff;
}

.medibot-cal-day.today {
	box-shadow: inset 0 0 0 2px #1f6feb;
}

.medibot-time-slots {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.medibot-times-title {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 600;
	color: #1a1a1a;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.medibot-slot-list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	margin-top: 0;
}

.medibot-slot-select {
	width: 100%;
	padding: 12px 14px;
	border: 1.5px solid #1f6feb;
	border-radius: 10px;
	font-size: 15px;
	font-weight: 600;
	color: #1a1a1a;
	background: #fff;
	box-sizing: border-box;
	cursor: pointer;
	appearance: auto;
	text-transform: uppercase;
}

.medibot-slot-select:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.2);
}

.medibot-slot {
	background: #fff;
	border: 1.5px solid #1f6feb;
	color: #1f6feb;
	border-radius: 10px;
	padding: 14px;
	font-size: 15px;
	cursor: pointer;
	text-align: left;
	transition: background 0.15s, color 0.15s;
}

.medibot-slot:hover {
	background: #1f6feb;
	color: #fff;
}

.medibot-slot.selected {
	background: #1f6feb;
	color: #fff;
}

.medibot-slot:disabled {
	opacity: 0.5;
	cursor: wait;
}

.medibot-booking-confirm {
	margin-top: 18px;
	padding: 16px;
	background: #f0f6ff;
	border: 1px solid #c5d9f7;
	border-radius: 12px;
}

.medibot-booking-confirm-label {
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 600;
	color: #495057;
	text-transform: uppercase;
}

.medibot-booking-confirm-value {
	margin: 0 0 14px;
	font-size: 16px;
	font-weight: 700;
	color: #1a1a1a;
}

.medibot-confirm-btn {
	width: 100%;
	background: #1f6feb;
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 14px 18px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.medibot-confirm-btn:hover:not(:disabled) {
	background: #1558c4;
}

.medibot-confirm-btn:disabled {
	opacity: 0.7;
	cursor: wait;
}

@media (max-width: 720px) {
	.medibot-booking-layout {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.medibot-booking-times {
		min-height: 0;
	}
}

/* Triage score result */
.medibot-triage-result {
	border: 3px solid #ced4da;
	border-radius: 12px;
	padding: 16px;
	margin-top: 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.medibot-score-badge {
	color: #fff;
	font-weight: 700;
	font-size: 13px;
	padding: 8px 14px;
	border-radius: 20px;
	align-self: flex-start;
}

.medibot-triage-urgency {
	font-size: 14px;
	font-weight: 600;
	margin: 0;
	color: #1a1a1a;
	line-height: 1.4;
}

.medibot-triage-display {
	font-size: 13px;
	margin: 0;
	color: #495057;
	line-height: 1.5;
}

.medibot-options-menu {
	flex-direction: column;
}

.medibot-options-menu .medibot-option {
	text-align: left;
	width: 100%;
	border-radius: 10px;
}

.medibot-option-yes {
	border-color: #28a745;
	color: #28a745;
}

.medibot-option-yes:hover {
	background: #28a745;
	color: #fff;
}

.medibot-option-no {
	border-color: #6c757d;
	color: #6c757d;
}

.medibot-option-no:hover {
	background: #6c757d;
	color: #fff;
}
