/* ==========================================================================
   Siddik Chat Widget — Futuristic UI
   ========================================================================== */

:root {
	--mdscw-primary: #6366f1;
	--mdscw-primary-dark: #4f46e5;
	--mdscw-primary-glow: rgba(99, 102, 241, 0.45);
	--mdscw-accent: #a855f7;
	--mdscw-bg: #ffffff;
	--mdscw-surface: rgba(255, 255, 255, 0.72);
	--mdscw-text: #0f172a;
	--mdscw-text-soft: #64748b;
	--mdscw-muted: #94a3b8;
	--mdscw-border: rgba(148, 163, 184, 0.22);
	--mdscw-radius: 22px;
	--mdscw-radius-sm: 14px;
	--mdscw-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--mdscw-shadow:
		0 24px 64px rgba(15, 23, 42, 0.18),
		0 0 0 1px rgba(255, 255, 255, 0.06) inset;
	--mdscw-shadow-fab:
		0 12px 40px var(--mdscw-primary-glow),
		0 4px 16px rgba(15, 23, 42, 0.12);
}

/* ---- Isolation from WP / WooCommerce themes ---- */
#mdscw-widget,
#mdscw-widget *,
#mdscw-widget *::before,
#mdscw-widget *::after {
	box-sizing: border-box;
}

#mdscw-widget button,
#mdscw-widget input {
	font-family: var(--mdscw-font);
	-webkit-appearance: none;
	appearance: none;
	border: none !important;
	outline: none;
	box-shadow: none;
	background-image: none;
	text-shadow: none;
	min-height: unset;
	line-height: normal;
}

#mdscw-widget button:not(:disabled) {
	cursor: pointer;
}

/* ---- Widget shell ---- */
#mdscw-widget.mdscw-widget {
	position: fixed;
	z-index: 999999;
	font-family: var(--mdscw-font);
	font-size: 14px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

#mdscw-widget.mdscw-bottom-right { right: 24px; bottom: 24px; }
#mdscw-widget.mdscw-bottom-left  { left: 24px; bottom: 24px; }

/* ---- Floating action button ---- */
#mdscw-widget #mdscw-toggle.mdscw-toggle {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 62px;
	height: 62px;
	padding: 0;
	margin: 0;
	border-radius: 50% !important;
	background: linear-gradient(135deg, var(--mdscw-primary) 0%, var(--mdscw-accent) 100%) !important;
	color: #fff !important;
	box-shadow: var(--mdscw-shadow-fab);
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
	overflow: hidden;
	isolation: isolate;
}

#mdscw-widget #mdscw-toggle.mdscw-toggle::before {
	content: '';
	position: absolute;
	inset: -3px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--mdscw-primary), var(--mdscw-accent));
	opacity: 0.35;
	filter: blur(10px);
	z-index: -1;
	animation: mdscw-pulse 2.8s ease-in-out infinite;
}

#mdscw-widget #mdscw-toggle.mdscw-toggle::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.35);
	pointer-events: none;
}

#mdscw-widget #mdscw-toggle.mdscw-toggle:hover {
	transform: scale(1.08) translateY(-2px);
	box-shadow:
		0 18px 48px var(--mdscw-primary-glow),
		0 8px 24px rgba(15, 23, 42, 0.15);
}

#mdscw-widget #mdscw-toggle.mdscw-toggle svg {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 26px;
	height: 26px;
	transform: translate(-50%, -50%);
	transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
	pointer-events: none;
	fill: currentColor;
}

#mdscw-widget .mdscw-icon-chat {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1) rotate(0deg);
}

#mdscw-widget .mdscw-icon-close {
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.4) rotate(-90deg);
}

/* Hide FAB when chat window is open — header has close btn */
#mdscw-widget.mdscw-open #mdscw-toggle.mdscw-toggle {
	opacity: 0;
	visibility: hidden;
	transform: scale(0.5);
	pointer-events: none;
}

