/* Floating button */
#oh-chat-button{
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #5e3ea1;
  color: #fff;
  padding: 12px 16px;
  border-radius: 9999px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 99998;
  transition: transform .2s ease, box-shadow .2s ease;
}
#oh-chat-button:hover{ transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,0,0,0.25); }

#oh-chat-window{
  display:none;
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  z-index: 99999;
}

.oh-chat-header{
  background: linear-gradient(135deg, #5e3ea1, #7a5bd6);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.oh-chat-title{ font-weight: 700; }
#oh-chat-close{
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

.oh-prechat{ padding: 16px; }
.oh-prechat-row{ margin-bottom: 10px; }
.oh-prechat input{
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 12px;
}
#oh-prechat-start{
  width: 100%; background: #5e3ea1; color: #fff; border: none; padding: 10px 14px; border-radius: 12px; font-weight: 600; cursor: pointer;
}

.oh-chat-messages{
  padding: 12px;
  height: calc(100% - 160px);
  overflow-y: auto;
  background: #f7f7fb;
}

.msg{ display: flex; margin: 6px 0; }
.msg-user{ justify-content: flex-end; }
.msg-admin{ justify-content: flex-start; }

.bubble{
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.35;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg-user .bubble{ background: #5e3ea1; color: #fff; border-bottom-right-radius: 4px; }
.msg-admin .bubble{ background: #ffffff; color: #111; border-bottom-left-radius: 4px; border: 1px solid #eee; }

.oh-chat-input-row{
  display: flex; gap: 8px; padding: 10px; background: #fff; border-top: 1px solid #eee;
}
#oh-chat-input, #oh-admin-input{
  flex: 1; border: 1px solid #ddd; border-radius: 12px; padding: 10px 12px; font-size: 14px;
}
#oh-chat-send, #oh-admin-send{
  background: #5e3ea1; color: #fff; border: none; padding: 10px 14px; border-radius: 12px; font-weight: 600; cursor: pointer;
}

/* Admin layout */
#oh-admin-container{ display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
@media (max-width: 900px){ #oh-admin-container{ grid-template-columns: 1fr; } }

#oh-session-list{ background: #fff; border: 1px solid #e9e9ee; border-radius: 12px; padding: 8px; }
#oh-conversation{ background: #fff; border: 1px solid #e9e9ee; border-radius: 12px; padding: 8px; }
.oh-section-title{ font-weight: 700; margin: 6px 8px 8px; }
#oh-sessions{ list-style: none; padding: 0; margin: 0; }
#oh-sessions li{
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 10px; border-radius: 10px; cursor: pointer;
}
#oh-sessions li:hover{ background: #f4f3fb; }
#oh-sessions li.active{ background: #ebe8f8; }
#oh-sessions li span:first-child{ flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.oh-badge{ background: #e11d48; color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 9999px; margin-left: 8px; }

/* Mobile tweaks */
@media (max-width: 480px){
  #oh-chat-window{ right: 12px; left: 12px; width: auto; height: 70vh; bottom: 72px; }
  .oh-chat-messages{ height: calc(70vh - 160px); }
}
