/* Özel mesaj paneli — tam yükseklik, composer altta */
.pm-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1240;
}

.pm-panel-backdrop.open {
  display: block;
}

body.pm-panel-active {
  overflow: hidden;
}

.pm-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--pm-panel-width, min(92vw, 360px));
  height: 100%;
  max-height: 100dvh;
  z-index: 1250;
  background: var(--bg-white);
  border-left: 1px solid var(--border);
  transform: translateX(105%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

/* Masaüstü: sol kenardan sürükleyerek genişlik */
html:not(.layout-compact) .pm-panel-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  margin-left: -4px;
  cursor: ew-resize;
  z-index: 12;
  touch-action: none;
}

html:not(.layout-compact) .pm-panel-resize-handle::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 48px;
  border-radius: 2px;
  background: var(--border);
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}

html:not(.layout-compact) .pm-panel-resize-handle:hover::after,
body.pm-panel-resizing .pm-panel-resize-handle::after {
  opacity: 1;
  background: var(--accent);
}

html.layout-compact .pm-panel-resize-handle {
  display: none;
}

body.pm-panel-resizing {
  user-select: none;
  cursor: ew-resize;
}

body.pm-panel-resizing .pm-panel {
  transition: none;
}

/* PM composer — oda radyosu / el kaldır yok */
body.pm-compose-active #btnComposerRadio,
body.pm-compose-active #btnComposerRaiseHand {
  display: none !important;
}

.pm-panel.open {
  transform: translateX(0);
}

.pm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top, 0));
  border-bottom: 1px solid var(--border);
  background: #f0f2f5;
  flex-shrink: 0;
  min-height: 52px;
}

.pm-panel-header span {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.pm-call-header-actions.hidden {
  display: none !important;
}

.pm-panel-header button {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-mid);
  padding: 4px 8px;
  flex-shrink: 0;
}

.pm-panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-chat);
}

.pm-messages-container {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 12px 12px;
  background-color: var(--bg-chat);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d9d0c7' fill-opacity='0.35'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pm-panel-footer {
  flex-shrink: 0;
  background: #f0f2f5;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.pm-panel-footer .voice-note-bar {
  margin: 0;
}

.pm-panel-footer .chat-input-area {
  display: block !important;
  padding: 6px 8px 8px;
  padding-right: 8px !important;
  border-top: 1px solid var(--border);
  background: var(--bg-light);
  position: relative;
  z-index: 200;
  overflow: visible;
}

.pm-panel-footer .chat-input-wrapper.wa-composer {
  width: 100%;
}

.pm-panel-footer .composer-overlay-layer {
  z-index: 300;
}

.pm-panel-footer .emoji-picker {
  left: 8px;
  right: 8px;
  bottom: calc(100% + 4px);
  max-height: min(40vh, 280px);
  overflow-y: auto;
}

/* PM içi mesaj boyutları */
.pm-messages-container .message {
  max-width: 88%;
  margin-bottom: 6px;
}

.pm-messages-container .message-profile {
  width: 36px;
}

.pm-messages-container .message-avatar-wrap {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.pm-messages-container .message-sender {
  font-size: 9px;
  max-width: 44px;
}

.pm-messages-container .message-bubble-wrap {
  max-width: 100%;
}

.pm-messages-container .message-bubble {
  font-size: 14px;
}

.pm-messages-container .msg-attachment-audio {
  min-width: 0;
  max-width: 100%;
}

.pm-messages-container .msg-attachment-audio audio {
  width: 100%;
  max-width: 100%;
}

body.pm-panel-active .chat-rail {
  display: none !important;
}

/* Kompakt / mobil — tam ekran PM */
html.layout-compact .pm-panel {
  width: 100%;
  max-width: 100%;
  left: 0;
  right: 0;
  border-left: none;
}

html.layout-compact body.pm-panel-active .chat-input-area {
  padding-right: 8px !important;
}

html.layout-compact .pm-messages-container {
  padding: 8px 10px 10px;
}

html.layout-compact .pm-messages-container .message {
  max-width: 90%;
}

/* Dar masaüstü penceresi (kompakt ama yan panel) */
@media (min-width: 520px) and (max-width: 1024px) {
  html.layout-compact .pm-panel {
    width: min(420px, 92vw);
    left: auto;
    border-left: 1px solid var(--border);
  }
}

body.theme-dark .pm-panel-header {
  background: #202c33;
}

body.theme-dark .pm-panel-footer {
  background: #202c33;
  border-top-color: var(--border);
}

body.theme-dark .pm-panel-body,
body.theme-dark .pm-messages-container {
  background-color: #0b141a;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23182229' fill-opacity='0.8'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