/* ---- Chat window ---- */
#mdscw-widget .mdscw-window {
	position: absolute;
	bottom: 0;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 100px);
	display: flex;
	flex-direction: column;
	border-radius: var(--mdscw-radius);
	overflow: hidden;
	background: var(--mdscw-bg);
	box-shadow: var(--mdscw-shadow);
	animation: mdscw-window-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
	transform-origin: bottom right;
}

#mdscw-widget.mdscw-bottom-left .mdscw-window {
	transform-origin: bottom left;
}

#mdscw-widget.mdscw-bottom-left .mdscw-window { left: 0; }
#mdscw-widget.mdscw-bottom-right .mdscw-window { right: 0; }

#mdscw-widget .mdscw-window.mdscw-closed,
#mdscw-widget .mdscw-window[hidden] {
	display: none !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

@keyframes mdscw-window-in {
	from { opacity: 0; transform: translateY(20px) scale(0.94); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mdscw-pulse {
	0%, 100% { opacity: 0.25; transform: scale(1); }
	50%       { opacity: 0.55; transform: scale(1.06); }
}

/* ---- Header ---- */
#mdscw-widget .mdscw-header {
	position: relative;
	flex-shrink: 0;
	background: linear-gradient(135deg, var(--mdscw-primary-dark) 0%, var(--mdscw-primary) 45%, var(--mdscw-accent) 100%);
	color: #fff;
	overflow: hidden;
}

#mdscw-widget .mdscw-header::before {
	content: '';
	position: absolute;
	inset: 0;
	background:
		radial-gradient(circle at 20% 0%, rgba(255,255,255,0.18) 0%, transparent 50%),
		radial-gradient(circle at 80% 100%, rgba(0,0,0,0.12) 0%, transparent 40%);
	pointer-events: none;
}

#mdscw-widget .mdscw-header-top {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 18px 12px;
	gap: 12px;
}

#mdscw-widget .mdscw-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

#mdscw-widget .mdscw-avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.18);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.3);
	font-size: 20px;
	line-height: 1;
	flex-shrink: 0;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

#mdscw-widget .mdscw-bot-name {
	font-size: 16px;
	font-weight: 700;
	letter-spacing: -0.02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#mdscw-widget .mdscw-bot-status {
	display: block;
	font-size: 11px;
	font-weight: 500;
	opacity: 0.85;
	margin-top: 1px;
}

#mdscw-widget #mdscw-close.mdscw-close {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 36px !important;
	height: 36px !important;
	padding: 0 !important;
	margin: 0 !important;
	border-radius: 12px !important;
	background: rgba(255, 255, 255, 0.2) !important;
	color: #fff !important;
	flex-shrink: 0;
	position: relative;
	z-index: 5;
	pointer-events: auto !important;
	cursor: pointer !important;
	transition: background 0.2s ease, transform 0.2s ease;
}

#mdscw-widget #mdscw-close.mdscw-close:hover {
	background: rgba(255, 255, 255, 0.32) !important;
	transform: scale(1.05);
}

#mdscw-widget #mdscw-close.mdscw-close svg {
	display: block;
	width: 18px;
	height: 18px;
	stroke: #fff;
	flex-shrink: 0;
}

/* ---- Channel bar ---- */
#mdscw-widget .mdscw-channel-bar {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px;
	width: 100%;
	min-width: 0;
	padding: 0 14px 14px;
	box-sizing: border-box;
}

#mdscw-widget .mdscw-channel-btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 5px;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	padding: 7px 8px !important;
	border-radius: 100px !important;
	background: rgba(255, 255, 255, 0.14) !important;
	color: rgba(255, 255, 255, 0.92) !important;
	font-size: 10px;
	font-weight: 600;
	white-space: nowrap;
	border: 1px solid rgba(255, 255, 255, 0.22) !important;
	transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
	overflow: hidden;
}

#mdscw-widget .mdscw-channel-icon {
	font-size: 12px;
	line-height: 1;
	flex-shrink: 0;
}

