/**
 * CAHAYA Bali Chat - Frontend Stylesheet
 * Strictly scoped under .cahaya-bali-chat-* to prevent interference with theme CSS.
 */

:root {
	--cahaya-primary: #25D366;
	--cahaya-header-bg: #111111;
	--cahaya-header-text: #FFFFFF;
	--cahaya-accent: #D4AF37;
	--cahaya-window-width: 360px;
	--cahaya-desktop-size: 64px;
	--cahaya-mobile-size: 58px;
}

/* Root Wrapper */
.cahaya-bali-chat-root {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	box-sizing: border-box;
	direction: ltr;
}

.cahaya-bali-chat-root * {
	box-sizing: border-box;
}

/* Default Bottom-Right */
.cahaya-bali-chat-root.bottom-right {
	right: 24px;
	bottom: 24px;
}

/* Bottom-Left Option */
.cahaya-bali-chat-root.bottom-left {
	left: 24px;
	bottom: 24px;
}

/* Trigger Button & Tooltip */
.cahaya-bali-chat-trigger-wrapper {
	display: flex;
	align-items: center;
	gap: 12px;
	position: relative;
}

.cahaya-bali-chat-root.bottom-left .cahaya-bali-chat-trigger-wrapper {
	flex-direction: row-reverse;
}

.cahaya-bali-chat-tooltip {
	background: #111111;
	color: #D4AF37;
	padding: 8px 14px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.3px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	white-space: nowrap;
	border: 1px solid rgba(212, 175, 55, 0.3);
	pointer-events: none;
	animation: cahayaPulseTooltip 3s infinite ease-in-out;
}

@keyframes cahayaPulseTooltip {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-3px); }
}

/* The Main Floating Button */
.cahaya-bali-chat-btn {
	width: var(--cahaya-desktop-size, 64px);
	height: var(--cahaya-desktop-size, 64px);
	border-radius: 50%;
	background-color: var(--cahaya-primary, #25D366);
	border: none;
	outline: none;
	cursor: pointer;
	box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45), 0 2px 6px rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	padding: 0;
	position: relative;
}

.cahaya-bali-chat-btn:hover {
	transform: scale(1.08) translateY(-2px);
	box-shadow: 0 10px 30px rgba(37, 211, 102, 0.6);
}

.cahaya-bali-chat-btn:active {
	transform: scale(0.95);
}

.cahaya-btn-icon-chat,
.cahaya-btn-icon-close {
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.cahaya-btn-icon-close {
	display: none;
	color: #FFFFFF;
}

.cahaya-bali-chat-root.is-open .cahaya-btn-icon-chat {
	display: none;
}

.cahaya-bali-chat-root.is-open .cahaya-btn-icon-close {
	display: flex;
}

.cahaya-btn-custom-img {
	width: 70%;
	height: 70%;
	object-fit: contain;
	border-radius: 50%;
}

/* Chat Window Modal Panel */
.cahaya-bali-chat-panel {
	position: absolute;
	bottom: calc(var(--cahaya-desktop-size, 64px) + 16px);
	width: var(--cahaya-window-width, 360px);
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 120px);
	background: #FFFFFF;
	border-radius: 18px;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.06);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	animation: cahayaSlideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
	z-index: 999999;
}

.cahaya-bali-chat-root.bottom-right .cahaya-bali-chat-panel {
	right: 0;
}

.cahaya-bali-chat-root.bottom-left .cahaya-bali-chat-panel {
	left: 0;
}

