/* =========================================================
   SNH Product Studio – Live Chat Premium (v2.8.0)
   Branding: gold #B3883A · charcoal #24211D (diatur di backend
   via --snh-c1 / --snh-c2).
   ========================================================= */

:root {
	--snh-c1: #b3883a;
	--snh-c2: #24211d;
}

/* ---------- Tombol melayang (FAB) ---------- */
.snh-chat-fab {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	width: 62px;
	height: 62px;
	border-radius: 50%;
	border: 0;
	cursor: pointer;
	background: linear-gradient(135deg, var(--snh-c1), var(--snh-c2));
	color: #fff;
	display: grid;
	place-items: center;
	box-shadow: 0 14px 34px rgba(0, 0, 0, .35);
	transition: transform .18s ease, box-shadow .18s ease;
}
.snh-chat-fab::after {
	content: "";
	position: absolute;
	inset: -6px;
	border-radius: 50%;
	border: 2px solid var(--snh-c1);
	opacity: .55;
	animation: snh-ring 2.4s ease-out infinite;
}
@keyframes snh-ring {
	0% { transform: scale(.85); opacity: .55; }
	70%, 100% { transform: scale(1.25); opacity: 0; }
}
.snh-chat-fab:hover {
	transform: scale(1.08) rotate(3deg);
	box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
}
.snh-chat-fab.is-open { display: none; }
.snh-chat-fab__dot {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: #25d366;
	border: 2.5px solid #fff;
}

