/* =========================================== */
/* صفحة فهرس المحادثات - تصميم ناعم ومريح       */
/* =========================================== */

.conversations-index-page{
  /* 🌸 ألوان هادئة */
  --msg-primary: #f3b8c6;
  --msg-primary-light: #fff6f8;
  --msg-primary-soft: #fffafb;
  --msg-accent: #e9d6ff;

  /* 📝 النصوص (أخف من قبل) */
  --text-dark: #2f2b33;
  --text-soft: #615a6e;
  --text-light: #8f88a1;

  /* 🧱 الخلفيات */
  --bg-page: #fffafb;
  --bg-card: #ffffff;
  --bg-hover: #fff3f6;

  /* 🧩 حدود وظلال (أفتح) */
  --border-light: rgba(243, 184, 198, 0.18);
  --shadow-soft: 0 10px 28px -18px rgba(120, 80, 110, 0.14);
  --shadow-medium: 0 18px 40px -22px rgba(120, 80, 110, 0.22);

  /* 📦 زوايا */
  --border-radius-lg: 2rem;
  --border-radius-md: 1.5rem;
  --border-radius-sm: 1rem;

  font-family: 'Tajawal', 'Cairo', sans-serif;
}

/* ===== الحاوية الرئيسية ===== */
.conversations-index-page .messages-wrapper{
  min-height: calc(100vh - 100px);
  background: var(--bg-page);
  padding: 1.6rem 1.25rem;
  position: relative;
  overflow: hidden;
}

/* عناصر زخرفية خلفية */
.conversations-index-page .messages-wrapper::before{
  content: '💬';
  position: absolute;
  top: 3%;
  left: 3%;
  font-size: 14rem;
  opacity: 0.02;
  transform: rotate(-5deg);
  pointer-events: none;
  color: var(--msg-primary);
}
.conversations-index-page .messages-wrapper::after{
  content: '✉️';
  position: absolute;
  bottom: 3%;
  right: 3%;
  font-size: 14rem;
  opacity: 0.02;
  transform: rotate(5deg);
  pointer-events: none;
  color: var(--msg-primary);
}

