/*
 * Ice-boy Support Chat Widget Styles
 * Version: 1.0.0
 * WordPress Compatible - All selectors namespaced with iceboy- prefix
 */

:root {
	--iceboy-primary: #2563eb;
	--iceboy-primary-dark: #1d4ed8;
	--iceboy-primary-darker: #1e40af;
	--iceboy-white: #fff;
	--iceboy-bg: #f9fafb;
	--iceboy-border: #e5e7eb;
	--iceboy-border-dark: #d1d5db;
	--iceboy-text: #374151;
	--iceboy-text-muted: #6b7280;
	--iceboy-text-light: #9ca3af;
	--iceboy-font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

/* ═══ CONTAINER ═══ */
#iceboy-chat-container {
	position: relative;
	z-index: 999999;
}

/* ═══ TOGGLE BUTTON ═══ */
#iceboy-chat-toggle {
	position: fixed;
	bottom: 1rem;
	right: 1rem;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: var(--iceboy-primary);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 28px rgba(37,99,235,0.45);
	z-index: 999999;
	transition: all 0.15s;
}

#iceboy-chat-toggle:hover {
	background: var(--iceboy-primary-dark);
	transform: scale(1.06);
}

#iceboy-chat-toggle:active {
	background: var(--iceboy-primary-darker);
}

#iceboy-chat-toggle svg {
	transition: opacity 0.2s, transform 0.2s;
}

#iceboy-chat-toggle .icon-open {
	position: absolute;
}

#iceboy-chat-toggle .icon-close {
	position: absolute;
	opacity: 0;
	transform: rotate(-90deg);
}

#iceboy-chat-toggle.open .icon-open {
	opacity: 0;
	transform: rotate(90deg);
}

#iceboy-chat-toggle.open .icon-close {
	opacity: 1;
	transform: rotate(0deg);
}

/* ═══ CHAT WINDOW ═══ */
#iceboy-chat-window {
	position: fixed;
	bottom: calc(64px + 1.75rem);
	right: 1rem;
	width: 400px;
	height: 600px;
	border-radius: 1rem;
	background: var(--iceboy-white);
	box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 4px 16px rgba(37,99,235,0.12);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 999998;
	transform: scale(0.92) translateY(16px);
	transform-origin: bottom right;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

#iceboy-chat-window.open {
	opacity: 1;
	pointer-events: all;
	transform: scale(1) translateY(0);
}

/* Header */
.iceboy-chat-header {
	background: var(--iceboy-primary);
	padding: 1.125rem 1.375rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.iceboy-chat-header-left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.iceboy-header-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255,255,255,0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.iceboy-header-info .iceboy-title {
	color: #fff;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.3;
}

.iceboy-btn-close-header {
	background: transparent;
	border: none;
	cursor: pointer;
	color: rgba(255,255,255,0.75);
	width: 30px;
	height: 30px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s;
}

.iceboy-btn-close-header:hover {
	color: #fca5a5;
	background: rgba(255,255,255,0.1);
}

/* Messages Body */
.iceboy-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 1.25rem;
	background: var(--iceboy-bg);
	display: flex;
	flex-direction: column;
	gap: 0;
	scroll-behavior: smooth;
}

.iceboy-chat-body::-webkit-scrollbar {
	width: 4px;
}

.iceboy-chat-body::-webkit-scrollbar-track {
	background: transparent;
}

.iceboy-chat-body::-webkit-scrollbar-thumb {
	background: var(--iceboy-border-dark);
	border-radius: 4px;
}

/* Message Rows */
.iceboy-msg-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin-bottom: 0.625rem;
	animation: iceboyMsgIn 0.22s cubic-bezier(0.34,1.36,0.64,1) both;
}

@keyframes iceboyMsgIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.iceboy-msg-row.bot {
	justify-content: flex-start;
}

.iceboy-msg-row.user {
	justify-content: flex-end;
}

.iceboy-msg-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--iceboy-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.iceboy-msg-col {
	display: flex;
	flex-direction: column;
	max-width: 78%;
}

.bot .iceboy-msg-col {
	align-items: flex-start;
}

.user .iceboy-msg-col {
	align-items: flex-end;
}

.iceboy-bubble {
	padding: 0.8125rem 0.9375rem;
	border-radius: 0.75rem;
	font-size: 0.9375rem;
	line-height: 1.55;
	word-break: break-word;
}

.bot .iceboy-bubble {
	background: var(--iceboy-white);
	color: var(--iceboy-text);
	border: 1px solid var(--iceboy-border);
	border-bottom-left-radius: 4px;
	white-space: pre-wrap;
}

.bot .iceboy-bubble a {
	color: var(--iceboy-primary);
	text-decoration: underline;
	word-break: break-all;
}

.bot .iceboy-bubble a:hover {
	color: var(--iceboy-primary-dark);
}

.user .iceboy-bubble {
	background: var(--iceboy-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.iceboy-msg-time {
	font-size: 0.6875rem;
	color: var(--iceboy-text-light);
	margin-top: 3px;
	padding: 0 3px;
}

/* Typing Indicator */
.iceboy-typing-bubble {
	background: var(--iceboy-white);
	border: 1px solid var(--iceboy-border);
	padding: 0.875rem 1rem;
	border-radius: 0.75rem;
	border-bottom-left-radius: 4px;
	display: flex;
	gap: 4px;
}

.iceboy-typing-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--iceboy-text-muted);
	animation: iceboyBounce 1.1s infinite ease-in-out;
}

.iceboy-typing-dot:nth-child(2) {
	animation-delay: 0.18s;
}

.iceboy-typing-dot:nth-child(3) {
	animation-delay: 0.36s;
}

@keyframes iceboyBounce {
	0%, 60%, 100% {
		transform: translateY(0);
	}
	30% {
		transform: translateY(-5px);
	}
}

/* Footer / Input */
.iceboy-chat-footer {
	background: var(--iceboy-white);
	padding: 0.75rem 1rem 0.875rem;
	flex-shrink: 0;
	border-top: 1px solid #f0f0f0;
}

.iceboy-footer-powered {
	text-align: center;
	font-size: 0.6875rem;
	color: var(--iceboy-text-light);
	margin-bottom: 0.5rem;
}

.iceboy-input-wrap {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	background: var(--iceboy-bg);
	border: 1px solid var(--iceboy-border);
	border-radius: 1.5rem;
	padding: 0.45rem 0.625rem;
	transition: border-color 0.15s;
}

.iceboy-input-wrap:focus-within {
	border-color: var(--iceboy-primary);
}

#iceboy-chat-textarea {
	flex: 1;
	border: none;
	background: transparent;
	font-size: 0.9375rem;
	font-family: var(--iceboy-font);
	color: var(--iceboy-text);
	outline: none;
	resize: none;
	min-height: 22px;
	max-height: 120px;
	line-height: 1.5;
	padding: 3px 0;
}

#iceboy-chat-textarea::placeholder {
	color: var(--iceboy-text-light);
}

.iceboy-btn-send {
	background: var(--iceboy-primary);
	border: none;
	cursor: pointer;
	color: #fff;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: all 0.15s;
}

.iceboy-btn-send:hover {
	background: var(--iceboy-primary-dark);
}

.iceboy-btn-send:active {
	transform: scale(0.93);
}

.iceboy-btn-send:disabled {
	background: #93c5fd;
	cursor: not-allowed;
}

/* Mobile */
@media (max-width: 480px) {
	#iceboy-chat-window {
		width: calc(100vw - 1.5rem);
		height: calc(100vh - 96px);
		right: 0.75rem;
	}
}
