/* پالت رنگی مدرن */
:root {
    --bg: #121212;
    --surface: #1e1e1e;
    --primary: #ffffff;
    --secondary: #b3b3b3;
    --accent: #686868;
    --border-light: rgba(255, 255, 255, 0.1);
    --border-dark: rgba(0, 0, 0, 0.3);
    --success: #090a09;
  }
  
  /* ریست استایل‌ها */
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', 'Segoe UI', sans-serif;
  }
  
  body {
    background-color: var(--bg);
    color: var(--primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
  }
  
  /* استایل مودال کاربر */
  .user-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
  }
  
  .modal-content {
    background: var(--surface);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
  }
  
  .modal-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
  }
  
  .modal-header h3 {
    font-weight: 500;
    font-size: 1.2rem;
  }
  
  .modal-body {
    padding: 20px;
  }
  
  .modal-body p {
    margin-bottom: 15px;
    color: var(--secondary);
    text-align: center;
  }
  
  .modal-body input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    color: var(--primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
  }
  
  .modal-body input:focus {
    border-color: var(--primary);
  }
  
  .modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border-light);
  }
  
  .modal-footer button {
    background: var(--success);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
  }
  
  .modal-footer button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
  }
  
  /* استایل چت اصلی */
  .chat-container {
    width: 100%;
    max-width: 400px;
    height: 100vh;
    margin: 20px;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
  }
  
  
  .chat-container.active {
    opacity: 1;
    transform: translateY(0);
  }
  
  .chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #252C33;
    border-bottom: 1px solid #333;
  }
  
  .chat-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #fff;
  }
  
  .user-info {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  
  #user-greeting {
    margin-right: 10px;
    color: #e6e6e6;
    font-size: 14px;
  }
  
  .logout-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
  }
  
  .logout-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
  }
  
  .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    background-color: var(--surface);
  }
  
  .message {
    display: inline-block;
    max-width: 80%;
    margin-bottom: 10px;
    padding: 10px 15px;
    line-height: 1.5;
    border-radius: 12px;
    clear: both;
    animation: fadeIn 0.3s ease;
  }
  
  .message.user-message {
    background: rgba(255, 255, 255, 0.1);
    align-self: flex-end;
    border: 1px solid var(--border-light);
    border-radius: 12px 12px 0 12px;
    color: var(--primary);
  }
  
  .message.bot-message {
    background: rgba(0, 0, 0, 0.2);
    align-self: flex-start;
    border: 1px solid var(--border-dark);
    border-radius: 12px 12px 12px 0;
    color: var(--primary);
  }
  
  .message.system-message {
    background: rgba(0, 0, 0, 0.3);
    color: #aaa;
    align-self: center;
    text-align: center;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 90%;
    margin: 10px auto;
  }
/* Chat Input Container */
.chat-input {
  display: flex;
  padding: 10px 15px;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
  position: relative;
}
/* Input Wrapper */
.chat-input .input-wrapper {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  max-width: 600px; /* محدودیت عرض جدید */
  margin: 0 auto; /* مرکز کردن */
}

/* Textarea Styling */
.chat-input textarea {
  width: 100%;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 45px 10px 15px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  color: var(--primary);
  font-size: 0.95rem;
  outline: none;
  resize: none;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  line-height: 1.4;
  transition: all 0.3s ease;
  
  /* مخفی کردن اسکرولبار */
  scrollbar-width: none;
}

/* مخفی کردن اسکرولبار برای وبکیت */
.chat-input textarea::-webkit-scrollbar {
  display: none;
}

/* Send Button */
.chat-input #send-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  padding: 5px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover Effects */
.chat-input #send-btn:hover {
  color: var(--primary);
  transform: translateY(-50%) scale(1.1);
}

/* Send Icon */
.chat-input #send-btn svg {
  width: 20px;
  height: 20px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  align-self: flex-start;
  margin-bottom: 5px;
}

