/* ══════════════════════════════════════════
   MESSENGER PANEL
══════════════════════════════════════════ */

/* ── Панель — скользит справа поверх всего ── */
.ms-panel {
  position: fixed; top: 48px; right: 0; bottom: 36px;
  width: 520px; max-width: 45vw;
  display: flex; flex-direction: column;
  background: rgba(10,15,24,.97);
  border-left: 1px solid var(--steel-hi);
  box-shadow: -8px 0 40px rgba(0,0,0,.6);
  animation: ms-slide-in .25s cubic-bezier(.16,1,.3,1);
  z-index: 800;
}

@keyframes ms-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Хедер панели ── */
.ms-panel-hdr {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg2); border-bottom: 1px solid var(--steel-hi);
  position: relative;
}
.ms-panel-hdr::after {
  content: ''; position: absolute; bottom: -1px; left: 0; width: 50%; height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.ms-panel-title {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Rajdhani', sans-serif; font-size: 12px; font-weight: 700;
  color: var(--gold); letter-spacing: 4px; text-transform: uppercase;
}
.ms-panel-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}
.ms-close {
  background: none; border: none; color: var(--txt-lo);
  font-size: 16px; line-height: 1; padding: 2px 4px;
  transition: color var(--transition);
}
.ms-close:hover { color: var(--red); }

/* ── Тело: список + окно ── */
.ms-body {
  flex: 1; display: flex; overflow: hidden;
}

/* ══ СПИСОК ЧАТОВ ══ */
.ms-list {
  width: 220px; flex-shrink: 0;
  overflow-y: auto; padding: 8px 0;
  background: rgba(8,12,20,.8);
  border-right: 1px solid var(--steel-hi);
  display: flex; flex-direction: column; gap: 0;
}

.ms-group { margin-bottom: 4px; }
.ms-group-label {
  font-family: 'Share Tech Mono', monospace; font-size: 8px;
  color: var(--txt-lo); letter-spacing: 2px; text-transform: uppercase;
  padding: 8px 12px 4px;
}

.ms-chat-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; cursor: pointer; position: relative;
  transition: background var(--transition);
}
.ms-chat-item:hover  { background: rgba(42,53,69,.5); }
.ms-chat-item.active { background: rgba(200,162,39,.08); border-left: 2px solid var(--gold); padding-left: 8px; }

.ms-chat-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
  background: rgba(14,21,32,.9); border: 1px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

.ms-chat-info    { flex: 1; min-width: 0; }
.ms-chat-top     { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; margin-bottom: 2px; }
.ms-chat-name    { font-family: 'Rajdhani', sans-serif; font-size: 12px; font-weight: 700; color: var(--txt-hi); letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.ms-chat-time    { font-family: 'Share Tech Mono', monospace; font-size: 8px; color: var(--txt-lo); white-space: nowrap; flex-shrink: 0; }
.ms-chat-preview { font-size: 9px; color: var(--txt-lo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-chat-author  { color: var(--txt); }

.ms-unread-badge {
  flex-shrink: 0; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--red); color: #fff;
  font-family: 'Share Tech Mono', monospace; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; box-shadow: 0 0 8px rgba(224,64,64,.6);
}

/* ══ ОКНО ПЕРЕПИСКИ ══ */
.ms-window {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

.ms-win-hdr {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: rgba(14,21,32,.6);
  border-bottom: 1px solid var(--steel-hi);
}
.ms-win-icon {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  background: rgba(14,21,32,.9); border: 1px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.ms-win-info { flex: 1; min-width: 0; }
.ms-win-name { font-family: 'Rajdhani', sans-serif; font-size: 15px; font-weight: 700; color: var(--txt-hi); letter-spacing: .5px; }
.ms-win-type { font-family: 'Share Tech Mono', monospace; font-size: 9px; letter-spacing: 1px; margin-top: 1px; }

/* Сообщения */
.ms-messages {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 39px,
    rgba(42,53,69,.05) 39px,
    rgba(42,53,69,.05) 40px
  );
}

.ms-msg {
  display: flex; align-items: flex-end; gap: 8px;
  animation: fadeup .15s ease-out;
}
.ms-msg.self { flex-direction: row-reverse; }

.ms-msg-ava {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  background: linear-gradient(135deg, #2a3545, #1a2230);
  border: 1px solid var(--steel-hi);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: var(--txt-lo);
  letter-spacing: .5px;
}
.ms-msg-ava.self {
  background: linear-gradient(135deg, #2a4a1e, #0e2808);
  border-color: rgba(47,214,122,.3); color: var(--green);
}

.ms-msg-body { display: flex; flex-direction: column; gap: 2px; max-width: 72%; }
.ms-msg.self .ms-msg-body { align-items: flex-end; }

.ms-msg-author { font-size: 9px; color: var(--txt-lo); letter-spacing: .5px; padding: 0 2px; }

.ms-msg-bubble {
  padding: 8px 12px;
  background: rgba(42,53,69,.7); border: 1px solid var(--steel-hi);
  font-size: 12px; color: var(--txt-hi); line-height: 1.6;
  clip-path: polygon(8px 0%,100% 0%,100% calc(100% - 8px),calc(100% - 8px) 100%,0% 100%,0% 8px);
}
.ms-msg.self .ms-msg-bubble {
  background: rgba(14,40,18,.85); border-color: rgba(47,214,122,.25);
  clip-path: polygon(0% 0%,calc(100% - 8px) 0%,100% 8px,100% 100%,8px 100%,0% calc(100% - 8px));
}

.ms-msg-time { font-family: 'Share Tech Mono', monospace; font-size: 8px; color: var(--txt-lo); padding: 0 2px; }

/* ── Поле ввода ── */
.ms-input-row {
  flex-shrink: 0; display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  background: rgba(10,15,24,.9); border-top: 1px solid var(--steel-hi);
}
.ms-input {
  flex: 1; min-height: 38px; max-height: 100px; padding: 9px 12px;
  background: rgba(14,21,32,.9); border: 1px solid var(--steel-hi);
  color: var(--txt-hi); font-family: 'Exo 2', sans-serif; font-size: 12px;
  outline: none; resize: none; line-height: 1.5;
  transition: border-color var(--transition);
  clip-path: polygon(6px 0%,100% 0%,100% calc(100% - 6px),calc(100% - 6px) 100%,0% 100%,0% 6px);
}
.ms-input::placeholder { color: var(--txt-lo); }
.ms-input:focus { border-color: var(--teal); }

.ms-send-btn {
  width: 42px; height: 38px; flex-shrink: 0;
  background: rgba(42,53,69,.8); border: 1px solid var(--steel-hi);
  color: var(--txt-lo); font-size: 14px;
  transition: all var(--transition);
  clip-path: polygon(6px 0%,100% 0%,100% calc(100% - 6px),calc(100% - 6px) 100%,0% 100%,0% 6px);
}
.ms-send-btn.ready {
  background: rgba(14,40,18,.9); border-color: rgba(47,214,122,.5);
  color: var(--green); box-shadow: 0 0 10px rgba(47,214,122,.2);
}
.ms-send-btn.ready:hover { background: rgba(20,60,24,.9); box-shadow: 0 0 16px rgba(47,214,122,.35); }
