/* ============================================
   Tikha Bot - Professional Chat Widget Styles
   Brand: Tikha Platform
   Primary Color: #5E3EEB (Purple)
   Version: 5.1 – Mobile Responsive Enhanced
   ============================================ */

:root {
  /* Tikha Brand Colors */
  --tikha-primary: #5E3EEB;
  --tikha-primary-dark: #4A2CC4;
  --tikha-primary-light: #F4F1FF;
  --tikha-secondary: #7C3AED;
  --tikha-gradient: linear-gradient(135deg, #5E3EEB, #7C3AED);

  /* Neutral Colors */
  --tikha-dark: #1A1A1A;
  --tikha-gray: #6B7280;
  --tikha-gray-light: #9CA3AF;
  --tikha-light: #F9FAFB;
  --tikha-white: #ffffff;
  --tikha-border: #E5E7EB;

  /* Chat Dimensions */
  --chat-width: 400px;
  --chat-height: 650px;
  --chat-radius: 20px;
  --chat-radius-sm: 14px;
  --chat-radius-xs: 10px;

  /* Shadows */
  --chat-shadow-xs: 0 2px 4px rgba(0, 0, 0, 0.04);
  --chat-shadow-sm: 0 4px 8px rgba(0, 0, 0, 0.06);
  --chat-shadow-md: 0 12px 28px rgba(0, 0, 0, 0.08);
  --chat-shadow-lg: 0 24px 60px rgba(94, 62, 235, 0.18);

  /* Transitions */
  --chat-transition: all 0.2s ease;
  --chat-transition-fast: all 0.15s ease;

  /* Message Colors */
  --msg-bot-bg: #ffffff;
  --msg-user-bg: linear-gradient(135deg, #5E3EEB, #7C3AED);
  --msg-bot-text: #1A1A1A;
  --msg-user-text: #ffffff;
  --msg-bot-border: #F0EDFF;
}

/* ============================================
   FLOATING TRIGGER BUTTON
   ============================================ */
.tikha-chat-trigger {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--tikha-gradient);
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(94, 62, 235, 0.45);
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--chat-transition);
}

.tikha-chat-trigger i {
  font-size: 26px;
  color: white;
}

.tikha-chat-trigger:hover {
  transform: scale(1.08) translateY(-4px);
  box-shadow: 0 14px 36px rgba(94, 62, 235, 0.55);
}

.tikha-chat-trigger:active {
  transform: scale(0.95);
}

.tikha-chat-trigger.active i {
  transform: rotate(90deg);
}

/* Pulse Ring (desktop only) */
.tikha-pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2.5px solid var(--tikha-primary);
  animation: tikhaPulseRing 2.2s ease-out infinite;
  opacity: 0;
}