#mdscw-widget .mdscw-channel-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}

#mdscw-widget .mdscw-channel-btn:hover {
	background: rgba(255, 255, 255, 0.24) !important;
	transform: translateY(-1px);
}

#mdscw-widget .mdscw-channel-btn.is-active {
	background: #fff !important;
	color: var(--mdscw-primary-dark) !important;
	border-color: #fff !important;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

/* Single channel: one full-width row */
#mdscw-widget .mdscw-channel-bar:has(.mdscw-channel-btn:only-child) {
	grid-template-columns: minmax(0, 1fr);
}

/* ---- Messages area ---- */
#mdscw-widget .mdscw-messages {
	flex: 1;
	overflow-y: auto;
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background:
		linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
	scrollbar-width: thin;
	scrollbar-color: var(--mdscw-muted) transparent;
}

#mdscw-widget .mdscw-messages::-webkit-scrollbar { width: 5px; }
#mdscw-widget .mdscw-messages::-webkit-scrollbar-thumb {
	background: var(--mdscw-muted);
	border-radius: 10px;
}

/* ---- Message bubbles ---- */
#mdscw-widget .mdscw-message {
	max-width: 82%;
	padding: 11px 15px;
	border-radius: 18px;
	word-wrap: break-word;
	font-size: 13.5px;
	animation: mdscw-msg-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes mdscw-msg-in {
	from { opacity: 0; transform: translateY(8px) scale(0.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

#mdscw-widget .mdscw-message-bot {
	align-self: flex-start;
	background: #fff;
	color: var(--mdscw-text);
	border: 1px solid var(--mdscw-border);
	border-bottom-left-radius: 6px;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

#mdscw-widget .mdscw-message-user {
	align-self: flex-end;
	background: linear-gradient(135deg, var(--mdscw-primary-dark), var(--mdscw-accent));
	color: #fff;
	border-bottom-right-radius: 6px;
	box-shadow: 0 4px 16px var(--mdscw-primary-glow);
}

#mdscw-widget .mdscw-message-admin {
	align-self: flex-start;
	background: linear-gradient(135deg, #ecfdf5, #d1fae5);
	color: #065f46;
	border: 1px solid #a7f3d0;
	border-bottom-left-radius: 6px;
}

#mdscw-widget .mdscw-message-admin::before {
	content: '✦ Support';
	display: block;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin-bottom: 3px;
	opacity: 0.65;
}

/* ---- Typing indicator ---- */
#mdscw-widget .mdscw-typing {
	display: flex;
	gap: 5px;
	padding: 14px 18px;
	align-self: flex-start;
}

#mdscw-widget .mdscw-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--mdscw-primary);
	animation: mdscw-bounce 1.2s infinite ease-in-out;
}

#mdscw-widget .mdscw-typing span:nth-child(2) { animation-delay: 0.15s; }
#mdscw-widget .mdscw-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes mdscw-bounce {
	0%, 80%, 100% { transform: scale(0.5); opacity: 0.35; }
	40%           { transform: scale(1); opacity: 1; }
}

/* ---- Channel selector & FAQ ---- */
#mdscw-widget .mdscw-channel-selector {
	align-self: stretch;
	padding: 4px 0;
}

#mdscw-widget .mdscw-channel-prompt {
	margin: 0 0 14px;
	font-size: 14px;
	font-weight: 700;
	color: var(--mdscw-text);
	text-align: center;
	letter-spacing: -0.02em;
}

#mdscw-widget .mdscw-channel-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

#mdscw-widget .mdscw-channel-pill {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
	padding: 10px 16px !important;
	border-radius: 100px !important;
	background: #fff !important;
	color: var(--mdscw-text) !important;
	font-size: 12.5px;
	font-weight: 600;
	border: 1px solid var(--mdscw-border) !important;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
	transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

#mdscw-widget .mdscw-channel-pill:hover {
	border-color: var(--mdscw-primary) !important;
	box-shadow: 0 6px 20px var(--mdscw-primary-glow);
	transform: translateY(-2px);
}