@keyframes cahayaSlideInUp {
	from {
		opacity: 0;
		transform: translateY(16px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Header (Dark Luxury Bali Style) */
.cahaya-panel-header {
	background: var(--cahaya-header-bg, #111111);
	color: var(--cahaya-header-text, #FFFFFF);
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 2px solid var(--cahaya-accent, #D4AF37);
}

.cahaya-panel-branding {
	display: flex;
	align-items: center;
	gap: 12px;
}

.cahaya-panel-logo-icon {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: #1e1e1e;
	border: 1.5px solid var(--cahaya-accent, #D4AF37);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
}

.cahaya-panel-logo-icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cahaya-lotus-glyph {
	font-size: 20px;
}

.cahaya-panel-title-group {
	display: flex;
	flex-direction: column;
}

.cahaya-brand-title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.8px;
	color: #FFFFFF;
	text-transform: uppercase;
}

.cahaya-brand-subtitle {
	font-size: 10.5px;
	letter-spacing: 1.2px;
	color: var(--cahaya-accent, #D4AF37);
	font-weight: 600;
	text-transform: uppercase;
	margin-top: 1px;
}

.cahaya-panel-close-btn {
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.7);
	cursor: pointer;
	padding: 6px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
}

.cahaya-panel-close-btn:hover {
	color: #FFFFFF;
	background: rgba(255, 255, 255, 0.12);
}

/* Panel Body */
.cahaya-panel-body {
	padding: 16px;
	overflow-y: auto;
	flex: 1;
	background: #F9FAFB;
}

/* Welcome Message Bubble */
.cahaya-welcome-bubble {
	display: flex;
	gap: 10px;
	margin-bottom: 16px;
}

.cahaya-bubble-avatar {
	width: 32px;
	height: 32px;
	background: #111111;
	color: var(--cahaya-accent, #D4AF37);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 11px;
	flex-shrink: 0;
	border: 1px solid var(--cahaya-accent, #D4AF37);
}

.cahaya-bubble-content {
	background: #FFFFFF;
	padding: 12px 14px;
	border-radius: 4px 14px 14px 14px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
	border: 1px solid #E5E7EB;
	flex: 1;
}

.cahaya-bubble-content p {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.45;
	color: #1F2937;
}

.cahaya-bubble-time {
	display: block;
	font-size: 10px;
	color: #9CA3AF;
	text-align: right;
	margin-top: 6px;
}

/* Section Headings */
.cahaya-section-block {
	margin-bottom: 16px;
}

.cahaya-section-heading {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.cahaya-step-num {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #111111;
	color: var(--cahaya-accent, #D4AF37);
	font-size: 10px;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.cahaya-section-heading h4 {
	margin: 0;
	font-size: 12.5px;
	font-weight: 700;
	color: #374151;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* Outlet Cards */
.cahaya-outlets-selector {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cahaya-outlet-card {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px 12px;
	background: #FFFFFF;
	border: 1.5px solid #E5E7EB;
	border-radius: 10px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.cahaya-outlet-card:hover {
	border-color: #D1D5DB;
	background: #FAFAFA;
}

.cahaya-outlet-card.is-selected {
	border-color: var(--cahaya-accent, #D4AF37);
	background: #FFFDF9;
	box-shadow: 0 2px 10px rgba(212, 175, 55, 0.15);
}

.cahaya-radio-hidden {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.cahaya-card-radio-mark {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 1.5px solid #D1D5DB;
	margin-top: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.cahaya-outlet-card.is-selected .cahaya-card-radio-mark {
	border-color: #D4AF37;
	background: #D4AF37;
}

.cahaya-outlet-card.is-selected .cahaya-card-radio-mark::after {
	content: '';
	width: 6px;
	height: 6px;
	background: #FFFFFF;
	border-radius: 50%;
}

.cahaya-card-details {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
}

.cahaya-card-name {
	font-size: 13px;
	font-weight: 600;
	color: #111827;
}

.cahaya-card-meta,
.cahaya-card-address {
	font-size: 11px;
	color: #6B7280;
	line-height: 1.35;
}

/* Service / Action Options */
.cahaya-options-list {
	display: flex;
	flex-direction: column;
	gap: 7px;
}

.cahaya-action-option {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 10px 12px;
	background: #FFFFFF;
	border: 1.5px solid #E5E7EB;
	border-radius: 10px;
	cursor: pointer;
	text-align: left;
	transition: all 0.2s ease;
}

.cahaya-action-option:hover {
	border-color: #D1D5DB;
	transform: translateX(2px);
}

.cahaya-action-option.is-active {
	border-color: #111111;
	background: #111111;
	color: #FFFFFF;
}

.cahaya-option-icon {
	font-size: 18px;
	line-height: 1;
}

.cahaya-option-texts {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.cahaya-option-texts strong {
	font-size: 13px;
	color: #111827;
	font-weight: 600;
}

.cahaya-action-option.is-active .cahaya-option-texts strong {
	color: #FFFFFF;
}

.cahaya-option-texts span {
	font-size: 11px;
	color: #6B7280;
	margin-top: 1px;
}

.cahaya-action-option.is-active .cahaya-option-texts span {
	color: #D1D5DB;
}

.cahaya-arrow {
	font-size: 18px;
	color: #9CA3AF;
	font-weight: 600;
}

.cahaya-action-option.is-active .cahaya-arrow {
	color: var(--cahaya-accent, #D4AF37);
}

/* Message Preview Box */
.cahaya-msg-preview-container {
	margin-top: 12px;
	padding: 10px 12px;
	background: #FFFFFF;
	border-radius: 8px;
	border: 1px dashed #D1D5DB;
}

.cahaya-msg-preview-label {
	display: block;
	font-size: 10px;
	font-weight: 700;
	color: #6B7280;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
}

.cahaya-msg-preview-box {
	font-size: 12px;
	color: #374151;
	font-style: italic;
	line-height: 1.4;
	max-height: 60px;
	overflow-y: auto;
}

/* Panel Footer */
.cahaya-panel-footer {
	padding: 14px 16px;
	background: #FFFFFF;
	border-top: 1px solid #E5E7EB;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cahaya-launch-wa-btn {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--cahaya-primary, #25D366);
	color: #FFFFFF;
	border: none;
	padding: 12px 18px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
	transition: all 0.2s ease;
}

.cahaya-launch-wa-btn:hover {
	background: #20BA56;
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
}

.cahaya-launch-wa-btn:active {
	transform: translateY(1px);
}

.cahaya-compliance-footnote {
	font-size: 10.5px;
	color: #6B7280;
	text-align: center;
	line-height: 1.3;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
	.cahaya-bali-chat-root.bottom-right {
		right: 16px;
		bottom: 16px;
	}
	.cahaya-bali-chat-root.bottom-left {
		left: 16px;
		bottom: 16px;
	}
	.cahaya-bali-chat-btn {
		width: var(--cahaya-mobile-size, 58px);
		height: var(--cahaya-mobile-size, 58px);
	}
	.cahaya-bali-chat-panel {
		bottom: calc(var(--cahaya-mobile-size, 58px) + 12px);
		width: calc(100vw - 32px);
		max-height: 82vh;
	}
	.cahaya-bali-chat-tooltip {
		display: none;
	}
}