/* ===== حركة واحدة (منع تكرار fadeIn) ===== */
@keyframes fadeIn{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* ===== حاوية المحادثة الرئيسية (أنسب عرض) ===== */
.conversations-index-page .message-container{
  max-width: 1080px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  display: flex;
  height: calc(100vh - 160px);
  position: relative;
  z-index: 2;
}

/* ===== القائمة الجانبية (المحادثات) ===== */
.conversations-index-page .conversation-list{
  width: 310px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conversations-index-page .conversation-header{
  padding: 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.conversations-index-page .conversation-header span{
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 5px rgba(120, 80, 110, 0.16));
}

.conversations-index-page .conversation-header h4{
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-dark);
  margin: 0;
}

/* بحث */
.conversations-index-page .conversation-search{
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.conversations-index-page .conversation-search input{
  width: 100%;
  padding: .8rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: .9rem;
  transition: all .2s ease;
  background: var(--msg-primary-soft);
  color: var(--text-dark);
  box-sizing: border-box;
}

.conversations-index-page .conversation-search input:focus{
  outline: none;
  border-color: rgba(243, 184, 198, 0.55);
  box-shadow: 0 0 0 4px rgba(243, 184, 198, 0.12);
  background: #fff;
}

/* قائمة المحادثات */
.conversations-index-page .conversation-items{
  flex: 1;
  overflow-y: auto;
  padding: .9rem;
}

.conversations-index-page .conversation-item{
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .9rem;
  border-radius: var(--border-radius-md);
  margin-bottom: .55rem;
  text-decoration: none;
  transition: all .2s ease;
  position: relative;
  border: 1px solid transparent;
}

.conversations-index-page .conversation-item:hover{
  background: var(--bg-hover);
  border-color: rgba(243, 184, 198, 0.25);
  transform: translateY(-1px);
}

.conversations-index-page .conversation-item.active{
  background: var(--msg-primary-light);
  border: 1px solid rgba(243, 184, 198, 0.45);
  box-shadow: var(--shadow-soft);
}

.conversations-index-page .conversation-avatar{
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 10px 18px -16px rgba(0,0,0,0.18);
}

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

.conversations-index-page .conversation-name{
  display: block;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: .15rem;
  font-size: .95rem;
}

.conversations-index-page .conversation-last{
  display: block;
  font-size: .78rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge */
.conversations-index-page .conversation-badge{
  background: linear-gradient(135deg, var(--msg-primary), var(--msg-accent));
  color: #fff;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 900;
  padding: 0 6px;
  box-shadow: 0 10px 18px -16px rgba(243, 184, 198, 0.65);
}

/* ===== صندوق المحادثة ===== */
.conversations-index-page .chat-box{
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}

/* ===== رأس المحادثة ===== */
.conversations-index-page .chat-header{
  padding: .95rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.conversations-index-page .chat-user{
  display: flex;
  align-items: center;
  gap: .9rem;
}

.conversations-index-page .chat-avatar{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--msg-primary-light);
}

.conversations-index-page .chat-username{
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-dark);
  margin: 0 0 .15rem;
}

.conversations-index-page .chat-online{
  font-size: .7rem;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.conversations-index-page .chat-online::before{
  content: '';
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse{
  0%{ box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.25); }
  70%{ box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100%{ box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.conversations-index-page .chat-actions{
  display: flex;
  gap: .5rem;
}

.conversations-index-page .chat-action-btn{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: var(--text-soft);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
}

.conversations-index-page .chat-action-btn:hover{
  background: var(--msg-primary-light);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px -16px rgba(120, 80, 110, 0.25);
}

/* ===== نافذة التبليغ ===== */
.conversations-index-page .report-popup{
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 1.6rem;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-medium);
  z-index: 9999;
  width: 90%;
  max-width: 420px;
  border: 1px solid var(--border-light);
}

.conversations-index-page .report-popup h3{
  color: var(--text-dark);
  margin-bottom: 1.2rem;
  font-size: 1.25rem;
  text-align: center;
  font-weight: 900;
}

.conversations-index-page .report-popup label{
  display: block;
  margin-bottom: .45rem;
  color: var(--text-soft);
  font-weight: 800;
}

.conversations-index-page .report-popup select{
  width: 100%;
  padding: .85rem;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  margin-bottom: 1.2rem;
  font-size: .95rem;
  background: var(--msg-primary-soft);
  box-sizing: border-box;
}

.conversations-index-page .report-popup select:focus{
  outline: none;
  border-color: rgba(243, 184, 198, 0.55);
  box-shadow: 0 0 0 4px rgba(243, 184, 198, 0.12);
  background: #fff;
}

.conversations-index-page .popup-actions{
  display: flex;
  gap: .8rem;
  justify-content: center;
}

.conversations-index-page .popup-actions button{
  padding: .65rem 1.5rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 900;
  font-size: .95rem;
  transition: all .2s ease;
}

.conversations-index-page .popup-actions button:first-child{
  background: linear-gradient(135deg, var(--msg-primary), var(--msg-accent));
  color: #fff;
}
.conversations-index-page .popup-actions button:last-child{
  background: #f3f4f6;
  color: var(--text-soft);
}

.conversations-index-page .popup-actions button:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

/* ===== منطقة الرسائل ===== */
.conversations-index-page .chat-messages{
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  background: var(--msg-primary-soft);
}

.conversations-index-page .chat-message{
  display: flex;
  margin-bottom: .2rem;
  animation: fadeIn .25s ease;
}

.conversations-index-page .chat-message.me{ justify-content: flex-end; }
.conversations-index-page .chat-message.them{ justify-content: flex-start; }

.conversations-index-page .message-bubble{
  max-width: 72%;
  padding: .85rem 1.05rem;
  border-radius: 1.35rem;
  word-wrap: break-word;
  border: 1px solid var(--border-light);
  box-shadow: 0 10px 22px -18px rgba(0,0,0,.12);
  color: var(--text-dark);
}

.conversations-index-page .chat-message.me .message-bubble{
  background: var(--msg-primary-light);
  border-bottom-left-radius: .55rem;
}
.conversations-index-page .chat-message.them .message-bubble{
  background: #fff;
  border-bottom-right-radius: .55rem;
}

.conversations-index-page .message-time{
  font-size: .68rem;
  margin-top: .25rem;
  opacity: .65;
  text-align: left;
  color: var(--text-light);
}

/* ===== منطقة الإدخال ===== */
.conversations-index-page .chat-input-area{
  padding: .95rem 1.25rem;
  background: #fff;
  border-top: 1px solid var(--border-light);
}

.conversations-index-page .message-form{ width: 100%; }

.conversations-index-page .message-input-container{
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--msg-primary-soft);
  border-radius: 999px;
  padding: .25rem .35rem .25rem 1rem;
  border: 1px solid var(--border-light);
  transition: all .2s ease;
  box-sizing: border-box;
}

.conversations-index-page .message-input-container:focus-within{
  border-color: rgba(243, 184, 198, 0.55);
  box-shadow: 0 0 0 4px rgba(243, 184, 198, 0.12);
  background: #fff;
}

.conversations-index-page .emoji-button{
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-light);
  transition: all .2s ease;
}
.conversations-index-page .emoji-button:hover{
  transform: scale(1.08);
  color: var(--msg-primary);
}

.conversations-index-page .message-input{
  flex: 1;
  border: none;
  padding: .8rem 0;
  font-size: .95rem;
  outline: none;
  background: transparent;
  color: var(--text-dark);
}

.conversations-index-page .send-button{
  background: linear-gradient(135deg, var(--msg-primary), var(--msg-accent));
  color: #fff;
  border: none;
  padding: .8rem 1.6rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 900;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.35);
}

.conversations-index-page .send-button:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 26px -18px rgba(243, 184, 198, 0.75);
}

/* ===== رسائل التنبيه ===== */
.conversations-index-page .alert-success,
.conversations-index-page .alert-error,
.conversations-index-page .alert-warning{
  margin: 1rem 1.25rem 0;
  padding: .95rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: .9rem;
  text-align: center;
  font-weight: 800;
  border: 1px solid var(--border-light);
}

.conversations-index-page .alert-success{
  background: #eefaf1;
  color: #1f7a3a;
}
.conversations-index-page .alert-error{
  background: #fff5f5;
  color: #a33;
}
.conversations-index-page .alert-warning{
  background: #fff7ed;
  color: #b45309;
}

.conversations-index-page .alert-warning a{
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 900;
  margin-right: .3rem;
}

/* ===== التجاوب ===== */
@media (max-width: 968px){
  .conversations-index-page .message-container{
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 160px);
  }
  .conversations-index-page .conversation-list{
    width: 100%;
    max-height: 300px;
    border-left: 0;
    border-top: 1px solid var(--border-light);
  }
}

@media (max-width: 768px){
  .conversations-index-page .messages-wrapper{
    padding: 1rem;
  }
  .conversations-index-page .message-container{
    border-radius: var(--border-radius-md);
  }
  .conversations-index-page .chat-header{
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .conversations-index-page .chat-actions{
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 480px){
  .conversations-index-page .message-input-container{
    flex-wrap: wrap;
    border-radius: 1.25rem;
  }
  .conversations-index-page .send-button{
    width: 100%;
    margin-top: .5rem;
  }
  .conversations-index-page .message-bubble{
    max-width: 88%;
  }
}
