/* Запозналник.EU — мобилен чат (WhatsApp/Viber UX), растящо поле, 3D подаръци в историята */
#profile-modal { z-index: 30 !important; }

/* Растящо поле за писане (2 → 6 реда) */
body #message-body,
body #profile-chat-input {
  box-sizing: border-box !important;
  resize: none !important;
  line-height: 1.4 !important;
  transition: height .12s ease-out;
  -webkit-overflow-scrolling: touch;
}
body #message-compose,
body .profile-chat-compose { align-items: flex-end !important; }
body #message-compose .universal-emoji-field { align-items: flex-end !important; }
body #message-compose .universal-emoji-trigger,
body #message-compose .zpe-gift-btn,
body #message-compose .composer-plus-wrap,
body #message-compose .message-voice-button,
body #message-compose > button,
body .profile-chat-compose .zpe-gift-btn,
body .profile-chat-compose .composer-plus-wrap,
body .profile-chat-compose .profile-chat-send { align-self: flex-end !important; margin-bottom: 4px !important; }
body #message-compose .zpe-gift-btn,
body .profile-chat-compose .zpe-gift-btn { width: 40px !important; height: 40px !important; flex: 0 0 40px !important; }

/* Мобилен хедър на отворен разговор */
.zp-chat-topbar { display: none; }
@media (max-width: 768px) {
  body.zp-chat-thread #communication-modal.open {
    top: var(--zp-vvt, 0px) !important;
    bottom: auto !important;
    height: var(--zp-vvh, 100dvh) !important;
  }
  body.zp-chat-thread #communication-modal .communication-card {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    padding: 0 0 calc(8px + env(safe-area-inset-bottom)) !important;
    border-radius: 0 !important;
  }
  body.zp-chat-thread #communication-modal .communication-card > h2,
  body.zp-chat-thread #communication-modal .communication-tabs,
  body.zp-chat-thread #communication-modal .communication-card > .modal-back,
  body.zp-chat-thread #communication-modal .communication-card > .close-modal,
  body.zp-chat-thread #conversation-list,
  body.zp-chat-thread #communication-report,
  body.zp-chat-thread #conversation .conversation-filter-title { display: none !important; }
  body.zp-chat-thread #messages-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    gap: 8px !important;
    padding: 0 10px !important;
  }
  body.zp-chat-thread #conversation {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 18px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch !important;
  }
  body.zp-chat-thread #message-compose { flex: 0 0 auto !important; }
  body.zp-chat-thread .zp-chat-topbar {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 62px;
    padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
    box-sizing: border-box;
    background: linear-gradient(135deg, rgba(76, 29, 149, .97), rgba(124, 58, 237, .95) 55%, rgba(192, 38, 211, .95));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 22px -8px rgba(76, 29, 149, .55);
    color: #fff;
    margin-bottom: 6px;
  }
}
.zp-chat-topbar button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.zp-ct-back, .zp-ct-more {
  display: grid; place-items: center; flex: 0 0 46px; width: 46px; height: 46px;
  border-radius: 50%; font-size: 24px !important; font-weight: 800; line-height: 1;
}
.zp-ct-back:active, .zp-ct-more:active, .zp-ct-person:active { background: rgba(255, 255, 255, .16) !important; }
.zp-ct-person { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; padding: 4px 8px 4px 2px !important; border-radius: 999px; text-align: left; }
.zp-ct-ava { position: relative; flex: 0 0 44px; width: 44px; height: 44px; padding: 2.5px; border-radius: 50%; background: linear-gradient(135deg, #f43f5e, #a855f7 50%, #f59e0b); box-sizing: border-box; }
.zp-ct-ava img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-sizing: border-box; background: #ede9fe; }
.zp-ct-ava i { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: #94a3b8; }
.zp-ct-ava i.active, .zp-ct-ava i.online { background: #10b981; }
.zp-ct-ava i.away { background: #f59e0b; }
.zp-ct-txt { display: flex; flex-direction: column; min-width: 0; }
.zp-ct-name { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zp-ct-status { font-size: 12px; font-weight: 600; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zp-ct-menu {
  position: absolute; top: calc(100% - 4px); right: 10px; z-index: 8; min-width: 210px; padding: 6px;
  border-radius: 16px; background: #fff; color: #2e1065; border: 1px solid rgba(124, 58, 237, .2);
  box-shadow: 0 18px 40px -10px rgba(76, 29, 149, .45);
}
.zp-ct-menu[hidden] { display: none !important; }
.zp-ct-menu button { display: block; width: 100%; padding: 12px 14px !important; border-radius: 12px; text-align: left; font-weight: 700 !important; font-size: 14.5px !important; color: #2e1065 !important; }
.zp-ct-menu button:active { background: #f3e8ff !important; }

/* Профил над чата и мобилният профилен чат с клавиатура */
.profile-detail-card.chat-open .profile-chat-person { cursor: pointer; }
@media (max-width: 600px) {
  body #profile-modal.open { top: var(--zp-vvt, 0px) !important; bottom: auto !important; height: var(--zp-vvh, 100dvh) !important; }
  body .profile-detail-card.chat-open { height: 100% !important; }
  body .profile-detail-card.chat-open .profile-direct-chat { height: calc(var(--zp-vvh, 100dvh) - 76px - env(safe-area-inset-top)) !important; }
  body .profile-detail-card.chat-open .profile-chat-history { overscroll-behavior: contain; }
}

/* Постоянни 3D карти на подаръците в историята */
body #conversation .message-bubble.zp-gift-bubble,
body #profile-chat-history .profile-chat-bubble.zp-gift-bubble {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: none !important;
}
body .zp-gift-bubble .message-time,
body .zp-gift-bubble time { color: #6b5b8a !important; }
body .zp-gift-bubble .zp-chat-gift-card { margin: 2px 0 4px; }
.zpc-card { outline: none; }
.zpc-card:focus-visible { box-shadow: 0 0 0 3px #f9a8d4 !important; }
.zpc-when { margin-top: 6px; font-size: 11px; font-weight: 700; color: #e9d5ff; letter-spacing: .2px; }
.zpc-hint {
  display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(250, 204, 21, .22), rgba(236, 72, 153, .28));
  border: 1px solid rgba(250, 204, 21, .55); color: #fde68a; font-size: 10.5px; font-weight: 800;
  animation: zpcHint 2.4s ease-in-out infinite;
}
@keyframes zpcHint { 0%, 100% { opacity: .8; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }
.zp-chat-gift-card { cursor: pointer; }
.zp-chat-gift-card:active { transform: scale(.97); }
.zpd-sc-item { cursor: pointer; }
#zpcBurst { position: fixed; inset: 0; z-index: 1000000; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .zpc-hint { animation: none; } }

/* ---------- Двуредов композер: поле горе (2→5 реда), икони + Изпрати отдолу ---------- */
html body #message-compose.wa-composer,
html body .profile-chat-compose.wa-composer {
  display: flex !important;
  flex-flow: row wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 10px 12px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(124, 58, 237, 0.18) !important;
  box-sizing: border-box !important;
}
html body #message-compose.wa-composer .universal-emoji-field {
  display: contents !important;
}
html body #message-compose.wa-composer #message-body,
html body .profile-chat-compose.wa-composer #profile-chat-input {
  order: 0 !important;
  display: block !important;
  flex: 0 0 100% !important;
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 5px 14px !important;
  font-family: inherit !important;
  font-size: 15px !important;
  line-height: 22px !important;
  color: #1e1b4b !important;
  background: #ffffff !important;
  border: 1.5px solid rgba(124, 58, 237, 0.35) !important;
  border-radius: 16px !important;
  outline: none !important;
  resize: none !important;
  box-shadow: inset 0 1px 3px rgba(124, 58, 237, 0.06) !important;
  box-sizing: border-box !important;
  transition: height 0.12s ease-out, border-color 0.2s ease, box-shadow 0.2s ease !important;
}
html body #message-compose.wa-composer #message-body:focus,
html body .profile-chat-compose.wa-composer #profile-chat-input:focus {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15) !important;
}
html body #message-compose.wa-composer .universal-emoji-trigger,
html body #message-compose.wa-composer .zpe-gift-btn,
html body #message-compose.wa-composer .zp-vm-btn,
html body .profile-chat-compose.wa-composer .zpe-gift-btn,
html body .profile-chat-compose.wa-composer .zp-vm-btn {
  order: 1 !important;
  align-self: center !important;
  margin: 0 !important;
}
html body #message-compose.wa-composer .composer-plus-wrap,
html body .profile-chat-compose.wa-composer .composer-plus-wrap {
  order: 2 !important;
  align-self: center !important;
  margin: 0 !important;
}
html body #message-compose.wa-composer > button:not(.composer-plus-btn):not(.message-voice-button),
html body .profile-chat-compose.wa-composer .profile-chat-send {
  order: 3 !important;
  align-self: center !important;
  margin: 0 0 0 auto !important;
}
html body #message-compose.wa-composer .universal-emoji-trigger,
html body #message-compose.wa-composer .zpe-gift-btn,
html body #message-compose.wa-composer .zp-vm-btn,
html body #message-compose.wa-composer .composer-plus-btn,
html body .profile-chat-compose.wa-composer .zpe-gift-btn,
html body .profile-chat-compose.wa-composer .zp-vm-btn,
html body .profile-chat-compose.wa-composer .composer-plus-btn {
  flex: 0 0 40px !important;
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  font-size: 19px !important;
}
html body #message-compose.wa-composer > button:not(.composer-plus-btn):not(.message-voice-button) {
  flex: 0 0 auto !important;
  min-width: 96px !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 20px !important;
  font-size: 15px !important;
}
html body .profile-chat-compose.wa-composer .profile-chat-send {
  flex: 0 0 auto !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 42px !important;
}
@media (max-width: 768px) {
  html body #message-compose.wa-composer #message-body,
  html body .profile-chat-compose.wa-composer #profile-chat-input {
    font-size: 16px !important;
  }
}
