/* PC65 — Uporządkowany czat: odpowiedzi, panel emoji, przewijanie.
   Wyłącznie warstwa interfejsu. PC45/PC63/PC64 pozostają bez zmian. */

/* Odpowiedź w pełnym czacie bez dodatkowego, pustego wiersza pod kartą. */
#pc-chat-log .pc-chat-message {
  row-gap: 2px !important;
}
#pc-chat-log .pc-chat-message > .pc40-frame,
#pc-chat-log .pc-chat-message > .pc27-avatar {
  grid-row: 1 / span 3 !important;
  margin: 3px 0 0 !important;
}
#pc-chat-log .pc-chat-message > .pc64-reply {
  grid-column: 2 !important;
  grid-row: 4 !important;
  display: inline-flex !important;
  align-items: center;
  justify-self: start !important;
  align-self: center;
  width: max-content;
  max-width: 100%;
  margin: 1px 0 0 !important;
  padding: 3px 7px 3px 0 !important;
  font-size: 12px;
  line-height: 1.4;
  text-decoration: none;
  border: 0;
  border-radius: 5px;
}
#pc-chat-log .pc-chat-message > .pc64-reply:hover {text-decoration: underline;}
#pc-chat-log .pc-chat-message > .pc-chat-delete {
  grid-column: 2 !important;
  grid-row: 4 !important;
  justify-self: end !important;
  align-self: center;
  margin: 1px 0 0 !important;
  padding: 3px 0 !important;
}
/* Dla bardzo wąskich dymków akcje mogą pozostać obok siebie. */
#pc-chat-log .pc-chat-message > p {margin-bottom: 2px !important;}

/* Również w Mini Pogaduchach: przycisk odpowiedzi tuż pod tekstem. */
#pc62-messages .pc62-message .pc64-reply {
  display:inline-flex;
  align-self:flex-start;
  align-items:center;
  width:max-content;
  max-width:100%;
  margin:4px 0 0 !important;
  padding:2px 5px 2px 0 !important;
  font-size:11px;
  line-height:1.35;
  text-decoration:none;
}
#pc62-messages .pc62-message .pc64-reply:hover {text-decoration:underline;}

/* Główny wybierak emoji jako szeroki panel NAD CAŁYM polem wiadomości. */
#pc-chat.pc-chat-box {overflow:visible !important;}
#pc-chat-form {position:relative !important;min-width:0;}
#pc-chat-form .pc25-chat-input-wrap {min-width:0;width:100%;}
#pc-chat-form #pc25-emoji-picker {
  position:absolute !important;
  left:12px !important;
  right:12px !important;
  bottom:calc(100% + 7px) !important;
  width:auto !important;
  max-width:none !important;
  max-height:min(45vh, 310px);
  overflow-y:auto;
  overflow-x:hidden;
  margin:0 !important;
  padding:12px !important;
  z-index:120;
  box-sizing:border-box;
  box-shadow:0 12px 38px #000d;
}
#pc-chat-form #pc25-emoji-picker[hidden] {display:none !important;}
#pc-chat-form #pc25-emoji-picker:not([hidden]) {display:grid !important;}
#pc-chat-form #pc25-emoji-picker .pc25-emoji-row {display:flex;flex-wrap:wrap;gap:5px;}

/* Mini Pogaduchy już mają popover, rozszerzamy go na całe pole pisania. */
#pc62-popup .pc62-composer {position:relative;min-width:0;}
#pc62-popup #pc62-emoji-picker {
  position:absolute !important;
  left:8px !important;
  right:8px !important;
  bottom:calc(100% + 6px) !important;
  width:auto !important;
  max-width:none !important;
  max-height:min(43vh, 245px);
  overflow-y:auto;
  padding:11px;
  z-index:120;
  box-sizing:border-box;
}
#pc62-popup #pc62-emoji-picker[hidden] {display:none !important;}
#pc62-popup #pc62-emoji-picker .pc62-emoji-row {display:flex;flex-wrap:wrap;gap:5px;}

/* Pojawia się tylko, jeśli czytamy starsze wiadomości, gdy przyjdą nowe. */
.pc65-chat-log-shell {position:relative;min-width:0;}
.pc65-newer {
  position:absolute;
  right:15px;
  bottom:12px;
  z-index:80;
  min-height:38px;
  border-radius:999px;
  padding:8px 13px;
  border:1px solid #e6af65;
  background:#234333;
  color:#fff4dc;
  font:700 12px/1.25 system-ui,sans-serif;
  box-shadow:0 5px 22px #000a;
  cursor:pointer;
}
.pc65-newer:hover {background:#2d5843;}
.pc65-newer[hidden] {display:none !important;}
.pc65-newer:focus-visible{outline:2px solid #ffc87e;outline-offset:3px;}
#pc62-popup {position:fixed;}
#pc62-popup > .pc65-newer {
  right:16px;
  bottom:118px;
  z-index:125;
}
@media(max-width:480px) {
  #pc-chat-form #pc25-emoji-picker{left:5px !important;right:5px !important;max-height:260px;}
  #pc-chat-log .pc-chat-message > .pc64-reply{font-size:11px;}
  #pc62-popup #pc62-emoji-picker{max-height:205px;}
}
@media(prefers-reduced-motion:reduce){.pc65-newer{scroll-behavior:auto;}}
/* W starych stylach telefonu .pc-chat-form .btn dostawał width:100%.
   Wewnątrz jednego wiersza inputu powodowało to poziome przewijanie. */
@media(max-width:400px){
  #pc-chat-form .pc25-chat-input-wrap{display:flex;flex-wrap:wrap;min-width:0;}
  #pc-chat-form .pc25-chat-input-wrap>.btn{
    width:auto !important;min-width:80px;max-width:100%;flex:0 0 auto;
    padding-inline:9px;
  }
  #pc-chat-form .pc25-chat-input-wrap>.input{width:0;min-width:70px;flex:1 1 92px;}
}
