@media (max-width: 768px) {
  .conversation-list {
    max-height: 200px;     /* حسب المساحة اللي تبيها */
    overflow-y: auto;       /* يخلي القائمة فيها scroll داخلي */
    margin-bottom: 15px;    /* يعطي تنفس قبل الصندوق */
  }
}

.messages-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px;
}

.message-container {
  display: flex;
  flex-direction: row;
  border: 1px solid #eee;    /* ← لون أخف كثير من #ccc */
  border-radius: 12px;       /* زاوية أنعم شوي */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03); /* ظل خفيف يعطي نعومة */
  overflow: hidden;
  min-height: 700px;
}


.conversation-list {
  width: 300px;
  background-color: #f7f7f7;
  border-left: none;
  box-shadow: inset 5px 0 5px -5px rgba(0, 0, 0, 0.05); /* ظل خفيف ناعم */
  padding: 15px;
  overflow-y: auto;
}

.section-title {
  margin-bottom: 15px;
  font-size: 18px;
  color: #555;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background-color: #fff;
  text-decoration: none;
  color: #333;
  transition: background-color 0.3s;
}

.conversation-item:hover {
  background-color: #f0f8ff;
}

.conversation-item.active {
  background-color: #e9f5ff;
}

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #ccc;
  flex-shrink: 0;
}

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

.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.conversation-name {
  font-size: 14px;
  color: #222;
  flex: 1;
}

.conversation-badge {
  background: red;
  color: white;
  border-radius: 50%;
  padding: 4px 7px;
  font-size: 12px;
  min-width: 20px;
  height: 20px;
  line-height: 12px;
  text-align: center;
  display: inline-block;
}

.chat-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 650px;
  overflow-y: auto;
  padding: 15px;
}


.chat-header {
  margin-bottom: 15px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #eee; /* لون خفيف أنظف */
  padding-bottom: 10px;
  justify-content: space-between;
  direction: rtl;

}


.chat-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #ccc;
  flex-shrink: 0;
}

.chat-username {
  font-size: 18px;
  margin: 0;
}

.btn {
  padding: 6px 12px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

.btn-success { background-color: #28a745; color: white; }
.btn-danger { background-color: #dc3545; color: white; }
.btn-report { background: transparent; color: red; border: none; font-size: 15px; margin-left: auto; cursor: pointer; }

.alert-success, .alert-error {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 5px;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-warning {
  background-color: #fff3cd;
  color: #856404;
  padding: 10px;
  border: 1px solid #ffeeba;
  border-radius: 5px;
  margin-top: 10px;
}

.report-popup {
  display: none;
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  z-index: 9999;
  width: 90%;
  max-width: 400px;
}

.report-popup select {
  width: 100%;
  padding: 8px;
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 5px;
  margin-bottom: 15px;
}

.popup-actions {
  text-align: right;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

#chat-box {
  display: flex;
  flex-direction: column;
  padding: 10px 15px;
  scroll-behavior: smooth;
  direction: rtl;
  justify-content: space-between;
  min-height: 100px;
  max-height: 100vh;
}



.chat-messages {
  overflow-y: auto;
  max-height: 100%;
  padding: 10px;
  direction: rtl;
  display: flex;
  flex-direction: column;
  gap: 15px;
}


.chat-message {
  display: flex;
  justify-content: flex-start;  /* لأن الاتجاه صار RTL */
}

.message-bubble {
  background-color: #f3f4f6;
  color: #1f2937;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.7;
  text-align: right;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.chat-message.me .message-bubble {
  background-color: #dbeafe;
}

.message-form {
  margin-top: 10px;
}

.message-input-container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 5px 5px;
  flex: 1;
  min-width: 0;
}

.input-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  max-width: calc(100% - 120px);
  border: 1px solid #ccc;
  border-radius: 25px;
  padding: 5px 10px;
  background-color: #fff;
}


.emoji-button {
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  margin-left: 5px;
}

.message-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 8px;
  font-size: 14px;
  min-width: 0; /* ✅ هذا هو المفتاح */
}


.send-button {
  padding: 10px 20px;
  background-color: #f472b6;
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0; /* ✅ هذا يمنع الزر من الانكماش */
}

.chat-message .message-bubble {
  background-color: #f3f4f6;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.7;
  text-align: right;
  max-width: 75%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  color: #1f2937;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