/* Focus State */
.chat-input textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}
  
  .typing-dot {
    width: 8px;
    height: 8px;
    background: var(--secondary);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
  }
  
  .typing-dot:nth-child(1) {
    animation-delay: 0s;
  }
  
  .typing-dot:nth-child(2) {
    animation-delay: 0.2s;
  }
  
  .typing-dot:nth-child(3) {
    animation-delay: 0.4s;
  }
  
  @keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .modal-body input {
    margin-bottom: 10px;
  }
  
  .mt-10 {
    margin-top: 10px;
  }
  /* افزودن یا اصلاح استایل برای پیام‌های ادمین */
  .message.bot-message {
    background-color: #272727;
    color: white;
    align-self: flex-start;
    border-radius: 8px 8px 8px 0;
    max-width: 75%;
    word-wrap: break-word;
    padding: 10px 15px;
    margin: 5px 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }

  .message.system-message {
    background-color: #f1f1f100;
    color: #666;
    align-self: center;
    border-radius: 18px;
    max-width: 90%;
    word-wrap: break-word;
    padding: 10px 15px;
    margin: 5px 0;
    font-style: italic;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }

  .message.user-message {
    background-color: #5c6bc0;
    color: white;
    align-self: flex-end;
    border-radius: 8px 8px 0 8px;
    max-width: 75%;
    word-wrap: break-word;
    padding: 10px 15px;
    margin: 5px 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }

  /* Adding styles for the logo and status indicator */
  .logo-container {
    display: flex;
    align-items: center;
    flex: 1;
  }

  .header-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 50%;
  }

  .status-indicator {
    display: flex;
    align-items: center;
    margin-left: 10px;
    font-size: 14px;
    color: #ccc;
  }

  .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
  }

  .status-dot.online {
    background-color: #4CAF50;
    box-shadow: 0 0 5px #4CAF50;
  }

  .status-dot.offline {
    background-color: #9e9e9e;
  }










    /* استایل برای نمایش پیام جدید */
    .chat-messages.new-message {
      animation: flash 0.5s;
    }
    
    @keyframes flash {
      0% { background-color: rgba(0, 150, 136, 0.1); }
      100% { background-color: transparent; }
    }
  
    /* استایل جدید برای زمان پیام */
    .message-time {
      font-size: 0.75rem;
      color: #888;
      margin-top: 4px;
      text-align: left;
      direction: ltr;
      display: block;
    }
  
    .user-message .message-time {
      text-align: right;
    }
  
    .bot-message .message-time,
    .system-message .message-time {
      text-align: left;
    }









    /* استایل کلی برای اسکرولبارها */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

/* Track (زمینه اسکرولبار) */
::-webkit-scrollbar-track {
  background: var(--surface); /* رنگ زمینه */
  border-radius: 4px;
}

/* Handle (نوار اسکرول) */
::-webkit-scrollbar-thumb {
  background: #000000; /* رنگ مشکی برای نوار اسکرول */
  border-radius: 4px;
  border: 1px solid var(--border-light);
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
  background: #111111; /* رنگ هنگام هاور */
}

/* برای فایرفاکس */
* {
  scrollbar-width: thin;
  scrollbar-color: #000000 var(--surface);
}

/* استایل خاص برای بخش پیام‌ها */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #000000;
}

/* استایل برای textarea */
textarea::-webkit-scrollbar {
  width: 6px;
}

textarea::-webkit-scrollbar-thumb {
  background: #000000;
  border-radius: 3px;
}

/* استایل‌های ریسپانسیو برای نمایشگرهای کوچک (425px و پایین‌تر) */
@media only screen and (max-width: 425px) {
  body {
    padding: 0;
    display: block;
    height: auto;
    min-height: 100vh;
  }

  .chat-container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .modal-content {
    width: 95%;
  }

  .message {
    max-width: 90%;
  }

  .chat-header {
    padding: 12px;
  }

  .chat-header h2 {
    font-size: 1.2rem;
  }

  .chat-messages {
    padding: 12px;
  }

  .chat-input {
    padding: 8px 12px;
  }

  .chat-input textarea {
    padding: 8px 40px 8px 12px;
    font-size: 0.9rem;
  }

  #send-btn {
    right: 8px;
  }

  #send-btn svg {
    width: 18px;
    height: 18px;
  }

  .user-info {
    flex-direction: column;
    align-items: flex-end;
  }

  #user-greeting {
    margin-right: 0;
    margin-bottom: 5px;
    font-size: 12px;
  }
}