:root {
      --primary-color: #10a37f;
      --user-bubble: #10a37f;
      --ai-bubble: #f0f0f0;
      --background: #ffffff;
      --sidebar: #202123;
      --text-primary: #343541;
      --text-secondary: #6e6e80;
      --border-color: #e5e5e6;
    }
pre {
  max-width: 100%;
  overflow-x: auto;
}
pre code {
  display: block;
  padding: 12px;
  border-radius: 8px;
  background: #f6f8fa;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;   /* حافظ على المسافات */
}
pre {
  overflow-x: auto;   /* يخلي التمرير الأفقي يظهر */
  padding: 0;         /* padding هنا يكون صفر */
  margin: 0;
}
pre code {
  display: block;
  padding: 12px;      /* padding داخل الكود فقط */
  border-radius: 8px;
  background: #f6f8fa;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;   /* ما يمسش الفراغات الأصلية */
}
pre code {
  display: block;
  padding: 12px;
  border-radius: 8px;
  background: #f6f8fa;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;   /* يسمح بالرجوع للسطر */
  word-wrap: break-word;   /* يكسر الأسطر الطويلة */
  overflow-x: auto;
}


    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }
    .main-container{
        width: 100%;
      margin: auto;
      padding-top:30px ;
    }
    body {
        direction: ltr;
      font-family: "Segoe UI", "Tahoma", sans-serif;
      background: var(--background);
      color: var(--text-primary);
      margin: 0;
      padding: 0;
      display: flex;
      height: 700px;
    }

    /* الشريط الجانبي */
    .sidebar {
      width: 260px;
      background: var(--sidebar);
      color: white;
      padding: 15px;
      display: flex;
      flex-direction: column;
      border-left: 1px solid #343541;
    }

    /* ...existing code... */
    .ai-message {
    flex-direction: row-reverse;
    text-align: right;
    }
    .user-message {
    flex-direction: row;
    text-align: left;
    }
/* ...existing code... */

    .new-chat-btn {
      background: var(--primary-color);
      color: white;
      border: none;
      border-radius: 6px;
      padding: 12px;
      margin-bottom: 20px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      font-weight: 500;
    }

    .new-chat-btn i {
      font-size: 16px;
    }

    .history {
      flex: 1;
      overflow-y: auto;
      margin-top: 20px;
    }

    .history-item {
      padding: 10px;
      border-radius: 6px;
      margin-bottom: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 14px;
    }

    .history-item:hover {
      background: #343541;
    }

    .history-item i {
      font-size: 16px;
    }

    .sidebar-footer {
      padding-top: 15px;
      border-top: 1px solid #343541;
      margin-top: 15px;
    }

    .footer-item {
      padding: 10px;
      border-radius: 6px;
      margin-bottom: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 14px;
    }

    .footer-item:hover {
      background: #343541;
    }

    /* منطقة المحادثة الرئيسية */
    .main-container {
      flex: 1;
      display: flex;
      flex-direction: column;
      height: 82%;
      position: relative;
      margin: auto;
    }

    .chat-header {
      padding: 15px;
      border-bottom: 1px solid var(--border-color);
      text-align: center;
      font-weight: 500;
      background: var(--background);
    }

    #chat-container {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
      scroll-behavior: smooth;
      background: var(--background);
      overflow: auto;
      height: 1px;
    }
    
    .message {
      display: flex;
      padding: 20px 0;
      border-bottom: 1px solid var(--border-color);
    }

    .avatar {
      width: 50px;
      height: 50px;
      border-radius: 4px;
      margin-left: 15px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: bold;
    }

    .user-avatar {
      background: var(--user-bubble);
      color: white;
    }

    .ai-avatar {
      background: #ececf1;
      color: var(--text-primary);
    }

    .message-content {
      flex: 1;
    }

    .message-content strong {
      display: block;
      margin-bottom: 5px;
      font-size: 14px;
    }

    .message-content p {
      line-height: 1.6;
      font-size: 16px;
      white-space: pre-wrap;
    }

    .input-container {
        direction: rtl;
      padding: 15px;
      background: var(--background);
      border-top: 1px solid var(--border-color);
    }

    .input-box {
      position: relative;
      max-width: 768px;
      margin: 0 auto;
    }

    textarea {
      width: 100%;
      padding: 14px 50px 14px 14px;
      border: 1px solid var(--border-color);
      border-radius: 8px;
      outline: none;
      font-size: 16px;
      box-shadow: 0 2px 6px rgba(0,0,0,0.05);
      transition: border-color 0.3s;
      height:58px;
    }

    textarea:focus {
      border-color: var(--primary-color);
    }

    .send-button {
      position: absolute;
      left: 10px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      color: var(--primary-color);
      cursor: pointer;
      font-size: 29px;
    }

    .disclaimer {
      text-align: center;
      font-size: 12px;
      color: var(--text-secondary);
      margin-top: 10px;
    }

    /* تأثيرات التحميل */
    .typing-indicator {
      display: inline-flex;
      align-items: center;
    }

    .typing-dot {
      width: 6px;
      height: 6px;
      background: var(--text-secondary);
      border-radius: 50%;
      margin: 0 2px;
      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); }
    }

    /* تصميم متجاوب */
    @media (max-width: 768px) {
      .sidebar {
        display: none;
      }
      #chat-container {
        padding: 5%;
      }
      .main-container{
        padding-top: 50px;
        height: 95%;
        width: 100%;
      }
      .input-container{
        margin-bottom: -30px;
      }
      .message {
        padding: 15px 0;
      }
    }