/* =============================================
   NikahConnect — messages.css
   ============================================= */

.nc-messages-layout {
  display: grid; grid-template-columns: 340px 1fr;
  height: calc(100vh - 70px); margin-top: 70px;
  overflow: hidden;
}

/* Conversations list */
.nc-convs-list {
  border-right: 1px solid var(--nc-border);
  background: #fff; display: flex; flex-direction: column;
  overflow: hidden;
}
.nc-convs-list__header {
  padding: 20px; border-bottom: 1px solid var(--nc-border);
  flex-shrink: 0;
}
.nc-convs-list__header h3 { font-size: 1.1rem; margin-bottom: 6px; }
.nc-convs-limit { font-size: .75rem; color: var(--nc-text-muted); display: flex; justify-content: space-between; }

.nc-convs-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px; text-align: center; color: var(--nc-text-muted);
}
.nc-convs-empty__icon { font-size: 3rem; margin-bottom: 14px; }
.nc-convs-empty p { font-size: .88rem; line-height: 1.6; }

/* Conversation item */
.nc-conv-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  cursor: pointer; transition: background .15s; border-bottom: 1px solid var(--nc-border);
  position: relative;
}
.nc-conv-item:hover { background: var(--nc-bg-section); }
.nc-conv-item--active { background: var(--nc-rose-pale); border-right: 3px solid var(--nc-rose); }
.nc-conv-item--unread .nc-conv-item__name { font-weight: 800; color: var(--nc-dark); }
.nc-conv-item--unread .nc-conv-item__preview { color: var(--nc-dark); }

.nc-conv-item__avatar { position: relative; flex-shrink: 0; }
.nc-conv-item__avatar img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.nc-conv-item__avatar .nc-badge--verified { position: absolute; bottom: -2px; right: -2px; transform: scale(.85); }

.nc-conv-item__body { flex: 1; min-width: 0; }
.nc-conv-item__name { font-size: .9rem; font-weight: 600; color: var(--nc-dark); margin-bottom: 3px; }
.nc-conv-item__preview {
  font-size: .78rem; color: var(--nc-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nc-conv-item__badge {
  background: var(--nc-rose); color: #fff; border-radius: 50%;
  min-width: 20px; height: 20px; display: flex; align-items: center;
  justify-content: center; font-size: .68rem; font-weight: 700;
  flex-shrink: 0;
}

/* Chat window */
.nc-chat-window {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--nc-bg-section);
}
.nc-chat-placeholder {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--nc-text-muted); text-align: center; padding: 40px;
}
.nc-chat-placeholder__icon { font-size: 4rem; margin-bottom: 16px; opacity: .5; }

/* Chat header */
.nc-chat-header {
  background: #fff; padding: 14px 20px;
  border-bottom: 1px solid var(--nc-border);
  display: flex; align-items: center; gap: 14px; flex-shrink: 0;
}
.nc-chat-header__avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.nc-chat-header__info { flex: 1; }
.nc-chat-header__name { font-weight: 700; font-size: .95rem; color: var(--nc-dark); }
.nc-chat-header__status { font-size: .75rem; color: var(--nc-text-muted); }
.nc-chat-header__actions { display: flex; gap: 8px; }
.nc-chat-header__btn {
  width: 36px; height: 36px; border-radius: 50%; background: var(--nc-bg-section);
  border: 1px solid var(--nc-border); display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 1rem; transition: var(--nc-transition);
}
.nc-chat-header__btn:hover { background: var(--nc-rose-pale); border-color: var(--nc-rose); }

/* Chat messages */
.nc-chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.nc-chat-messages::-webkit-scrollbar { width: 4px; }
.nc-chat-messages::-webkit-scrollbar-track { background: transparent; }
.nc-chat-messages::-webkit-scrollbar-thumb { background: var(--nc-border); border-radius: 99px; }

/* Message bubble */
.nc-msg { display: flex; flex-direction: column; max-width: 68%; }
.nc-msg--sent { align-self: flex-end; align-items: flex-end; }
.nc-msg--received { align-self: flex-start; align-items: flex-start; }

.nc-msg__bubble {
  padding: 10px 14px; border-radius: 18px;
  font-size: .88rem; line-height: 1.5; word-break: break-word;
}
.nc-msg--sent .nc-msg__bubble {
  background: var(--nc-rose); color: #fff;
  border-bottom-right-radius: 4px;
}
.nc-msg--received .nc-msg__bubble {
  background: #fff; color: var(--nc-text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--nc-shadow-sm);
}

.nc-msg__time { font-size: .68rem; color: var(--nc-text-light); margin-top: 4px; }
.nc-msg--sent .nc-msg__time { text-align: right; }

/* Audio message */
.nc-msg__audio {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: rgba(0,0,0,.06); border-radius: 50px; min-width: 180px;
}
.nc-msg--sent .nc-msg__audio { background: rgba(255,255,255,.2); }
.nc-msg__audio-btn {
  width: 30px; height: 30px; border-radius: 50%; background: currentColor;
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.nc-msg__audio-wave { flex: 1; height: 28px; opacity: .6; }

/* Image message */
.nc-msg__image { border-radius: 12px; max-width: 220px; height: auto; cursor: pointer; }

/* Date divider */
.nc-chat-date {
  text-align: center; font-size: .72rem; color: var(--nc-text-light);
  margin: 8px 0; font-weight: 600;
}

/* Wali badge in chat */
.nc-wali-notice {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: rgba(201,168,76,.08); border-bottom: 1px solid rgba(201,168,76,.2);
  font-size: .78rem; color: var(--nc-dark); flex-shrink: 0;
}
.nc-wali-notice__icon { font-size: 1rem; }

/* Chat input */
.nc-chat-input-area {
  padding: 14px 20px; background: #fff;
  border-top: 1px solid var(--nc-border); flex-shrink: 0;
}
.nc-chat-input-row { display: flex; gap: 10px; align-items: flex-end; }
.nc-chat-input {
  flex: 1; padding: 11px 16px; border-radius: 24px;
  border: 2px solid var(--nc-border); font-family: var(--nc-font-body);
  font-size: .9rem; outline: none; resize: none; max-height: 120px;
  transition: border-color .2s;
}
.nc-chat-input:focus { border-color: var(--nc-rose); }
.nc-chat-input-btns { display: flex; gap: 6px; align-items: center; }
.nc-chat-input-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: var(--nc-bg-section); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; transition: var(--nc-transition);
}
.nc-chat-input-btn:hover { background: var(--nc-rose-pale); }
.nc-chat-send-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--nc-rose); color: #fff; cursor: pointer;
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--nc-shadow-rose); transition: var(--nc-transition);
}
.nc-chat-send-btn:hover { background: var(--nc-rose-dark); transform: scale(1.05); }

@media (max-width: 768px) {
  .nc-messages-layout { grid-template-columns: 1fr; }
  .nc-convs-list { display: none; }
  .nc-convs-list.nc-mobile-open { display: flex; position: fixed; inset: 70px 0 0 0; z-index: 50; }
}
