/* =============================================================
   Hamnaghsheh Chat — hchat.css
   All classes are prefixed with .hchat- to avoid conflicts.
   ============================================================= */

/* ---------- Root variables ---------- */
.hchat-widget {
	--hchat-primary:      #09375B;
	--hchat-accent:       #1a6fa8;
	--hchat-bg:           #ffffff;
	--hchat-shadow:       0 8px 32px rgba(9, 55, 91, 0.18);
	--hchat-radius-panel: 16px;
	--hchat-radius-msg:   18px;
	--hchat-font:         'Vazirmatn', 'Tahoma', sans-serif;
	--hchat-z:            9999;
}

/* ---------- Widget root ---------- */
.hchat-widget {
	position: fixed;
	bottom: 24px;
	left: 24px;
	z-index: var(--hchat-z);
	font-family: var(--hchat-font);
	direction: rtl;
}

/* ---------- Toggle button ---------- */
.hchat-widget #hchat-toggle-btn,
.hchat-widget .hchat-toggle-btn {
	width: 56px !important;
	height: 56px !important;
	min-width: 56px !important;
	min-height: 56px !important;
	max-height: 56px !important;
	border-radius: 50% !important;
	background: linear-gradient(135deg, #09375B 0%, #1a6fa8 100%) !important;
	background-color: transparent !important;
	border: none !important;
	border-width: 0 !important;
	padding: 0 !important;
	color: #ffffff !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-shadow: 0 4px 20px rgba(9, 55, 91, 0.4) !important;
	transition: transform 0.2s ease, box-shadow 0.2s ease !important;
	text-transform: none !important;
	font-weight: normal !important;
	line-height: 1 !important;
	position: relative !important;
	flex-shrink: 0 !important;
	gap: 0 !important;
	outline: none !important;
}
.hchat-widget #hchat-toggle-btn:hover,
.hchat-widget .hchat-toggle-btn:hover {
	transform: scale(1.08) !important;
	box-shadow: 0 6px 24px rgba(9, 55, 91, 0.55) !important;
	background: linear-gradient(135deg, #09375B 0%, #1a6fa8 100%) !important;
	background-color: transparent !important;
	color: #ffffff !important;
	border-color: transparent !important;
}
.hchat-widget #hchat-toggle-btn:active,
.hchat-widget .hchat-toggle-btn:active {
	transform: scale(0.95) !important;
}
.hchat-widget #hchat-toggle-btn svg,
.hchat-widget .hchat-toggle-btn svg {
	width: 26px !important;
	height: 26px !important;
	fill: #ffffff !important;
	stroke: #ffffff !important;
	flex-shrink: 0 !important;
	display: block !important;
}

/* ---------- Unread badge ---------- */
.hchat-widget .hchat-badge {
	position: absolute !important;
	top: -4px !important;
	right: -4px !important;
	background: #ef4444 !important;
	color: #ffffff !important;
	font-size: 0.65rem !important;
	font-weight: 700 !important;
	min-width: 18px !important;
	height: 18px !important;
	border-radius: 10px !important;
	display: none !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 0 4px !important;
	line-height: 1 !important;
	border: 2px solid white !important;
	box-shadow: none !important;
	text-transform: none !important;
}

/* ---------- Chat panel ---------- */
.hchat-panel {
	position: absolute;
	bottom: 68px;
	left: 0;
	width: 360px;
	height: 480px;
	background: var(--hchat-bg);
	border-radius: var(--hchat-radius-panel);
	box-shadow: var(--hchat-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: hchat-slide-up 0.22s ease;
}

@keyframes hchat-slide-up {
	from { opacity: 0; transform: translateY(18px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Header ---------- */
.hchat-header {
	background: var(--hchat-primary);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.hchat-header-title {
	font-size: 15px;
	font-weight: 700;
}

/* ---------- Close button ---------- */
.hchat-widget #hchat-close-btn,
.hchat-widget .hchat-close-btn {
	width: 30px !important;
	height: 30px !important;
	min-width: 30px !important;
	min-height: 30px !important;
	max-height: 30px !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.15) !important;
	background-color: rgba(255, 255, 255, 0.15) !important;
	border: none !important;
	border-width: 0 !important;
	padding: 0 !important;
	color: #ffffff !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	transition: background 0.15s ease !important;
	flex-shrink: 0 !important;
	text-transform: none !important;
	font-weight: normal !important;
	line-height: 1 !important;
	gap: 0 !important;
	outline: none !important;
	box-shadow: none !important;
}
.hchat-widget #hchat-close-btn:hover,
.hchat-widget .hchat-close-btn:hover {
	background: rgba(255, 255, 255, 0.28) !important;
	background-color: rgba(255, 255, 255, 0.28) !important;
	color: #ffffff !important;
	border-color: transparent !important;
	transform: none !important;
}
.hchat-widget #hchat-close-btn svg,
.hchat-widget .hchat-close-btn svg {
	width: 16px !important;
	height: 16px !important;
	fill: #ffffff !important;
	stroke: #ffffff !important;
	display: block !important;
	flex-shrink: 0 !important;
	color: #ffffff !important;
}

/* ---------- Messages area ---------- */
.hchat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px 12px 4px;
	display: flex;
	flex-direction: column;
	gap: 0;
	scroll-behavior: smooth;
}

.hchat-messages::-webkit-scrollbar { width: 4px; }
.hchat-messages::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 2px; }

/* ---------- "Load earlier" button ---------- */
.hchat-load-earlier-btn {
	align-self: center;
	margin-bottom: 10px;
	padding: 5px 14px;
	border: 1px solid #d0dce8;
	border-radius: 20px;
	background: #f0f5fa;
	color: var(--hchat-primary);
	font-size: 12px;
	cursor: pointer;
	transition: background 0.15s;
}

.hchat-load-earlier-btn:hover { background: #ddeaf5; }

/* ---------- Message list ---------- */
.hchat-message-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* ---------- Individual message bubble ---------- */
.hchat-msg {
	display: flex;
	flex-direction: column;
	max-width: 78%;
}

.hchat-msg--mine {
	align-self: flex-end;
	align-items: flex-end;
}

.hchat-msg--theirs {
	align-self: flex-start;
	align-items: flex-start;
}

.hchat-msg__bubble {
	padding: 8px 12px;
	border-radius: var(--hchat-radius-msg);
	font-size: 13.5px;
	line-height: 1.55;
	word-break: break-word;
	white-space: pre-wrap;
}

.hchat-msg--mine .hchat-msg__bubble {
	background: var(--hchat-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.hchat-msg--theirs .hchat-msg__bubble {
	background: #f0f4f8;
	color: #1a1a2e;
	border-bottom-left-radius: 4px;
}

.hchat-msg__meta {
	font-size: 11px;
	color: #8a9ab0;
	margin-top: 3px;
	display: flex;
	gap: 6px;
}

.hchat-msg__sender { font-weight: 600; }

/* ---------- Empty state ---------- */
.hchat-empty-state {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: #9aabb8;
	gap: 8px;
	padding: 24px;
	text-align: center;
}

.hchat-empty-icon { font-size: 36px; }
.hchat-empty-state p { font-size: 13px; margin: 0; }

/* ---------- Input area ---------- */
.hchat-input-area {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid rgba(9, 55, 91, 0.08);
	background: #ffffff;
	flex-shrink: 0;
	position: relative;
}

.hchat-input {
	flex: 1;
	border: 1.5px solid rgba(9, 55, 91, 0.15);
	border-radius: 20px;
	padding: 8px 14px;
	resize: none;
	font-family: var(--hchat-font);
	font-size: 0.875rem;
	line-height: 1.5;
	transition: border-color 0.2s, background 0.2s;
	background: #f8fafc;
	min-height: 38px;
	max-height: 90px;
	height: 38px;
	overflow-y: auto;
	display: block;
	box-sizing: border-box;
}

.hchat-input:focus {
	outline: none;
	border-color: #1a6fa8;
	background: #ffffff;
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
	.hchat-widget {
		bottom: 16px;
		left: 12px;
	}

	.hchat-panel {
		width: calc(100vw - 24px);
		height: 60vh;
		min-height: 320px;
		left: 0;
	}
}

/* ---------- Send button ---------- */
.hchat-widget #hchat-send-btn,
.hchat-widget .hchat-send-btn {
	width: 40px !important;
	height: 40px !important;
	min-width: 40px !important;
	min-height: 40px !important;
	max-height: 40px !important;
	border-radius: 50% !important;
	background: linear-gradient(135deg, #09375B 0%, #1a6fa8 100%) !important;
	background-color: transparent !important;
	border: none !important;
	border-width: 0 !important;
	padding: 0 !important;
	color: #ffffff !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-shadow: 0 2px 8px rgba(26, 111, 168, 0.4) !important;
	transition: transform 0.15s ease, box-shadow 0.15s ease !important;
	flex-shrink: 0 !important;
	text-transform: none !important;
	font-weight: normal !important;
	line-height: 1 !important;
	gap: 0 !important;
	outline: none !important;
}
.hchat-widget #hchat-send-btn svg,
.hchat-widget .hchat-send-btn svg {
	width: 18px !important;
	height: 18px !important;
	stroke: #ffffff !important;
	fill: none !important;
	display: block !important;
	flex-shrink: 0 !important;
	color: #ffffff !important;
}
.hchat-widget #hchat-send-btn:hover:not(:disabled),
.hchat-widget .hchat-send-btn:hover:not(:disabled) {
	transform: scale(1.08) !important;
	box-shadow: 0 4px 14px rgba(26, 111, 168, 0.55) !important;
	background: linear-gradient(135deg, #09375B 0%, #1a6fa8 100%) !important;
	background-color: transparent !important;
	color: #ffffff !important;
	border-color: transparent !important;
}
.hchat-widget #hchat-send-btn:active:not(:disabled),
.hchat-widget .hchat-send-btn:active:not(:disabled) {
	transform: scale(0.94) !important;
}
.hchat-widget #hchat-send-btn:disabled,
.hchat-widget .hchat-send-btn:disabled {
	opacity: 0.45 !important;
	cursor: not-allowed !important;
	transform: none !important;
	box-shadow: none !important;
}

/* ---------- Tabs ---------- */
.hchat-tabs {
	display: flex;
	background: #eef2f7;
	border-bottom: 1px solid rgba(9, 55, 91, 0.1);
	padding: 4px 4px 0 4px;
	gap: 2px;
	flex-shrink: 0;
}

.hchat-tab {
	flex: 1;
	padding: 8px 6px 9px 6px;
	font-size: 0.8rem;
	font-weight: 500;
	color: #6b7280;
	background: transparent;
	border: none;
	border-radius: 8px 8px 0 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	transition: color 0.15s, background 0.15s;
	font-family: var(--hchat-font);
	position: relative;
	white-space: nowrap;
}

.hchat-tab:hover:not(.hchat-tab--active) {
	color: #374151;
	background: rgba(255,255,255,0.5);
}

.hchat-tab--active {
	background: #ffffff;
	color: var(--hchat-primary);
	font-weight: 700;
}

.hchat-tab--active::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 8px;
	right: 8px;
	height: 2.5px;
	background: var(--hchat-primary);
	border-radius: 2px 2px 0 0;
}

.hchat-tab-badge {
	background: #ef4444;
	color: white;
	font-size: 0.65rem;
	font-weight: 700;
	padding: 1px 5px;
	border-radius: 10px;
	min-width: 18px;
	text-align: center;
	display: none;
	line-height: 1.4;
}

.hchat-tab-badge--visible {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* ---------- Panes ---------- */
.hchat-pane {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 0;
}

/* ---------- Activity pane ---------- */
.hchat-activity-pane {
	overflow-y: auto;
	padding: 10px 12px;
	gap: 0;
}

.hchat-activity-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.hchat-activity-card {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 9px 11px;
	border-radius: 10px;
	background: #f5f8fc;
	transition: background 0.12s;
}

.hchat-activity-card:hover { background: #eaf1f8; }

.hchat-activity-icon {
	font-size: 20px;
	flex-shrink: 0;
	line-height: 1.2;
}

.hchat-activity-icon-wrap {
	width: 36px;
	height: 36px;
	min-width: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.hchat-activity-icon-wrap svg {
	width: 16px;
	height: 16px;
}

.hchat-activity-body {
	flex: 1;
	min-width: 0;
}

.hchat-activity-top {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.hchat-activity-filename {
	font-weight: 600;
	font-size: 0.85rem;
	color: #09375B;
	word-break: break-all;
}

.hchat-activity-action {
	font-size: 0.82rem;
	color: #6b7280;
	margin-right: 4px;
}

.hchat-activity-meta {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 3px;
	flex-wrap: wrap;
}

.hchat-activity-dot { color: #d1d5db; font-size: 0.75rem; }

.hchat-activity-user {
	font-weight: 700;
	font-size: 0.82rem;
	color: #1e3a5f;
}

.hchat-activity-time {
	font-size: 0.75rem;
	color: #9ca3af;
}

/* ---------- File tag pill ---------- */
.hchat-file-tag {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	padding: 1px 7px;
	border-radius: 12px;
	background: rgba(26, 111, 168, 0.12);
	color: #1a6fa8;
	font-size: 12px;
	font-weight: 600;
	vertical-align: middle;
	white-space: nowrap;
}

.hchat-file-tag--deleted {
	background: rgba(150, 150, 150, 0.12);
	color: #888;
	text-decoration: line-through;
}

/* ---------- File autocomplete dropdown ---------- */
.hchat-file-dropdown {
	position: absolute;
	bottom: 100%;
	right: 12px;
	left: 12px;
	max-height: calc(5 * 36px);
	overflow-y: auto;
	background: #fff;
	border: 1px solid #d0dce8;
	border-radius: 10px;
	box-shadow: 0 4px 16px rgba(9, 55, 91, 0.14);
	z-index: 10;
	margin-bottom: 4px;
}

.hchat-file-dropdown-item {
	padding: 8px 12px;
	font-size: 13px;
	cursor: pointer;
	color: #1a1a2e;
	transition: background 0.1s;
	border-radius: 8px;
}

.hchat-file-dropdown-item:hover,
.hchat-file-dropdown-item--active {
	background: #ddeaf5;
	color: var(--hchat-primary);
}

