/**
 * ATR Chat Widget Styles
 * Phase 2: UI Skeleton
 */

/* === Variables === */
:root {
	--atr-chat-primary: #0073aa;
	--atr-chat-primary-hover: #005a87;
	--atr-chat-bg: #ffffff;
	--atr-chat-border: #ddd;
	--atr-chat-text: #333;
	--atr-chat-text-light: #666;
	--atr-chat-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	--atr-chat-radius: 8px;
	--atr-chat-button-size: 60px;
	--atr-chat-panel-width: 350px;
	--atr-chat-panel-height: 500px;
	--atr-chat-z-index: 999999;
}

/* === Root Container === */
.atr-chat-root {
	position: fixed;
	z-index: var(--atr-chat-z-index);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	direction: ltr;
}

.atr-chat-root.bottom-right {
	bottom: 20px;
	right: 20px;
}

.atr-chat-root.bottom-left {
	bottom: 20px;
	left: 20px;
}

/* === Floating Button === */
.atr-chat-button {
	width: var(--atr-chat-button-size);
	height: var(--atr-chat-button-size);
	border-radius: 50%;
	background: var(--atr-chat-primary);
	border: none;
	cursor: pointer;
	box-shadow: var(--atr-chat-shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, transform 0.2s;
}

.atr-chat-button:hover {
	background: var(--atr-chat-primary-hover);
	transform: scale(1.05);
}

.atr-chat-button svg {
	width: 28px;
	height: 28px;
	fill: #ffffff;
}

.atr-chat-button--open .atr-chat-icon-chat {
	display: none;
}

.atr-chat-button--open .atr-chat-icon-close {
	display: block;
}

.atr-chat-button:not(.atr-chat-button--open) .atr-chat-icon-chat {
	display: block;
}

.atr-chat-button:not(.atr-chat-button--open) .atr-chat-icon-close {
	display: none;
}

/* === Panel === */
.atr-chat-panel {
	position: absolute;
	bottom: calc(var(--atr-chat-button-size) + 15px);
	width: var(--atr-chat-panel-width);
	height: var(--atr-chat-panel-height);
	background: var(--atr-chat-bg);
	border-radius: var(--atr-chat-radius);
	box-shadow: var(--atr-chat-shadow);
	display: none;
	flex-direction: column;
	overflow: hidden;
}

.atr-chat-root.bottom-right .atr-chat-panel {
	right: 0;
}

.atr-chat-root.bottom-left .atr-chat-panel {
	left: 0;
}

.atr-chat-panel--open {
	display: flex;
}

/* === Header === */
.atr-chat-header {
	background: var(--atr-chat-primary);
	color: #ffffff;
	padding: 15px;
	font-weight: 600;
	font-size: 16px;
	flex-shrink: 0;
}

/* === Messages === */
.atr-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 15px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.atr-chat-message {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: var(--atr-chat-radius);
	word-wrap: break-word;
}

.atr-chat-message--user {
	align-self: flex-end;
	background: var(--atr-chat-primary);
	color: #ffffff;
}

.atr-chat-message--bot {
	align-self: flex-start;
	background: #f1f1f1;
	color: var(--atr-chat-text);
}

/* === Buttons (Quick Replies) === */
.atr-chat-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
}

.atr-chat-btn {
	background: var(--atr-chat-bg);
	border: 1px solid var(--atr-chat-primary);
	color: var(--atr-chat-primary);
	padding: 8px 14px;
	border-radius: 20px;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s, color 0.2s;
}

.atr-chat-btn:hover {
	background: var(--atr-chat-primary);
	color: #ffffff;
}

.atr-chat-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.atr-chat-btn--selected {
	background: var(--atr-chat-primary);
	color: #ffffff;
	opacity: 1;
}

/* === Input Area === */
.atr-chat-input-area {
	display: flex;
	padding: 10px;
	border-top: 1px solid var(--atr-chat-border);
	gap: 8px;
	flex-shrink: 0;
}

.atr-chat-input {
	flex: 1;
	border: 1px solid var(--atr-chat-border);
	border-radius: 20px;
	padding: 10px 15px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
}

.atr-chat-input:focus {
	border-color: var(--atr-chat-primary);
}

.atr-chat-input:disabled {
	background: #f5f5f5;
	cursor: not-allowed;
}

.atr-chat-send {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--atr-chat-primary);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	flex-shrink: 0;
}

.atr-chat-send:hover {
	background: var(--atr-chat-primary-hover);
}

.atr-chat-send:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.atr-chat-send svg {
	width: 18px;
	height: 18px;
	fill: #ffffff;
}

/* === RTL Support === */
[dir="rtl"] .atr-chat-root,
.atr-chat-root[dir="rtl"] {
	direction: rtl;
}

/* === Responsive === */
@media (max-width: 400px) {
	.atr-chat-panel {
		width: calc(100vw - 40px);
		height: calc(100vh - 100px);
		max-height: 500px;
	}
}
