/* public/assets/css/chat.css
   OvindiWorld — WhatsApp style chat (Option B: smaller popup)
*/

/* Header */
.ow-header {
  background: #075E54;
  color: #fff;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 12px;
  gap:8px;
}
.ow-back-btn, .ow-close-v2 {
  background:transparent;
  border:0;
  color:#fff;
  font-size:18px;
  cursor:pointer;
  padding:4px;
}

/* List screen */
.ow-screen-list{
  flex:1;
  display:flex;
  flex-direction:column;
  background:#fbfdff;
  min-height:0;
}

.ow-search-wrap{padding:8px;border-bottom:1px solid #eef4ff;}
.ow-search-v2{width:100%;padding:8px;border-radius:8px;border:1px solid #dfeafc;}

/* Users */
.ow-users-v2{flex:1;overflow-y:auto;padding:8px; -webkit-overflow-scrolling: touch;}
.ow-user-item{display:flex;align-items:center;gap:10px;padding:10px;border-radius:8px;background:#fff;margin-bottom:8px;cursor:pointer;border:1px solid #f4f7fb;}
.ow-user-item:hover{background:#f6fbf8;}
.ow-avatar-wrap{width:44px;height:44px;border-radius:50%;overflow:hidden;background:#ddd;flex-shrink:0;}
.ow-avatar-img{width:100%;height:100%;object-fit:cover;}
.ow-user-meta{flex:1;}
.ow-user-name{font-weight:600;color:#0f172a;}
.ow-user-sub{font-size:12px;color:#666;margin-top:4px;}
.ow-unread{background:#e74c3c;color:#fff;padding:4px 8px;border-radius:12px;font-size:12px;}

/* Chat screen */
.ow-screen-chat {
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:0;
  position: relative; /* IMPORTANT */
}

.ow-chat-with{display:flex;align-items:center;gap:10px;padding:10px;border-bottom:1px solid #eee;background:#fff;}
.ow-chat-avatar{width:40px;height:40px;border-radius:50%;overflow:hidden;background:#ddd;}
.ow-chat-avatar-img{width:100%;height:100%;object-fit:cover;}
.ow-chat-name{font-weight:600;}
.ow-chat-presence{font-size:12px;color:#666;margin-top:2px;}

/* Messages (WhatsApp-style background) */
.ow-msg-row{margin-bottom:10px;display:flex;}
.ow-msg-row.me{justify-content:flex-end;}
.ow-msg-row.them{justify-content:flex-start;}
.ow-msg-bubble{max-width:75%;padding:10px 12px;border-radius:12px;position:relative;font-size:14px;line-height:1.35;}
/* sent (green) */
.ow-msg-bubble.me{background:#dcf8c6;color:#000;border-bottom-right-radius:4px;}
.ow-msg-bubble.me:after{content:"";position:absolute;right:-8px;bottom:0;border-left:8px solid #dcf8c6;border-top:8px solid transparent;height:0;width:0;}
/* received (white) */
.ow-msg-bubble.them{background:#fff;color:#111;border-bottom-left-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,0.04);}
.ow-msg-bubble.them:after{content:"";position:absolute;left:-8px;bottom:0;border-right:8px solid #fff;border-top:8px solid transparent;height:0;width:0;}

.ow-msg-time{font-size:11px;color:rgba(0,0,0,0.45);margin-top:6px;}

/* Input */
.ow-input-v2{flex:1;padding:10px;border-radius:20px;border:1px solid #e6eefc;outline:none;}
.ow-send-v2{width:44px;height:44px;border-radius:50%;border:0;background:#075E54;color:#fff;font-size:18px;cursor:pointer;}

/* Empty */
.ow-empty{padding:12px;text-align:center;color:#666;}

/* Scrollbar styles (Chrome/WebKit + Firefox) */
.ow-users-v2::-webkit-scrollbar, 
.ow-users-v2::-webkit-scrollbar-thumb,
.ow-users-v2 { scrollbar-width: thin; scrollbar-color: #c8c8c8 transparent; }

@media(max-width:900px){
  #ow-chat-panel-v2{right:10px;left:10px;width:auto;height:70vh;}
  .ow-back-btn{display:inline-block;}
}
.ow-toast {
  position: fixed;
  right: 24px;
  bottom: 120px;
  background: #075E54;
  color: #fff;
  padding: 12px 18px;
  border-radius: 30px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(20px);
  transition: all .3s ease;
  z-index: 20000;
}
.ow-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* === STEP 2 FIXES === */
.ow-msg-row.me .ow-msg-bubble {
  background: #dcf8c6;
}
.ow-msg-row.them .ow-msg-bubble {
  background: #fff;
}

/* === LAST MESSAGE FULL VISIBILITY FIX === */

.ow-avatar-fallback{
  width:100%;
  height:100%;
  background:#94a3b8;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:600;
}


/* === STEP 7 ADDONS === */

/* unread badge on chat button */
#openChatBtn.ow-has-unread::after{
  content:attr(data-count);
  position:absolute;
  top:-6px; right:-6px;
  background:#e53935;
  color:#fff;
  width:22px; height:22px;
  font-size:12px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* emoji picker */
.ow-emoji-popup{
  position:fixed;
  bottom:120px;
  right:40px;
  background:#fff;
  border-radius:12px;
  box-shadow:0 10px 30px rgba(0,0,0,.25);
  padding:8px;
  display:flex;
  gap:6px;
  z-index:30000;
}
.ow-emoji-popup button{
  font-size:20px;
  border:0;
  background:none;
  cursor:pointer;
}

/* message actions */
.ow-msg-actions{
  font-size:12px;
  margin-left:8px;
  opacity:.6;
}
.ow-msg-actions a{cursor:pointer;margin-left:6px;}

/* FIX A — User list avatar size */
.ow-user-item .ow-avatar-img{
  width:44px !important;
  height:44px !important;
  border-radius:50%;
  object-fit:cover;
  flex-shrink:0;
}

/* === FIX C: CURSOR NORMALIZATION === */
.ow-user-item,
.ow-user-item * {
  cursor: pointer !important;
}

.ow-input-v2 {
  cursor: text !important;
}.ow-react {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity .2s ease;
}

.ow-msg-bubble:hover .ow-react {
  opacity: 1;
}

.ow-react span {
  cursor: pointer;
  font-size: 15px;
  user-select: none;
}

.ow-react span:hover {
  transform: scale(1.2);
}

.ow-reaction-badge {
  font-size: 12px;
  line-height: 1;
}

.ow-react {
  display: none;
  gap: 6px;
  margin-top: 4px;
}

.ow-msg-row.show-react .ow-react {
  display: flex;
}

.ow-emoji-picker {
  background: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

.ow-msg-menu{
  position:absolute;
  top:-40px;
  right:0;
  background:#fff;
  border-radius:10px;
  box-shadow:0 6px 18px rgba(0,0,0,.2);
  padding:6px;
  display:flex;
  gap:6px;
  z-index:10;
}
.ow-msg-menu button{
  border:0;
  background:none;
  cursor:pointer;
  font-size:13px;
}

.ow-presence-dot {
  display:inline-block;
  width:10px;
  height:10px;
  border-radius:50%;
  margin-right:6px;
  vertical-align:middle;
}
.ow-presence-dot.online {
  background:#00c853;
}
.ow-presence-dot.offline {
  background:#bbb;
}

.ow-unread{
  background:#e74c3c;
  color:#fff;
  padding:4px 8px;
  border-radius:12px;
  font-size:12px;
}

/* ===============================
   MESSAGE REACTIONS (FINAL)
================================ */

/* reaction bubble holder */
.ow-reactions {
  position: absolute;
  bottom: -12px;
  right: 6px;
  display: inline-flex;
  gap: 4px;
  background: #fff;
  border-radius: 12px;
  padding: 2px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  font-size: 12px;
  z-index: 2;
  white-space: nowrap;
}

/* received messages align left */
.ow-msg-row.them .ow-reactions {
  left: 6px;
  right: auto;
}

/* emoji badge */
.ow-reaction-badge {
  line-height: 1;
  cursor: default;
}

.ow-screen-chat {
  position: relative;
}

.ow-emoji-btn{
  background:none;
  border:0;
  font-size:20px;
  cursor:pointer;
}

.ow-msg-bubble {
  overflow: visible;
  word-wrap: break-word;
   overflow-wrap: break-word;
   word-break: break-word;
   }

#ow-chat-panel-v2 {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  height: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.25);
  overflow: hidden;
  z-index: 99999;
}

/* chat screen layout */


/* message area */
.ow-msgs-v2{
  flex:1;
  overflow-y:auto;
  padding:12px;
  background:#ece5dd;
  min-height:0;
}


/* input area */
.ow-input-container{
  flex-shrink:0;
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px;
  background:#fff;
  border-top:1px solid #eee;
}

#openChatBtn {
  z-index: 1000;
}

#ow-chat-panel-v2 {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  height: 600px;
  max-height: 85vh;

  display: flex;
  flex-direction: column;

  background: #fff;
  border-radius: 16px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.25);

  z-index: 99999;
}

@media(max-width:900px){
  #ow-chat-panel-v2{
    right:10px;
    left:10px;
    width:auto;
    height:80vh;
    bottom:90px;
  }
}

.ow-confirm-box{
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
background:rgba(0,0,0,.4);
display:flex;
align-items:center;
justify-content:center;
z-index:999;
}

.ow-confirm-inner{
background:#fff;
padding:20px;
border-radius:12px;
text-align:center;
}

.ow-confirm-actions{
margin-top:10px;
display:flex;
gap:10px;
justify-content:center;
}

.ow-confirm-actions button{
padding:6px 14px;
border:0;
border-radius:6px;
cursor:pointer;
}

/* === FINAL EMOJI PICKER FIX === */

.ow-msg-emoji-picker {
  position: absolute;

  /* ✅ PERFECT CENTER */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;

  box-shadow: 0 10px 25px rgba(0,0,0,0.25);

  z-index: 99999;

  min-width: 220px;
}

/* emoji row */
.ow-msg-emoji-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.ow-msg-emoji-row span {
  font-size: 18px;
  cursor: pointer;
}

/* delete button */
.ow-delete-btn {
  font-size: 12px;
  margin-top: 6px;
  cursor: pointer;
  opacity: 0.7;
  text-align: left;
}

.ow-delete-btn:hover {
  opacity: 1;
}