#mdscw-widget .mdscw-faq-buttons {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: stretch;
	margin-top: 6px;
}

#mdscw-widget .mdscw-faq-btn {
	display: block !important;
	width: 100%;
	padding: 12px 16px !important;
	border-radius: var(--mdscw-radius-sm) !important;
	background: #fff !important;
	color: var(--mdscw-text) !important;
	font-size: 13px;
	font-weight: 600;
	text-align: left;
	border: 1px solid var(--mdscw-border) !important;
	box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
	transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, color 0.2s;
}

#mdscw-widget .mdscw-faq-btn:hover {
	border-color: var(--mdscw-primary) !important;
	color: var(--mdscw-primary-dark) !important;
	box-shadow: 0 6px 20px var(--mdscw-primary-glow);
	transform: translateX(4px);
}

/* ---- CTA buttons ---- */
#mdscw-widget .mdscw-message-wrap {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-self: flex-start;
	max-width: 90%;
}

#mdscw-widget .mdscw-channel-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 13px 22px;
	border-radius: var(--mdscw-radius-sm);
	font-size: 13.5px;
	font-weight: 700;
	text-decoration: none !important;
	color: #fff !important;
	transition: transform 0.2s, box-shadow 0.2s;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

#mdscw-widget .mdscw-channel-cta:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
	color: #fff !important;
}

#mdscw-widget .mdscw-channel-cta-whatsapp  { background: linear-gradient(135deg, #25d366, #128c7e); }
#mdscw-widget .mdscw-channel-cta-messenger { background: linear-gradient(135deg, #0084ff, #0064d2); }
#mdscw-widget .mdscw-channel-cta-telegram  { background: linear-gradient(135deg, #229ed9, #1a7ab5); }

/* ---- Input area ---- */
#mdscw-widget .mdscw-form {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-top: 1px solid var(--mdscw-border);
}

#mdscw-widget #mdscw-input.mdscw-input {
	flex: 1;
	padding: 12px 18px !important;
	border-radius: 100px !important;
	background: #f1f5f9 !important;
	color: var(--mdscw-text) !important;
	font-size: 13.5px;
	border: 1px solid transparent !important;
	transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

#mdscw-widget #mdscw-input.mdscw-input::placeholder {
	color: var(--mdscw-muted);
}

#mdscw-widget #mdscw-input.mdscw-input:focus {
	background: #fff !important;
	border-color: var(--mdscw-primary) !important;
	box-shadow: 0 0 0 3px var(--mdscw-primary-glow);
}

#mdscw-widget #mdscw-form .mdscw-send {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 44px !important;
	height: 44px !important;
	min-width: 44px !important;
	min-height: 44px !important;
	padding: 0 !important;
	border-radius: 50% !important;
	background: linear-gradient(135deg, var(--mdscw-primary-dark), var(--mdscw-accent)) !important;
	color: #fff !important;
	flex-shrink: 0;
	box-shadow: 0 4px 16px var(--mdscw-primary-glow);
	transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s;
}

#mdscw-widget #mdscw-form .mdscw-send:hover {
	transform: scale(1.08);
	box-shadow: 0 8px 24px var(--mdscw-primary-glow);
}

#mdscw-widget #mdscw-form .mdscw-send:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	transform: none;
}

#mdscw-widget #mdscw-form .mdscw-send svg {
	display: block;
	width: 18px;
	height: 18px;
	stroke: #fff;
	fill: none;
	flex-shrink: 0;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
	#mdscw-widget.mdscw-bottom-right,
	#mdscw-widget.mdscw-bottom-left {
		right: 12px;
		left: 12px;
		bottom: 12px;
	}

	#mdscw-widget .mdscw-window {
		width: 100%;
		max-width: none;
		height: calc(100vh - 80px);
		max-height: none;
		right: 0 !important;
		left: 0 !important;
	}
}
