/* Gelen mesajlar — Bootstrap 5.3 eklentileri; layout / özet satır / details */

#tagFilterToggle.tag-filter-toggle {
  --bs-btn-color: var(--bs-primary-text-emphasis);
  background: transparent;
}
#tagFilterToggle.tag-filter-toggle:hover,
#tagFilterToggle.tag-filter-toggle:focus {
  color: var(--bs-primary);
  background: rgba(255, 255, 255, 0.25);
}
#dateFilterToggle.date-filter-toggle {
  --bs-btn-color: var(--bs-secondary);
  background: transparent;
}
#dateFilterToggle.date-filter-toggle:hover,
#dateFilterToggle.date-filter-toggle:focus {
  color: var(--bs-body-color);
  background: rgba(0, 0, 0, 0.04);
}
.msg-filter-chevron {
  display: inline-block;
  font-size: 0.5rem;
  line-height: 1;
  transition: transform 0.2s ease;
  transform: rotate(0deg);
}
#messagesLive.messages-live-pill {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.2em 0.55em;
}
.msg-count-pill {
  font-size: 0.7rem;
  padding: 0.25em 0.5em;
}
#tagFilterToggle.collapsed .msg-filter-chevron,
#dateFilterToggle.collapsed .msg-filter-chevron {
  transform: rotate(-90deg);
}

#messageBulkBar .bulk-tag-picks .form-check {
  margin-bottom: 0;
}
#messageBulkBar .bulk-tag-picks .form-check-label {
  word-break: break-word;
  hyphens: auto;
}

body.messages-page-body {
  max-width: 100% !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
}

/* Kullanıcı listesinde “seçili” = WhatsApp yeşili (Bootstrap .active mavi değil) */
.list-group-messages .list-group-item.user-item.list-group-item-action.active {
  background-color: #25d366;
  border-color: #25d366;
  color: #fff;
  z-index: 1;
}
.list-group-messages .list-group-item.user-item.list-group-item-action.active .user-item-phone,
.list-group-messages .list-group-item.user-item.list-group-item-action.active .user-item-name {
  color: inherit;
}
.list-group-messages .list-group-item.user-item .user-msg-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.65em;
  vertical-align: middle;
}
.list-group-messages
  .list-group-item.user-item.list-group-item-action.active
  .user-item-avatar {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #fff;
}
.list-group-messages
  .list-group-item.user-item.list-group-item-action:not(.active)
  .user-msg-count {
  background: var(--bs-secondary-bg, #e9ecef);
  color: var(--bs-body-color, #212529);
}

/* Avatar — kompakt */
.user-item-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  font-size: 0.72rem;
  line-height: 1;
}
.list-group-messages .list-group-item {
  padding: 0.4rem 0.5rem;
  min-height: auto;
}
.msg-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  line-height: 1;
  font-size: 0.8rem;
}
/* Mesaj satırındaki küçük checkbox */
.msg-select-hold .form-check-input {
  width: 0.95rem;
  height: 0.95rem;
  margin-top: 0.1rem;
}
/* Mesaj kartı “Etiketler”: checkbox + metin aynı hizada (grid hücresi + flex satır) */
.msg-tags-panel__picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  column-gap: 0.5rem;
  row-gap: 0.35rem;
  align-items: center;
}
.msg-tags-panel__picks .msg-panel-tag {
  min-height: 1.3rem;
}
.msg-tags-panel__picks .form-check-input.msg-panel-tag-cb {
  width: 0.9rem;
  height: 0.9rem;
  float: none;
  position: static;
  margin: 0 !important;
  flex-shrink: 0;
  align-self: center;
}
.msg-tags-panel__picks .form-check-label {
  padding-left: 0;
  word-break: break-word;
  cursor: pointer;
  align-self: center;
}
.msg-reply-status {
  font-size: 0.75rem;
  line-height: 1.3;
}

.messages-sidebar {
  max-height: 70vh;
  overflow-y: auto;
  border-bottom: 1px solid var(--bs-border-color);
}
@media (min-width: 992px) {
  .messages-sidebar {
    border-bottom: 0;
    border-right: 1px solid var(--bs-border-color);
  }
}

@media (max-width: 991.98px) {
  .messages-sidebar {
    max-height: 40vh;
  }
}

/* <details> özet: marker gizle (Chrome/Safari) */
.msg-card__summary::-webkit-details-marker,
.msg-card__summary::marker {
  display: none;
}
.msg-card__summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.msg-card__summary:focus-visible {
  outline: 2px solid #25d366;
  outline-offset: 2px;
  border-radius: var(--bs-border-radius);
}

/* Ok işareti — küçük */
.msg-card__chevron {
  width: 0;
  height: 0;
  margin-top: 0.4rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--bs-secondary);
  transition: transform 0.2s ease;
}
.msg-card:not([open]) .msg-card__chevron {
  transform: rotate(-90deg);
}

/* Cevap satırı — yeşil vurgu (Bootstrap ile tamamlanır) */
.msg-outgoing-log__item {
  margin: 0.4rem 0;
  word-break: break-word;
}

/* Etiket chip’i “Tümü” için: aktif = dolu mavi, Bootstrap .btn .active yeterli */
.btn.tag-chip.btn-outline-primary.active {
  color: #fff;
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

/* Form: tarih alanları odak rengi (WhatsApp) */
#filterDateFrom:focus,
#filterDateTo:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.25);
}

/* Cevap textarea */
.msg-reply-input:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.2);
}
.msg-reply-btn:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.45) !important;
}

.msg-reply-status--ok {
  color: var(--bs-success) !important;
  font-weight: 500;
}
.msg-reply-status--error {
  color: var(--bs-danger) !important;
  font-weight: 500;
}

/* Okunmamış mesaj — tıklanmadan önce yeşil arka plan */
.msg-card.msg-unread {
  background-color: #eafaf1 !important;
  border-color: #a9dfbf !important;
}

/* Thread (sohbet) görünümü */
.thread-view {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.thread-item {
  display: flex;
  max-width: 82%;
}
.thread-item--in {
  align-self: flex-start;
}
.thread-item--out {
  align-self: flex-end;
}
.thread-bubble {
  border-radius: 1rem;
  word-break: break-word;
}
.thread-bubble--in {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-bottom-left-radius: 0.25rem;
  width: 100%;
}
.thread-bubble--in summary::-webkit-details-marker,
.thread-bubble--in summary::marker { display: none; }
.thread-bubble--out {
  background: #e2ffc7;
  border: 1px solid #b5e5a0;
  border-bottom-right-radius: 0.25rem;
  padding: 0.5rem 0.75rem;
}
@media (prefers-color-scheme: dark) {
  .thread-bubble--out {
    background: #1a4a2a;
    border-color: #2d7a4a;
    color: #d4f5d4;
  }
}
.thread-bubble__body {
  font-size: 0.875rem;
  line-height: 1.45;
}
.thread-bubble__meta {
  font-size: 0.65rem;
  color: var(--bs-secondary-color, #6c757d);
  text-align: right;
  margin-top: 0.2rem;
}
.thread-item--in .thread-bubble--in .msg-card__panel {
  border-bottom-left-radius: 0.25rem;
  border-bottom-right-radius: 1rem;
}
