/* MeWeb Chat Widget - Frontend styles (เบา ไม่พึ่ง framework ภายนอก) */

.mwcw-widget {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mwcw-pos-bottom-right {
	right: 20px;
	align-items: flex-end;
}

.mwcw-pos-bottom-left {
	left: 20px;
	align-items: flex-start;
}

.mwcw-greeting {
	background: #fff;
	color: #222;
	padding: 8px 14px;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
	font-size: 13px;
	margin-bottom: 8px;
	max-width: 220px;
}

.mwcw-channels {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.mwcw-channel {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--mwcw-color, #25D366);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease;
	text-decoration: none;
}

.mwcw-channel:hover {
	transform: scale(1.08);
}

.mwcw-channel svg {
	width: 24px;
	height: 24px;
	fill: #fff;
}

.mwcw-channel img {
	width: 24px;
	height: 24px;
	object-fit: contain;
	border-radius: 4px;
}

.mwcw-size-small .mwcw-channel img {
	width: 18px;
	height: 18px;
}

.mwcw-size-large .mwcw-channel img {
	width: 30px;
	height: 30px;
}

.mwcw-size-small .mwcw-channel {
	width: 38px;
	height: 38px;
}
.mwcw-size-small .mwcw-channel svg {
	width: 18px;
	height: 18px;
}

.mwcw-size-large .mwcw-channel {
	width: 58px;
	height: 58px;
}
.mwcw-size-large .mwcw-channel svg {
	width: 30px;
	height: 30px;
}

.mwcw-tooltip {
	position: absolute;
	right: calc(100% + 10px);
	top: 50%;
	transform: translateY(-50%);
	background: #333;
	color: #fff;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 12px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.mwcw-pos-bottom-left .mwcw-tooltip {
	right: auto;
	left: calc(100% + 10px);
}

.mwcw-channel:hover .mwcw-tooltip {
	opacity: 1;
}

/* ป๊อปอัพทั่วไป (ใช้ร่วมกันสำหรับ โทรศัพท์ / WeChat / ฟอร์มติดต่อ) */
.mwcw-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mwcw-popup[hidden] {
	display: none;
}

.mwcw-popup-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.mwcw-popup-box {
	position: relative;
	background: #fff;
	border-radius: 12px;
	padding: 28px 24px 24px;
	width: 260px;
	max-width: 90vw;
	text-align: center;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mwcw-popup-box-wide {
	width: 320px;
	text-align: left;
}

.mwcw-popup-close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: none;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	color: #888;
}

.mwcw-popup-label {
	margin: 0 0 4px;
	font-size: 13px;
	color: #777;
	text-align: center;
}

.mwcw-popup-highlight {
	margin: 0 0 18px;
	font-size: 20px;
	font-weight: 600;
	color: #222;
	direction: ltr;
	text-align: center;
	word-break: break-all;
}

.mwcw-popup-qr {
	display: block;
	width: 160px;
	height: 160px;
	object-fit: contain;
	margin: 0 auto 14px;
	border: 1px solid #eee;
	border-radius: 8px;
}

.mwcw-popup-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mwcw-popup-btn {
	display: block;
	width: 100%;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 14px;
	text-decoration: none;
	cursor: pointer;
	border: none;
	text-align: center;
	box-sizing: border-box;
}

.mwcw-popup-btn-primary {
	background: #34B7F1;
	color: #fff;
}

.mwcw-popup-btn-secondary {
	background: #f1f1f1;
	color: #333;
}

.mwcw-popup-btn-secondary.mwcw-copied {
	background: #dff5e1;
	color: #1e7d32;
}

/* ฟอร์มติดต่อ */
#mwcw-contact-form {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

#mwcw-contact-form input[type="text"],
#mwcw-contact-form input[type="email"],
#mwcw-contact-form textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 14px;
	box-sizing: border-box;
	font-family: inherit;
	resize: vertical;
}

.mwcw-captcha-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.mwcw-captcha-row .mwcw-field-label {
	margin: 0;
	white-space: nowrap;
}

.mwcw-captcha-answer {
	width: 70px !important;
}

.mwcw-hp-field {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.mwcw-popup-status {
	margin: 4px 0 0;
	font-size: 13px;
	color: #555;
	min-height: 18px;
}

/* การควบคุมการแสดงผลตามอุปกรณ์ ผ่าน CSS media query (แม่นยำกว่าตรวจจาก User-Agent ฝั่ง PHP) */
@media (max-width: 767px) {
	.mwcw-device-desktop {
		display: none !important;
	}
}

@media (min-width: 768px) {
	.mwcw-device-mobile {
		display: none !important;
	}
}