@keyframes tikhaPulseRing {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Notification Badge */
.tikha-notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #EF4444;
  color: white;
  border-radius: 50%;
  min-width: 24px;
  height: 24px;
  font-size: 12px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 3px solid white;
  padding: 0 5px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  animation: tikhaBadgePop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.tikha-notification-badge.hidden {
  display: none;
}

@keyframes tikhaBadgePop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* ============================================
   CHAT CONTAINER
   ============================================ */
.tikha-chat-container {
  position: fixed;
  bottom: 120px;
  right: 32px;
  width: var(--chat-width);
  height: var(--chat-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border: 1.5px solid rgba(94, 62, 235, 0.12);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow-lg);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: tikhaChatOpen 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
}

.tikha-chat-container.hidden {
  display: none;
}

.tikha-chat-container.minimized {
  height: 64px;
  overflow: hidden;
}

@keyframes tikhaChatOpen {
  from {
    opacity: 0;
    transform: scale(0.4) translateY(60px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ============================================
   SCREENS MANAGEMENT
   ============================================ */
.tikha-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  transition: var(--chat-transition);
}

.tikha-screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

/* ============================================
   WELCOME SCREEN
   ============================================ */
.tikha-welcome-screen {
  background: var(--tikha-gradient);
  color: white;
  padding: 48px 32px;
  text-align: center;
  justify-content: center;
  align-items: center;
  gap: 24px;
}

.tikha-welcome-logo {
  width: 88px;
  height: 88px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: white;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  margin-bottom: 4px;
}

.tikha-welcome-logo i {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.tikha-welcome-screen h2 {
  font-size: 26px;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.tikha-welcome-screen .tikha-subtitle {
  font-size: 15px;
  opacity: 0.92;
  line-height: 1.9;
  font-weight: 400;
}

/* Online Status Badge */
.tikha-online-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 10px 18px;
  border-radius: 24px;
  font-weight: 500;
}

.tikha-online-dot {
  width: 9px;
  height: 9px;
  background: #10B981;
  border-radius: 50%;
  animation: tikhaOnlinePulse 2s infinite;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

@keyframes tikhaOnlinePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  50% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
}

/* Quick Action Buttons */
.tikha-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 0 2px;
  box-sizing: border-box;
}

.tikha-quick-action-btn {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: white;
  padding: 15px 22px;
  border-radius: var(--chat-radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-weight: 500;
  transition: var(--chat-transition);
  text-align: right;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tikha-quick-action-btn i {
  font-size: 18px;
  width: 24px;
  text-align: center;
  opacity: 0.9;
}

.tikha-quick-action-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateX(-6px);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.tikha-quick-action-btn:active {
  transform: translateX(-2px) scale(0.98);
}

/* Start Chat Button */
.tikha-start-chat-btn {
  background: white;
  color: var(--tikha-primary);
  border: none;
  padding: 16px 36px;
  border-radius: 32px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  transition: var(--chat-transition);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
}

.tikha-start-chat-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.tikha-start-chat-btn:active {
  transform: translateY(0) scale(0.97);
}

/* ============================================
   LEAD CAPTURE FORM
   ============================================ */
.tikha-lead-form {
  padding: 32px 28px;
  background: var(--tikha-white);
  gap: 18px;
  overflow-y: auto;
}

.tikha-lead-form h3 {
  color: var(--tikha-dark);
  font-size: 20px;
  margin: 0 0 8px 0;
  text-align: center;
  font-weight: 800;
}

.tikha-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tikha-input-group label {
  font-size: 14px;
  color: var(--tikha-gray);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tikha-input-group label i {
  color: var(--tikha-primary);
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.tikha-input-group input,
.tikha-input-group select,
.tikha-input-group textarea {
  padding: 14px 16px;
  border: 2px solid var(--tikha-border);
  border-radius: var(--chat-radius-sm);
  font-size: 15px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  transition: var(--chat-transition-fast);
  background: var(--tikha-light);
  color: var(--tikha-dark);
}

.tikha-input-group input:focus,
.tikha-input-group select:focus,
.tikha-input-group textarea:focus {
  outline: none;
  border-color: var(--tikha-primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(94, 62, 235, 0.08);
}

.tikha-input-group input::placeholder,
.tikha-input-group textarea::placeholder {
  color: var(--tikha-gray-light);
}

.tikha-submit-lead-btn {
  background: var(--tikha-gradient);
  color: white;
  border: none;
  padding: 16px;
  border-radius: 32px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  transition: var(--chat-transition);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  box-shadow: 0 6px 20px rgba(94, 62, 235, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.tikha-submit-lead-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(94, 62, 235, 0.45);
}

.tikha-submit-lead-btn:active {
  transform: translateY(0) scale(0.98);
}

.tikha-skip-btn {
  background: none;
  border: none;
  color: var(--tikha-gray);
  cursor: pointer;
  font-size: 14px;
  text-align: center;
  padding: 8px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  transition: var(--chat-transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tikha-skip-btn:hover {
  color: var(--tikha-primary);
}

/* ============================================
   MAIN CHAT INTERFACE
   ============================================ */

/* Chat Header */
.tikha-chat-header {
  background: var(--tikha-gradient);
  color: white;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  min-height: 68px;
}

.tikha-agent-avatar {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  flex-shrink: 0;
}

.tikha-agent-info {
  flex: 1;
  min-width: 0;
}

.tikha-agent-name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
}

.tikha-agent-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.tikha-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.tikha-header-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--chat-transition-fast);
  font-size: 14px;
}

.tikha-header-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.08);
}

.tikha-header-btn:active {
  transform: scale(0.95);
}

/* Back Button */
.tikha-back-btn {
  background: none;
  border: none;
  color: var(--tikha-gray);
  cursor: pointer;
  font-size: 15px;
  padding: 10px 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  text-align: right;
  transition: var(--chat-transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tikha-back-btn:hover {
  color: var(--tikha-primary);
  transform: translateX(-5px);
}

/* Messages Container */
.tikha-messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 18px;
  background: #FAFAFC;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

.tikha-messages-container::-webkit-scrollbar {
  width: 6px;
}

.tikha-messages-container::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}

.tikha-messages-container::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #D8D0F0, #B8A8E8);
  border-radius: 10px;
}

.tikha-messages-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #C5B8E8, #A090D8);
}

/* Message Bubbles */
.tikha-message {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: tikhaMessageSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  align-items: flex-start;
}

@keyframes tikhaMessageSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tikha-message.bot {
  align-self: flex-start;
  flex-direction: row;
}

.tikha-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.tikha-message-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tikha-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tikha-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  color: var(--tikha-primary);
  border: 2px solid #EDE8FF;
  align-self: flex-start;
}

.tikha-message.user .tikha-message-avatar {
  background: var(--tikha-primary);
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
}

.tikha-message-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.75;
  word-wrap: break-word;
  overflow-wrap: break-word;
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.tikha-message.bot .tikha-message-bubble {
  background: white;
  color: var(--tikha-dark);
  border-bottom-right-radius: 6px;
  box-shadow: var(--chat-shadow-xs);
  border: 1px solid var(--msg-bot-border);
  margin-right: auto;
}

.tikha-message.user .tikha-message-bubble {
  background: var(--msg-user-bg);
  color: var(--msg-user-text);
  border-bottom-left-radius: 6px;
  box-shadow: 0 4px 12px rgba(94, 62, 235, 0.2);
  margin-left: auto;
}

.tikha-message-time {
  font-size: 11px;
  color: var(--tikha-gray-light);
  margin-top: 6px;
  padding: 0 6px;
}

.tikha-message.bot .tikha-message-time {
  text-align: left;
}

.tikha-message.user .tikha-message-time {
  text-align: right;
}

/* ============================================
   CONTENT FORMATTING (Tables, Code, Lists)
   ============================================ */

/* --- Tables --- */
.tikha-message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  background: #FAFBFC;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

.tikha-message-bubble table thead {
  background: var(--tikha-primary-light);
  color: var(--tikha-primary-dark);
}

.tikha-message-bubble table th,
.tikha-message-bubble table td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid #EDF2F7;
  white-space: nowrap;
}

.tikha-message-bubble table th {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.tikha-message-bubble table tbody tr:hover {
  background: rgba(94,62,235,0.02);
}

.tikha-message.user .tikha-message-bubble table {
  background: rgba(255,255,255,0.08);
  color: white;
}

.tikha-message.user .tikha-message-bubble table thead {
  background: rgba(255,255,255,0.15);
}

.tikha-message.user .tikha-message-bubble table th,
.tikha-message.user .tikha-message-bubble table td {
  border-color: rgba(255,255,255,0.15);
}

/* Responsive table container */
.tikha-message-bubble .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0;
  border-radius: 10px;
  border: 1px solid var(--msg-bot-border);
}

/* --- Inline Code --- */
.tikha-message-bubble code {
  background: #F1F5F9;
  color: #E11D48;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  direction: ltr;
  display: inline-block;
  unicode-bidi: embed;
}

.tikha-message.user .tikha-message-bubble code {
  background: rgba(255,255,255,0.2);
  color: #FFD0D0;
}

/* --- Code Blocks --- */
.tikha-message-bubble pre {
  background: #1E293B;
  color: #E2E8F0;
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 10px 0;
  direction: ltr;
  text-align: left;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.7;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
  white-space: pre-wrap;
  word-break: break-word;
}

.tikha-message.user .tikha-message-bubble pre {
  background: rgba(0,0,0,0.3);
  color: #F1F5F9;
}

.tikha-message-bubble pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* --- Lists --- */
.tikha-message-bubble ul,
.tikha-message-bubble ol {
  padding-right: 20px;
  margin: 8px 0;
}

.tikha-message-bubble li {
  margin-bottom: 6px;
}

.tikha-message.user .tikha-message-bubble ul,
.tikha-message.user .tikha-message-bubble ol {
  color: white;
}

/* --- Blockquote --- */
.tikha-message-bubble blockquote {
  border-right: 3px solid var(--tikha-primary);
  margin: 10px 0;
  padding: 8px 16px;
  background: #F8FAFC;
  border-radius: 0 8px 8px 0;
  color: #475569;
  font-style: italic;
}

.tikha-message.user .tikha-message-bubble blockquote {
  border-right-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.1);
  color: #E0E7FF;
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.tikha-typing-indicator {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: white;
  border-radius: 18px;
  width: fit-content;
  box-shadow: var(--chat-shadow-xs);
  border: 1px solid var(--msg-bot-border);
  border-bottom-right-radius: 6px;
}

.tikha-typing-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #B8A8E8;
  animation: tikhaTypingBounce 1.4s infinite;
}

.tikha-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.tikha-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes tikhaTypingBounce {
  0%, 60%, 100% { transform: translateY(0); background: #B8A8E8; }
  30% { transform: translateY(-10px); background: var(--tikha-primary); }
}

/* ============================================
   QUICK REPLIES
   ============================================ */
.tikha-quick-replies {
  padding: 12px 18px;
  background: white;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  border-top: 1px solid var(--tikha-border);
  scrollbar-width: thin;
  scrollbar-color: #DDD6FE transparent;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  white-space: nowrap;
  min-height: 48px;
  align-items: center;
}

.tikha-quick-replies::-webkit-scrollbar {
  height: 4px;
}

.tikha-quick-replies::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
}

.tikha-quick-replies::-webkit-scrollbar-thumb {
  background: #DDD6FE;
  border-radius: 4px;
}

.tikha-quick-replies::-webkit-scrollbar-thumb:hover {
  background: #C5B8E8;
}

.tikha-quick-reply-btn {
  background: var(--tikha-primary-light);
  color: var(--tikha-primary);
  border: 1.5px solid #DDD6FE;
  padding: 10px 18px;
  border-radius: 22px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--chat-transition-fast);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  user-select: none;
}

.tikha-quick-reply-btn i {
  font-size: 13px;
}

.tikha-quick-reply-btn:hover {
  background: var(--tikha-primary);
  color: white;
  border-color: var(--tikha-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(94, 62, 235, 0.2);
}

.tikha-quick-reply-btn:active {
  transform: translateY(0) scale(0.96);
}

/* ============================================
   INPUT AREA
   ============================================ */
.tikha-input-area {
  padding: 14px 18px;
  background: white;
  border-top: 1px solid var(--tikha-border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}

.tikha-input-area textarea {
  flex: 1;
  border: 2px solid var(--tikha-border);
  border-radius: 26px;
  padding: 12px 20px;
  font-size: 14.5px;
  resize: none;
  max-height: 120px;
  min-height: 46px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  transition: var(--chat-transition-fast);
  background: var(--tikha-light);
  color: var(--tikha-dark);
  line-height: 1.5;
}

.tikha-input-area textarea:focus {
  outline: none;
  border-color: var(--tikha-primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(94, 62, 235, 0.06);
}

.tikha-input-area textarea::placeholder {
  color: var(--tikha-gray-light);
}

/* Action Buttons */
.tikha-emoji-btn,
.tikha-attach-btn,
.tikha-voice-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  transition: var(--chat-transition-fast);
  color: var(--tikha-gray);
  flex-shrink: 0;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tikha-emoji-btn:hover,
.tikha-attach-btn:hover,
.tikha-voice-btn:hover {
  color: var(--tikha-primary);
  background: var(--tikha-primary-light);
  transform: scale(1.1);
}

.tikha-voice-btn.recording {
  color: #EF4444;
  animation: tikhaRecordingPulse 1.5s infinite;
}

@keyframes tikhaRecordingPulse {
  0%, 100% { background: transparent; }
  50% { background: #FEE2E2; }
}

/* Send Button */
.tikha-send-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--tikha-gradient);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--chat-transition);
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(94, 62, 235, 0.3);
}

.tikha-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(94, 62, 235, 0.45);
}

.tikha-send-btn:active {
  transform: scale(0.95);
}

.tikha-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ============================================
   FILE PREVIEW AREA
   ============================================ */
.tikha-file-preview {
  padding: 12px 18px;
  background: var(--tikha-light);
  border-top: 1px solid var(--tikha-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  animation: tikhaMessageSlideIn 0.3s ease;
}

.tikha-file-preview.hidden {
  display: none;
}

.tikha-file-preview-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.tikha-file-preview-content img {
  max-width: 56px;
  max-height: 56px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: var(--chat-shadow-xs);
}

.tikha-file-preview-content audio {
  max-width: 180px;
  height: 38px;
}

.tikha-file-preview-content span {
  font-size: 13px;
  color: var(--tikha-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-weight: 500;
}

.tikha-file-remove {
  background: none;
  border: none;
  color: #EF4444;
  cursor: pointer;
  padding: 6px;
  font-size: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  transition: var(--chat-transition-fast);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tikha-file-remove:hover {
  background: #FEE2E2;
}

/* Uploaded content in messages */
.tikha-uploaded-image {
  max-width: 220px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: var(--chat-shadow-sm);
  transition: var(--chat-transition-fast);
}

.tikha-uploaded-image:hover {
  transform: scale(1.02);
  box-shadow: var(--chat-shadow-md);
}

.tikha-uploaded-audio {
  max-width: 220px;
  height: 42px;
}

.tikha-file-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.tikha-file-attachment i {
  font-size: 20px;
}

/* ============================================
   INLINE KEYBOARD (Telegram-Style)
   ============================================ */
.tikha-inline-keyboard {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  animation: tikhaMessageSlideIn 0.35s ease;
}

.tikha-keyboard-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.tikha-inline-keyboard-btn {
  flex: 1;
  min-width: fit-content;
  padding: 11px 18px;
  background: var(--tikha-primary-light);
  color: var(--tikha-primary);
  border: 1.5px solid #DDD6FE;
  border-radius: 13px;
  font-size: 13.5px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: var(--chat-transition-fast);
  text-align: center;
  white-space: nowrap;
}

.tikha-inline-keyboard-btn:hover {
  background: var(--tikha-primary) !important;
  color: #ffffff !important;
  border-color: var(--tikha-primary) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(94, 62, 235, 0.25);
}

.tikha-inline-keyboard-btn:active {
  transform: translateY(0) scale(0.97);
}

.tikha-inline-keyboard-btn[data-url] {
  background: white;
  border-style: dashed;
  border-color: #C5B8E8;
  color: var(--tikha-primary);
}

.tikha-inline-keyboard-btn[data-url]:hover {
  background: var(--tikha-primary) !important;
  color: #ffffff !important;
  border-style: solid;
  border-color: var(--tikha-primary) !important;
}

/* ============================================
   CLICKABLE LINKS IN MESSAGES
   ============================================ */
.tikha-link {
  color: var(--tikha-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: var(--chat-transition-fast);
  font-weight: 500;
  cursor: pointer;
}

.tikha-link:hover {
  color: var(--tikha-primary-dark);
  text-decoration: none;
}

.tikha-message.user .tikha-link {
  color: #E0D8FF;
  text-decoration-color: rgba(224, 216, 255, 0.5);
}

.tikha-message.user .tikha-link:hover {
  color: white;
  text-decoration-color: white;
}

/* ============================================
   OFFLINE SCREEN
   ============================================ */
.tikha-offline-screen {
  background: var(--tikha-white);
  padding: 36px 28px;
  text-align: center;
  gap: 22px;
}

.tikha-offline-icon {
  font-size: 56px;
  color: var(--tikha-primary);
  margin-bottom: 4px;
}

.tikha-offline-icon i {
  filter: drop-shadow(0 4px 8px rgba(94, 62, 235, 0.2));
}

.tikha-offline-screen h3 {
  color: var(--tikha-dark);
  margin: 0;
  font-weight: 800;
  font-size: 20px;
}

.tikha-offline-screen p {
  color: var(--tikha-gray);
  font-size: 15px;
  line-height: 1.9;
}

.tikha-working-hours {
  background: #FFF8E1;
  padding: 16px 20px;
  border-radius: var(--chat-radius-sm);
  color: #92400E;
  font-size: 14px;
  line-height: 1.9;
  font-weight: 500;
  border: 1px solid #FDE68A;
}

.tikha-working-hours i {
  color: #F59E0B;
}

/* ============================================
   RATING SCREEN
   ============================================ */
.tikha-rating-screen {
  background: var(--tikha-white);
  padding: 36px 28px;
  text-align: center;
  gap: 22px;
}

.tikha-rating-screen h3 {
  color: var(--tikha-dark);
  margin: 0;
  font-weight: 800;
  font-size: 20px;
}

.tikha-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  direction: ltr;
}

.tikha-star {
  font-size: 36px;
  cursor: pointer;
  transition: var(--chat-transition);
  color: #E5E7EB;
  background: none;
  border: none;
  padding: 4px;
}

.tikha-star i {
  pointer-events: none;
}

.tikha-star:hover {
  color: #FBBF24;
  transform: scale(1.25);
}

.tikha-star.active {
  color: #F59E0B;
  transform: scale(1.1);
}

.tikha-rating-textarea {
  width: 100%;
  border: 2px solid var(--tikha-border);
  border-radius: var(--chat-radius-sm);
  padding: 14px;
  font-size: 14px;
  resize: none;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  min-height: 90px;
  background: var(--tikha-light);
  transition: var(--chat-transition-fast);
}

.tikha-rating-textarea:focus {
  outline: none;
  border-color: var(--tikha-primary);
  box-shadow: 0 0 0 4px rgba(94, 62, 235, 0.06);
}

/* ============================================
   RESPONSIVE – Optimized Mobile
   ============================================ */
@media (max-width: 600px) {
  .tikha-chat-trigger {
    bottom: 20px;
    right: 20px;
    width: 52px;
    height: 52px;
    box-shadow: 0 6px 20px rgba(94, 62, 235, 0.4);
  }
  .tikha-chat-trigger i {
    font-size: 22px;
  }
  /* حذف حلقه ضربان‌دار برای کاهش محاسبات */
  .tikha-pulse-ring {
    display: none;
  }
}

@media (max-width: 480px) {
  .tikha-chat-container {
    width: 100vw;
    max-width: 100vw;
    height: 75vh;
    height: 75dvh;
    bottom: 0;
    right: 0;
    border-radius: 20px 20px 0 0;
    border: none;
    box-shadow: 0 -4px 25px rgba(0,0,0,0.1);
    /* حذف شیشه‌ای سنگین در موبایل */
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    animation: none; /* باز شدن نرم‌تر بدون bounce */
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .tikha-chat-container.hidden {
    display: none;
  }

  /* بزرگتر کردن دکمه‌های هدر برای لمس راحت‌تر */
  .tikha-header-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .tikha-chat-header {
    padding: 14px 18px;
    min-height: 64px;
  }

  /* پیام‌ها فضای بیشتری بگیرند */
  .tikha-message {
    max-width: 92%;
  }
  .tikha-messages-container {
    padding: 18px 14px;
    gap: 14px;
  }

  /* خوش‌آمدگویی جمع‌وجورتر */
  .tikha-welcome-screen {
    padding: 32px 20px;
    gap: 18px;
  }
  .tikha-welcome-logo {
    width: 70px;
    height: 70px;
    font-size: 32px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .tikha-welcome-screen h2 {
    font-size: 22px;
  }
  .tikha-subtitle {
    font-size: 13px;
  }
  .tikha-quick-action-btn {
    padding: 13px 16px;
    font-size: 14px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.2); /* کمی پس‌زمینه برای خوانایی */
    border: 1px solid rgba(255, 255, 255, 0.35);
    margin-bottom: 2px;
  }
  .tikha-start-chat-btn {
    padding: 14px 28px;
    font-size: 15px;
  }

  /* فرم ساده‌تر */
  .tikha-lead-form {
    padding: 24px 18px;
  }

  /* نوار ورودی پیام */
  .tikha-input-area {
    padding: 10px 14px;
    gap: 8px;
  }
  .tikha-input-area textarea {
    font-size: 14px;
    padding: 10px 16px;
    min-height: 44px;
  }
  .tikha-send-btn {
    width: 44px;
    height: 44px;
  }

  /* دکمه‌های پاسخ سریع (Quick Replies) */
  .tikha-quick-replies {
    padding: 10px 14px;
    gap: 8px;
  }
  .tikha-quick-reply-btn {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    border: 1px solid var(--tikha-primary);
    color: var(--tikha-primary);
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: all 0.2s;
  }
  .tikha-quick-reply-btn:active {
    background: var(--tikha-primary);
    color: #fff;
    transform: scale(0.97);
  }

  /* دکمه‌های اینلاین کیبورد (Inline Keyboard) */
  .tikha-inline-keyboard {
    gap: 6px;
  }
  .tikha-inline-keyboard-btn {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    border: 1px solid var(--tikha-primary);
    color: var(--tikha-primary);
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  }
  .tikha-inline-keyboard-btn:active {
    background: var(--tikha-primary);
    color: #fff;
  }
  .tikha-inline-keyboard-btn[data-url] {
    background: var(--tikha-primary-light);
    border-style: solid;
    color: var(--tikha-primary);
  }

  /* آواتارها در چت کوچک‌تر */
  .tikha-message-avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .tikha-message-bubble {
    padding: 12px 16px;
    font-size: 14px;
  }

  /* دکمه بازگشت */
  .tikha-back-btn {
    font-size: 14px;
    padding: 12px 0;
  }
  .tikha-submit-lead-btn {
    padding: 14px;
    font-size: 15px;
  }
}

/* ============================================
   PRINT & ACCESSIBILITY
   ============================================ */
@media print {
  .tikha-chat-widget {
    display: none !important;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tikha-chat-container,
  .tikha-message,
  .tikha-chat-trigger,
  .tikha-pulse-ring,
  .tikha-typing-dot,
  .tikha-online-dot {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}