/**
 * Suapify Chatbot styles: frontend widget + admin conversations page.
 * All selectors are prefixed .suapify-cb- to avoid theme collisions.
 */

/* =========================================================
   FRONTEND WIDGET
   ========================================================= */

.suapify-cb {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.suapify-cb-bubble {
	position: relative;
	width: 56px;
	height: 56px;
	border: none;
	border-radius: 50%;
	background: #1e10c1;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease, background 0.15s ease;
}

.suapify-cb-bubble:hover {
	transform: scale(1.06);
	background: #3a2ed6;
}

.suapify-cb-bubble-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #d93025;
	color: #fff;
	font-size: 12px;
	line-height: 20px;
	text-align: center;
	font-weight: 700;
}

.suapify-cb-panel {
	position: absolute;
	right: 0;
	bottom: 70px;
	width: 360px;
	max-width: calc(100vw - 40px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.suapify-cb-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	background: #1e10c1;
	color: #fff;
}

.suapify-cb-head-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #9aa0a6;
	flex: 0 0 auto;
}

.suapify-cb-head-dot.is-ai { background: #34a853; }
.suapify-cb-head-dot.is-human { background: #fbbc04; }
.suapify-cb-head-dot.is-closed { background: #9aa0a6; }

.suapify-cb-head-title {
	font-weight: 700;
	font-size: 15px;
}

.suapify-cb-head-mode {
	font-size: 11px;
	opacity: 0.85;
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.suapify-cb-head-btn {
	border: none;
	background: transparent;
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.suapify-cb-context {
	padding: 6px 14px;
	background: #edebfb;
	color: #1e10c1;
	font-size: 12px;
	font-weight: 600;
	border-bottom: 1px solid #d9d5f6;
}

.suapify-cb-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: #f6f8f9;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.suapify-cb-msg {
	display: flex;
	flex-direction: column;
	max-width: 85%;
}

.suapify-cb-msg-user {
	align-self: flex-end;
	align-items: flex-end;
}

.suapify-cb-msg-model,
.suapify-cb-msg-admin {
	align-self: flex-start;
	align-items: flex-start;
}

.suapify-cb-msg-bubble {
	padding: 9px 12px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.45;
	word-wrap: break-word;
	overflow-wrap: break-word;
	white-space: normal;
}

.suapify-cb-msg-user .suapify-cb-msg-bubble {
	background: #1e10c1;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.suapify-cb-msg-model .suapify-cb-msg-bubble {
	background: #fff;
	color: #202124;
	border: 1px solid #e3e7e9;
	border-bottom-left-radius: 4px;
}

.suapify-cb-msg-admin .suapify-cb-msg-bubble {
	background: #fff8e6;
	color: #202124;
	border: 1px solid #f2dfa4;
	border-bottom-left-radius: 4px;
}

.suapify-cb-msg-time {
	font-size: 10px;
	color: #9aa0a6;
	margin-top: 2px;
}

.suapify-cb-msg-system {
	align-self: center;
	max-width: 95%;
	text-align: center;
}

.suapify-cb-msg-system-text {
	font-size: 12px;
	color: #5f6368;
	background: #ecf0f1;
	border-radius: 10px;
	padding: 4px 10px;
	display: inline-block;
}

.suapify-cb-typing {
	display: flex;
	gap: 4px;
	padding: 0 16px 10px;
	background: #f6f8f9;
}

.suapify-cb-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9aa0a6;
	animation: suapify-cb-blink 1.2s infinite both;
}

.suapify-cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.suapify-cb-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes suapify-cb-blink {
	0%, 80%, 100% { opacity: 0.25; }
	40% { opacity: 1; }
}

.suapify-cb-inputrow {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #e3e7e9;
	background: #fff;
}

.suapify-cb-inputrow textarea {
	flex: 1;
	resize: none;
	border: 1px solid #dadce0;
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 14px;
	line-height: 1.4;
	max-height: 90px;
	min-height: 38px;
	font-family: inherit;
}

.suapify-cb-inputrow textarea:focus {
	outline: none;
	border-color: #1e10c1;
	box-shadow: 0 0 0 1px #1e10c1;
}

.suapify-cb-inputrow button {
	width: 38px;
	height: 38px;
	flex: 0 0 auto;
	border: none;
	border-radius: 10px;
	background: #1e10c1;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.suapify-cb-inputrow button:hover {
	background: #3a2ed6;
}

/* Mobile: full-height sheet */
@media (max-width: 480px) {
	.suapify-cb-panel {
		position: fixed;
		inset: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
		bottom: 0;
	}
}

/* =========================================================
   ADMIN CONVERSATIONS PAGE
   ========================================================= */

.suapify-cb-settings {
	margin: 12px 0 20px;
	padding: 10px 14px;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	max-width: 900px;
}

.suapify-cb-settings summary {
	cursor: pointer;
	font-weight: 600;
}

.suapify-cb-admin {
	display: flex;
	gap: 16px;
	align-items: stretch;
	max-width: 1400px;
}

.suapify-cb-admin-list-col {
	flex: 0 0 340px;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	overflow: hidden;
}

.suapify-cb-admin-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 8px;
	border-bottom: 1px solid #e0e0e0;
}

.suapify-cb-admin-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	flex: 1;
	min-height: 300px;
	max-height: 60vh;
}

.suapify-cb-admin-list li {
	padding: 10px 12px;
	border-bottom: 1px solid #f0f0f0;
	cursor: pointer;
	margin: 0;
}

.suapify-cb-admin-list li:hover { background: #f6f7f7; }
.suapify-cb-admin-list li.is-active { background: #edebfb; }

.suapify-cb-admin-list .suapify-cb-li-top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 6px;
}

.suapify-cb-admin-list .suapify-cb-li-customer {
	font-weight: 600;
	font-size: 13px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.suapify-cb-admin-list .suapify-cb-li-meta {
	font-size: 11px;
	color: #646970;
	margin-top: 2px;
}

.suapify-cb-status-pill {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	border-radius: 9px;
	padding: 2px 7px;
	flex: 0 0 auto;
}

.suapify-cb-status-pill.ai_active { background: #e6f4ea; color: #137333; }
.suapify-cb-status-pill.human_takeover { background: #fef7e0; color: #b06000; }
.suapify-cb-status-pill.escalated { background: #fce8e6; color: #c5221f; }
.suapify-cb-status-pill.closed { background: #f1f3f4; color: #5f6368; }

.suapify-cb-unread-dot {
	display: inline-block;
	min-width: 18px;
	height: 18px;
	border-radius: 9px;
	background: #d93025;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	padding: 0 4px;
}

.suapify-cb-admin-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 8px;
	border-top: 1px solid #e0e0e0;
}

.suapify-cb-admin-view-col {
	flex: 1;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	min-height: 480px;
}

.suapify-cb-admin-view-head {
	padding: 10px 14px;
	border-bottom: 1px solid #e0e0e0;
	font-size: 13px;
}

.suapify-cb-admin-transcript {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: #f6f8f9;
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 55vh;
}

.suapify-cb-admin-transcript .suapify-cb-msg { max-width: 75%; }

.suapify-cb-msg-note {
	align-self: center;
	max-width: 95%;
	font-size: 11px;
	color: #5f6368;
	background: #eef1f2;
	border: 1px dashed #c9ced1;
	border-radius: 8px;
	padding: 4px 10px;
	font-family: Consolas, Monaco, monospace;
	word-break: break-all;
}

.suapify-cb-admin-actions {
	display: flex;
	gap: 8px;
	padding: 10px 14px;
	border-top: 1px solid #e0e0e0;
}

.suapify-cb-admin-replybox {
	display: flex;
	gap: 8px;
	padding: 0 14px 12px;
	align-items: flex-end;
}

.suapify-cb-admin-replybox textarea {
	flex: 1;
	resize: vertical;
}

@media (max-width: 960px) {
	.suapify-cb-admin { flex-direction: column; }
	.suapify-cb-admin-list-col { flex: 1 1 auto; }
}
