.goftiran-root, .goftiran-root * {
	font-family: 'Vazirmatn', Tahoma, sans-serif;
	box-sizing: border-box;
}
.goftiran-root {
	position: fixed;
	bottom: var(--goftiran-icon-margin-bottom, 24px);
	z-index: 999999;
	direction: rtl;
	font-size: var(--goftiran-font-size, 14px);
}
.goftiran-pos-right { right: var(--goftiran-icon-margin-side, 24px); }
.goftiran-pos-left { left: var(--goftiran-icon-margin-side, 24px); }

/* ============ متغیرهای حالت روشن (آبی/سبز/نارنجی) ============ */
.goftiran-root {
	--gf-primary: var(--goftiran-primary, #2563eb);
	--gf-secondary: var(--goftiran-secondary, #16a34a);
	--gf-accent: var(--goftiran-accent, #f59e0b);
	--gf-bg: #ffffff;
	--gf-surface: #f7f8fc;
	--gf-text: #1f2430;
	--gf-text-muted: #8a8f9c;
	--gf-border: rgba(0,0,0,.08);
	--gf-launcher-shadow: 0 8px 24px rgba(37,99,235,.35);
	--gf-glass: rgba(255,255,255,.6);
	--gf-glow: none;
}

/* ============ متغیرهای حالت تیره (مشکی/طلایی/نئون) ============ */
.goftiran-root[data-theme="dark"] {
	--gf-primary: var(--goftiran-dark-gold, #d4af37);
	--gf-secondary: var(--goftiran-dark-gold, #d4af37);
	--gf-accent: #f5d576;
	--gf-bg: var(--goftiran-dark-bg, #0b0b0f);
	--gf-surface: var(--goftiran-dark-surface, #16161d);
	--gf-text: var(--goftiran-dark-text, #f5f5f0);
	--gf-text-muted: #9a9aa5;
	--gf-border: rgba(212,175,55,.35);
	--gf-launcher-shadow: 0 0 24px rgba(212,175,55,.5);
	--gf-glass: rgba(22,22,29,.7);
	--gf-glow: 0 0 10px rgba(212,175,55,.6);
}

.goftiran-launcher {
	width: 60px; height: 60px; border-radius: 50%;
	background: linear-gradient(135deg, var(--gf-primary), var(--gf-secondary));
	color: #fff; border: none; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	box-shadow: var(--gf-launcher-shadow);
	transition: transform .2s ease, box-shadow .3s ease;
	position: relative;
}
.goftiran-root[data-theme="dark"] .goftiran-launcher { color: #0b0b0f; border: 1px solid rgba(212,175,55,.6); }
.goftiran-launcher:hover { transform: scale(1.06); }
.goftiran-unread-dot {
	position: absolute; top: 2px; left: 2px;
	width: 12px; height: 12px; background: #ef4444; border-radius: 50%; border: 2px solid #fff;
}

.goftiran-box {
	position: absolute; bottom: 76px;
	width: var(--goftiran-width, 350px); height: var(--goftiran-height, 450px);
	background: var(--gf-bg); border-radius: var(--goftiran-radius, 16px);
	box-shadow: 0 12px 40px rgba(0,0,0,.18);
	display: flex; flex-direction: column; overflow: hidden;
	animation: goftiran-pop .22s ease;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 120px);
	border: 1px solid var(--gf-border);
	transition: background .25s ease, border-color .25s ease;
}
.goftiran-root[data-theme="dark"] .goftiran-box {
	box-shadow: 0 0 0 1px rgba(212,175,55,.25), 0 20px 60px rgba(0,0,0,.6);
}
.goftiran-pos-right .goftiran-box { right: 0; }
.goftiran-pos-left .goftiran-box { left: 0; }

@keyframes goftiran-pop {
	from { opacity: 0; transform: translateY(16px) scale(.97); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.goftiran-header {
	background: linear-gradient(135deg, var(--gf-primary), var(--gf-secondary));
	color: var(--goftiran-header-text, #fff);
	padding: 14px 16px;
	display: flex; align-items: center; justify-content: space-between;
}
.goftiran-root[data-theme="dark"] .goftiran-header {
	background: linear-gradient(135deg, #1a1a22, #0d0d12);
	color: var(--gf-primary);
	border-bottom: 1px solid var(--gf-border);
}
.goftiran-header-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.goftiran-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.goftiran-root[data-theme="dark"] .goftiran-avatar { background: rgba(212,175,55,.15); box-shadow: var(--gf-glow); }
.goftiran-title { font-weight: 700; font-size: 14px; text-shadow: var(--gf-glow); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goftiran-status { font-size: 11px; display: flex; align-items: center; gap: 5px; opacity: .9; }
.goftiran-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; }
.goftiran-status-dot.online { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.goftiran-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.goftiran-theme-toggle-btn, .goftiran-close-btn { background: rgba(255,255,255,.15); border: none; color: inherit; font-size: 14px; cursor: pointer; opacity: .9; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.goftiran-root[data-theme="dark"] .goftiran-theme-toggle-btn, .goftiran-root[data-theme="dark"] .goftiran-close-btn { background: rgba(212,175,55,.12); border: 1px solid var(--gf-border); }
.goftiran-theme-toggle-btn:hover, .goftiran-close-btn:hover { opacity: 1; }
.goftiran-theme-icon-dark { display: none; }
.goftiran-root[data-theme="dark"] .goftiran-theme-icon-light { display: none; }
.goftiran-root[data-theme="dark"] .goftiran-theme-icon-dark { display: inline; }

.goftiran-preform { flex: 1; padding: 20px; overflow-y: auto; background: var(--gf-bg); color: var(--gf-text); display: flex; flex-direction: column; }
.goftiran-preform-inner { flex: 1; display: flex; flex-direction: column; }
.goftiran-preform-desc { font-size: 13px; color: var(--gf-text-muted); margin-top: 0; line-height: 1.8; }
#goftiran-preform-form { flex: 1; display: flex; flex-direction: column; }
.goftiran-preform-fields { flex: 1; }
.goftiran-form-row { margin-bottom: var(--goftiran-form-gap, 16px); }
.goftiran-form-row label {
	display: block; margin-bottom: 6px; font-weight: 600;
	color: var(--goftiran-form-label, var(--gf-text));
	font-size: calc(var(--goftiran-form-font-size, 13px) - 1px);
}
.goftiran-form-row input, .goftiran-form-row textarea {
	width: 100%; box-sizing: border-box;
	border: 1.5px solid var(--goftiran-form-border, var(--gf-border));
	border-radius: var(--goftiran-form-radius, 12px);
	padding: var(--goftiran-form-padding, 11px) 14px;
	font-size: var(--goftiran-form-font-size, 13.5px);
	background: var(--goftiran-form-bg, var(--gf-surface));
	color: var(--goftiran-form-text, var(--gf-text));
	transition: border-color .2s, box-shadow .2s;
	font-family: inherit;
}
.goftiran-form-row input:focus, .goftiran-form-row textarea:focus {
	outline: none;
	border-color: var(--goftiran-form-focus, var(--gf-primary));
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--goftiran-form-focus, var(--gf-primary)) 20%, transparent);
}
.goftiran-form-row textarea { min-height: 70px; resize: vertical; }
.goftiran-start-btn {
	width: 100%; background: linear-gradient(135deg, var(--gf-primary), var(--gf-secondary)); color: #fff; border: none;
	padding: 13px; border-radius: var(--goftiran-form-radius, 12px); font-size: 14px; font-weight: 700; cursor: pointer; margin-top: auto;
	box-shadow: 0 6px 16px rgba(37,99,235,.25);
}
.goftiran-root[data-theme="dark"] .goftiran-start-btn { color: #0b0b0f; box-shadow: var(--gf-glow); }

@media (max-width: 380px) {
	.goftiran-form-row label { font-size: calc(var(--goftiran-form-font-size, 13px) - 2px); }
	.goftiran-form-row input, .goftiran-form-row textarea { padding: calc(var(--goftiran-form-padding, 11px) * 0.85) 12px; }
}

/* صفحه مسدودی */
.goftiran-blocked-screen {
	flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
	text-align: center; padding: 30px 24px; background: #fef2f2; color: #7f1d1d; gap: 4px;
}
.goftiran-blocked-icon { font-size: 40px; margin-bottom: 10px; }
.goftiran-blocked-title { font-size: 16px; font-weight: 700; margin: 0 0 8px; }
.goftiran-blocked-message { font-size: 13px; line-height: 1.9; margin: 0 0 18px; opacity: .9; }
.goftiran-contact-btn {
	display: inline-block; padding: 10px 26px; border-radius: 10px; background: #dc2626; color: #fff;
	text-decoration: none; font-size: 13px; font-weight: 700;
}

/* بنر بسته‌بودن گفتگو */
.goftiran-closed-banner {
	display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center;
	padding: 14px 16px; background: var(--gf-surface); border-top: 1px solid var(--gf-border); font-size: 12.5px; color: var(--gf-text-muted);
}
.goftiran-reopen-btn {
	background: linear-gradient(135deg, var(--gf-primary), var(--gf-secondary)); color: #fff; border: none;
	padding: 8px 20px; border-radius: 10px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.goftiran-root[data-theme="dark"] .goftiran-reopen-btn { color: #0b0b0f; }

.goftiran-chat-body { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--gf-bg); }
.goftiran-messages { flex: 1; overflow-y: auto; padding: 16px; background: var(--gf-surface); display: flex; flex-direction: column; gap: 4px; }

.goftiran-msg { max-width: 78%; margin-bottom: 10px; display: flex; flex-direction: column; }
.goftiran-msg.user { align-self: flex-end; align-items: flex-end; }
.goftiran-msg.admin { align-self: flex-start; align-items: flex-start; }
.goftiran-bubble {
	padding: 9px 13px; border-radius: var(--goftiran-radius, 14px); font-size: var(--goftiran-font-size, 13px); line-height: 1.8;
	word-break: break-word;
}
.goftiran-msg.user .goftiran-bubble { background: linear-gradient(135deg, var(--gf-primary), var(--gf-secondary)); color: #fff; border-bottom-left-radius: 4px; }
.goftiran-root[data-theme="dark"] .goftiran-msg.user .goftiran-bubble { color: #0b0b0f; font-weight: 600; box-shadow: var(--gf-glow); }
.goftiran-msg.admin .goftiran-bubble { background: var(--gf-bg); color: var(--gf-text); border: 1px solid var(--gf-border); border-bottom-right-radius: 4px; }
.goftiran-msg-time { font-size: 10px; color: var(--gf-text-muted); margin-top: 3px; }
.goftiran-msg .goftiran-chat-image { max-width: 200px; border-radius: 10px; display: block; }
.goftiran-msg audio { max-width: 220px; }
.goftiran-date-sep { text-align: center; font-size: 11px; color: var(--gf-text-muted); margin: 12px 0; }

.goftiran-typing { padding: 6px 16px; font-size: 12px; color: var(--gf-text-muted); display: flex; align-items: center; gap: 6px; }
.goftiran-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gf-primary); animation: goftiran-blink 1.2s infinite; }
.goftiran-dot:nth-child(2) { animation-delay: .2s; }
.goftiran-dot:nth-child(3) { animation-delay: .4s; }
@keyframes goftiran-blink { 0%,80%,100% { opacity: .2; } 40% { opacity: 1; } }

.goftiran-composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px; border-top: 1px solid var(--gf-border); background: var(--gf-bg); }
.goftiran-composer textarea {
	flex: 1; resize: none; border: 1px solid var(--gf-border); border-radius: 12px; padding: 9px 12px;
	font-size: var(--goftiran-font-size, 13px); max-height: 80px; background: var(--gf-surface); color: var(--gf-text);
}
.goftiran-icon-btn { background: var(--gf-surface); border: 1px solid var(--gf-border); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 15px; flex-shrink: 0; color: var(--gf-text); }
.goftiran-icon-btn.recording { background: #fee2e2; color: #dc2626; }
.goftiran-send-btn {
	background: linear-gradient(135deg, var(--gf-primary), var(--gf-secondary)); color: #fff; border: none; width: 38px; height: 38px;
	border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.goftiran-root[data-theme="dark"] .goftiran-send-btn { color: #0b0b0f; box-shadow: var(--gf-glow); }

.goftiran-hidden { display: none !important; }

.goftiran-composer { position: relative; }
.goftiran-emoji-panel {
	position: absolute; bottom: 46px; right: 0; width: 240px; max-height: 190px; overflow-y: auto;
	background: var(--gf-bg); border: 1px solid var(--gf-border); border-radius: 12px; padding: 8px;
	display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 5;
}
.goftiran-emoji-panel button {
	background: none; border: none; font-size: 19px; padding: 4px; cursor: pointer; border-radius: 8px; line-height: 1;
}
.goftiran-emoji-panel button:hover { background: var(--gf-surface); }

@media (max-width: 480px) {
	.goftiran-root { bottom: calc(var(--goftiran-icon-margin-bottom, 24px) - 8px); }
	.goftiran-box { max-width: calc(100vw - 24px); max-height: calc(100vh - 100px); }
	.goftiran-launcher { width: 54px; height: 54px; }
}

@media (max-width: 360px) {
	.goftiran-title { font-size: 13px; }
	.goftiran-header-subtitle, .goftiran-status { font-size: 10px; }
}