/* ---------- Panel ---------- */
.snh-chat {
	position: fixed;
	right: 20px;
	bottom: 94px;
	z-index: 99991;
	width: 356px;
	max-width: calc(100vw - 24px);
	height: 540px;
	max-height: calc(100vh - 140px);
	background: #fff;
	border-radius: 22px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 30px 80px rgba(20, 15, 10, .35);
	opacity: 0;
	transform: translateY(20px) scale(.96);
	transform-origin: bottom right;
	pointer-events: none;
	transition: opacity .24s ease, transform .24s cubic-bezier(.2, .9, .3, 1.2);
}
.snh-chat.is-open {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

/* ---------- Header ---------- */
.snh-chat__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 15px 16px;
	color: #fff;
	background:
		linear-gradient(120deg, var(--snh-c2) 0%, var(--snh-c1) 130%);
	position: relative;
}
.snh-chat__head::after {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(120px 60px at 85% -20%, rgba(255, 255, 255, .22), transparent);
	pointer-events: none;
}
.snh-chat__ava {
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	border-radius: 14px;
	background: rgba(255, 255, 255, .2);
	border: 1.5px solid rgba(255, 255, 255, .45);
	display: grid;
	place-items: center;
	font-weight: 800;
	font-size: 17px;
	overflow: hidden;
}
.snh-chat-ava--img { width: 100%; height: 100%; object-fit: cover; border: 0; }
.snh-chat__id { min-width: 0; flex: 1; position: relative; z-index: 1; }
.snh-chat__id strong { display: block; font-size: 15px; letter-spacing: .02em; }
.snh-chat__id small {
	display: flex;
	align-items: center;
	gap: 6px;
	opacity: .85;
	font-size: 11px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.snh-chat__online {
	width: 8px;
	height: 8px;
	flex: 0 0 8px;
	border-radius: 50%;
	background: #4ade80;
	box-shadow: 0 0 0 3px rgba(74, 222, 128, .25);
}
.snh-chat__head button {
	background: rgba(255, 255, 255, .16);
	border: 0;
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 13px;
	flex: 0 0 30px;
	position: relative;
	z-index: 1;
}
.snh-chat__head button:hover { background: rgba(255, 255, 255, .3); }

/* ---------- Isi chat ---------- */
.snh-chat__body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	background:
		radial-gradient(400px 200px at 110% -10%, rgba(179, 136, 58, .07), transparent),
		#f8f6f2;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.snh-chat__body::-webkit-scrollbar { width: 6px; }
.snh-chat__body::-webkit-scrollbar-thumb { background: #ddd4c4; border-radius: 999px; }

.snh-chat-row { display: flex; align-items: flex-end; gap: 8px; }
.snh-chat-row--user { justify-content: flex-end; }

.snh-chat-ava {
	width: 26px;
	height: 26px;
	flex: 0 0 26px;
	border-radius: 9px;
	background: linear-gradient(135deg, var(--snh-c1), var(--snh-c2));
	color: #fff;
	font-size: 12px;
	font-weight: 800;
	display: grid;
	place-items: center;
	overflow: hidden;
}

.snh-chat-msg {
	max-width: 82%;
	padding: 11px 14px;
	border-radius: 16px;
	font-size: 13.5px;
	line-height: 1.55;
	white-space: pre-line;
	word-wrap: break-word;
}
.snh-chat-msg--bot {
	background: #fff;
	border: 1px solid #ece5d8;
	color: #24211d;
	border-bottom-left-radius: 5px;
	box-shadow: 0 2px 8px rgba(36, 33, 29, .05);
}
.snh-chat-msg--user {
	background: linear-gradient(120deg, var(--snh-c1), var(--snh-c2));
	color: #fff;
	border-bottom-right-radius: 5px;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}

/* ---------- Kartu produk ---------- */
.snh-chat-prods {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: 92%;
	align-self: flex-start;
	margin-left: 34px;
}
.snh-chat-prod {
	display: flex;
	align-items: center;
	gap: 11px;
	background: #fff;
	border: 1px solid #ece5d8;
	border-radius: 15px;
	padding: 8px 12px 8px 8px;
	text-decoration: none;
	box-shadow: 0 3px 10px rgba(36, 33, 29, .07);
	transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
	position: relative;
}
.snh-chat-prod:hover {
	transform: translateY(-2px);
	border-color: var(--snh-c1);
	box-shadow: 0 10px 24px rgba(36, 33, 29, .16);
}
.snh-chat-prod::after {
	content: "›";
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--snh-c1);
	font-size: 20px;
	font-weight: 700;
}
.snh-chat-prod img {
	width: 54px;
	height: 54px;
	object-fit: cover;
	border-radius: 12px;
	flex: 0 0 54px;
	background: #f3ede2;
}
.snh-chat-prod__info {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.35;
	padding-right: 18px;
}
.snh-chat-prod__name {
	font-size: 12.5px;
	font-weight: 700;
	color: #24211d;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 185px;
}
.snh-chat-prod__price {
	font-size: 12.5px;
	font-weight: 800;
	color: var(--snh-c1);
}

/* ---------- Tombol aksi & tautan ---------- */
.snh-chat__links {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-self: flex-start;
	margin-left: 34px;
}
.snh-chat__links a,
.snh-chat-act {
	text-decoration: none;
	font-size: 12.5px;
	font-weight: 700;
	border-radius: 999px;
	padding: 8px 15px;
	border: 0;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
	transition: transform .15s ease;
}
.snh-chat__links a:hover,
.snh-chat-act:hover { transform: translateY(-2px); }
.snh-chat__links .snh-chat__wa { background: #25d366; color: #fff; }
.snh-chat__links .snh-chat__mail { background: linear-gradient(120deg, var(--snh-c1), var(--snh-c2)); color: #fff; }
.snh-chat-act--ok {
	background: #fff;
	color: #24211d;
	border: 1.5px solid #e2d9c8 !important;
}

/* ---------- Chips saran ---------- */
.snh-chat__chips {
	display: flex;
	gap: 8px;
	padding: 9px 12px;
	overflow-x: auto;
	background: #fff;
	border-top: 1px solid #efe9dd;
}
.snh-chat__chips:empty { display: none; }
.snh-chat__chips button {
	white-space: nowrap;
	border: 1.5px solid #e2d9c8;
	background: #faf7f0;
	color: #7a5a1c;
	border-radius: 999px;
	padding: 7px 14px;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	transition: all .15s ease;
}
.snh-chat__chips button:hover {
	background: var(--snh-c1);
	border-color: var(--snh-c1);
	color: #fff;
}

/* ---------- Form input ---------- */
.snh-chat__form {
	display: flex;
	gap: 8px;
	padding: 10px;
	background: #fff;
	border-top: 1px solid #efe9dd;
}
.snh-chat__form input {
	flex: 1;
	border: 1.5px solid #e8e1d3;
	border-radius: 999px;
	padding: 11px 16px;
	font-size: 13.5px;
	outline: none;
	background: #fbf9f5;
}
.snh-chat__form input:focus {
	border-color: var(--snh-c1);
	box-shadow: 0 0 0 3px rgba(179, 136, 58, .15);
}
.snh-chat__form button {
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(120deg, var(--snh-c1), var(--snh-c2));
	color: #fff;
	cursor: pointer;
	font-size: 15px;
	transition: transform .15s ease;
}
.snh-chat__form button:hover { transform: scale(1.08); }

/* ---------- Typing ---------- */
.snh-chat-typing {
	display: flex;
	gap: 4px;
	padding: 13px 15px;
	background: #fff;
	border: 1px solid #ece5d8;
	border-radius: 16px;
	border-bottom-left-radius: 5px;
}
.snh-chat-typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #d3c19a;
	animation: snh-chat-blink 1.2s infinite;
}
.snh-chat-typing i:nth-child(2) { animation-delay: .2s; }
.snh-chat-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes snh-chat-blink {
	0%, 80%, 100% { opacity: .25; }
	40% { opacity: 1; }
}

/* ---------- Mobile: di atas sticky bar beli ---------- */
@media (max-width: 768px) {
	.snh-chat-fab {
		right: 14px;
		bottom: 104px;
		width: 56px;
		height: 56px;
	}
	.snh-chat {
		right: 12px;
		left: 12px;
		bottom: 170px;
		width: auto;
		height: 62vh;
		max-height: none;
	}
	.snh-chat-prod__name { max-width: 148px; }
}
