@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap');

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --danger: #ef4444;
  --surface: #ffffff;
  --background: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
}

*, *::before, *::after, html, body, input, button, select, textarea, optgroup, option {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

body {
  direction: rtl;
  text-align: right;
  background-color: var(--background);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 8px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
  border: 2px solid #f8fafc;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #6366f1;
}

/* 3-Way Triangular Diagram Styles */
.triangle-container {
  position: relative;
  min-height: 280px;
  background: radial-gradient(circle at center, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 1rem;
  border: 1px dashed #cbd5e1;
  overflow: hidden;
}

.triangle-node {
  position: absolute;
  width: 140px;
  padding: 8px 12px;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  border: 2px solid #3b82f6;
  text-align: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.triangle-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

.badge-verified {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* =========================================================================
   TELEGRAM & BALE MESSENGER THEMES
   ========================================================================= */

/* 1. Telegram Theme (پیش‌فرض پیام‌رسان تلگرام) */
:root, [data-theme="telegram"] {
  --primary: #2481cc;
  --primary-hover: #1c6ba8;
  --primary-soft: #edf6fd;
  --accent-color: #2481cc;
  --chat-wallpaper-bg: #8aa1b4;
  --chat-sent-bubble: #eeffde;
  --chat-sent-text: #17212b;
  --chat-sent-time: #4fae4e;
  --chat-recv-bubble: #ffffff;
  --chat-recv-text: #17212b;
  --chat-recv-time: #8a9aa8;
  --chat-sender-name: #2481cc;
  --active-tab-bg: #edf6fd;
  --active-tab-text: #2481cc;
}

[data-theme="telegram"] .theme-header-logo {
  background: linear-gradient(135deg, #2481cc 0%, #1c6ba8 100%) !important;
  box-shadow: 0 4px 14px rgba(36, 129, 204, 0.3) !important;
}

[data-theme="telegram"] .bg-blue-600,
[data-theme="telegram"] button.bg-blue-600 {
  background-color: #2481cc !important;
}

[data-theme="telegram"] .hover\:bg-blue-700:hover,
[data-theme="telegram"] button.hover\:bg-blue-700:hover {
  background-color: #1c6ba8 !important;
}

[data-theme="telegram"] .text-blue-600,
[data-theme="telegram"] .text-blue-700 {
  color: #2481cc !important;
}

[data-theme="telegram"] .bg-blue-50 {
  background-color: #edf6fd !important;
}

[data-theme="telegram"] .border-blue-200 {
  border-color: #c5e1f7 !important;
}

[data-theme="telegram"] .border-blue-500,
[data-theme="telegram"] .border-blue-600 {
  border-color: #2481cc !important;
}

[data-theme="telegram"] .active-tab {
  background-color: #edf6fd !important;
  color: #2481cc !important;
}

[data-theme="telegram"] .messenger-wallpaper {
  background-color: #8da6ba;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.22) 1.5px, transparent 1.5px),
    radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.16) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
}

/* 2. Bale Theme (پیام‌رسان بله) */
[data-theme="bale"] {
  --primary: #00a884;
  --primary-hover: #008769;
  --primary-soft: #eaf7f3;
  --accent-color: #00a884;
  --chat-wallpaper-bg: #efeae2;
  --chat-sent-bubble: #dcf8c6;
  --chat-sent-text: #111b21;
  --chat-sent-time: #34b7f1;
  --chat-recv-bubble: #ffffff;
  --chat-recv-text: #111b21;
  --chat-recv-time: #667781;
  --chat-sender-name: #00a884;
  --active-tab-bg: #eaf7f3;
  --active-tab-text: #00a884;
}

[data-theme="bale"] .theme-header-logo {
  background: linear-gradient(135deg, #00a884 0%, #008769 100%) !important;
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.3) !important;
}

[data-theme="bale"] .bg-blue-600,
[data-theme="bale"] button.bg-blue-600 {
  background-color: #00a884 !important;
}

[data-theme="bale"] .hover\:bg-blue-700:hover,
[data-theme="bale"] button.hover\:bg-blue-700:hover {
  background-color: #008769 !important;
}

[data-theme="bale"] .text-blue-600,
[data-theme="bale"] .text-blue-700 {
  color: #00a884 !important;
}

[data-theme="bale"] .bg-blue-50 {
  background-color: #eaf7f3 !important;
}

[data-theme="bale"] .border-blue-200 {
  border-color: #b3ecdf !important;
}

[data-theme="bale"] .border-blue-500,
[data-theme="bale"] .border-blue-600 {
  border-color: #00a884 !important;
}

[data-theme="bale"] .active-tab {
  background-color: #eaf7f3 !important;
  color: #00a884 !important;
}

[data-theme="bale"] .messenger-wallpaper {
  background-color: #efeae2;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(0, 168, 132, 0.12) 1.5px, transparent 1.5px),
    radial-gradient(circle at 0 0, rgba(0, 168, 132, 0.08) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
}

/* 3. Official Administrative Theme (اداری سنتی) */
[data-theme="navy"] {
  --primary: #1e3a8a;
  --primary-hover: #172554;
  --primary-soft: #eff6ff;
  --accent-color: #2563eb;
  --chat-wallpaper-bg: #f8fafc;
  --chat-sent-bubble: #2563eb;
  --chat-sent-text: #ffffff;
  --chat-sent-time: #bfdbfe;
  --chat-recv-bubble: #ffffff;
  --chat-recv-text: #0f172a;
  --chat-recv-time: #94a3b8;
  --chat-sender-name: #1e3a8a;
  --active-tab-bg: #eff6ff;
  --active-tab-text: #1d4ed8;
}

[data-theme="navy"] .theme-header-logo {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%) !important;
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.3) !important;
}

[data-theme="navy"] .messenger-wallpaper {
  background-color: #f8fafc;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(30, 58, 138, 0.07) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
}

/* Telegram / Bale Sent Message Bubble */
.chat-bubble-sent {
  background-color: var(--chat-sent-bubble) !important;
  color: var(--chat-sent-text) !important;
  border-radius: 16px 16px 4px 16px !important;
  box-shadow: 0 1px 2px rgba(16, 35, 47, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Telegram / Bale Received Message Bubble */
.chat-bubble-received {
  background-color: var(--chat-recv-bubble) !important;
  color: var(--chat-recv-text) !important;
  border-radius: 16px 16px 16px 4px !important;
  box-shadow: 0 1px 2px rgba(16, 35, 47, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Telegram Channel Post Card Hover */
.telegram-post-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.telegram-post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(36, 129, 204, 0.12);
}

/* Pulse animation for active matches */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
  }
}

.pulse-match {
  animation: pulseGlow 2.5s infinite;
}
