:root {
  --aware-primary: #0d6efd;
}

.aware-chat-launcher {
  position: fixed;
  width: 56px;
  height: 56px;
  bottom: 16px;
  right: 16px;
  border-radius: 50%;
  background: var(--aware-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  font-size: 18px;
  color: #fff;
}

/* Badge */
.launcher-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc3545;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.launcher-badge.hidden {
  display: none;
}

.aware-chat-widget {
  position: fixed;
  right: 16px;
  bottom: calc(16px + 56px + 12px); /* launcher + gap */
  height: 60vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}

.aware-chat-widget.hidden {
  display: none;
}

/* BOTTOM */
.position-bottom-right { bottom: 16px; right: 16px; }
.position-bottom-center { bottom: 16px; left: 50%; transform: translateX(-50%); }
.position-bottom-left { bottom: 16px; left: 16px; }

/* CENTER */
.position-center-right { top: 50%; right: 16px; transform: translateY(-50%); }
.position-center-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.position-center-left { top: 50%; left: 16px; transform: translateY(-50%); }

/* TOP */
.position-top-right { top: 16px; right: 16px; }
.position-top-center { top: 16px; left: 50%; transform: translateX(-50%); }
.position-top-left { top: 16px; left: 16px; }


/* MOBILE */
@media (max-width: 575px) {
  .aware-chat-widget {
    width: 70vw;
    height: 75vh;
    left: 50% !important;
    bottom: 12px !important;
    transform: translateX(-50%) !important;
    border-radius: 10px;
  }

  .aware-chat-launcher {
    bottom: 12px;
    right: 12px;
  }
}

/* TABLET */
@media (min-width: 576px) and (max-width: 991px) {
  .aware-chat-widget {
    width: 45vw;
    height: 70vh;
    max-height: 600px;
  }
}

/* DESKTOP */
@media (min-width: 992px) {
  .aware-chat-widget {
    width: 22vw;
    min-width: 320px;
    max-width: 380px;
    height: 600px;
  }
}

/* ======================
   HEADER
====================== */

.aware-chat-header {
  padding: 8px 12px;
  background: #f5f5f5;
  border-bottom: 1px solid #eee;
}

.aware-chat-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Evita que el título se vaya abajo */
.aware-chat-header-top strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.aware-chat-header-typing {
  margin-left: auto;
  font-size: 11px;
  color: #666;
}

/* =========================
   PRESENCIA ONLINE / OFFLINE
========================= */

.aware-chat-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

/* Dot base */
.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Estados */
.presence-dot.online {
  background-color: #28a745; /* verde */
}

.presence-dot.offline {
  background-color: #adb5bd; /* gris */
}

/* =========================
   BODY
========================= */

.aware-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.aware-chat-item {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.aware-chat-item:hover {
  background: #f9f9f9;
}

.aware-chat-item.unread strong,
.aware-chat-item.unread .last-message {
  font-weight: 600;
  color: #212529;
}

.last-message {
  font-size: 13px;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aware-chat-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inbox-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inbox-date {
  font-size: 11px;
  color: #6c757d;
}

.inbox-badge {
  background: var(--aware-primary);
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.no-messages {
  text-align: center;
  color: #6c757d;
  font-size: 13px;
  margin-top: 20px;
}


.aware-message {
  position: relative;
  padding: 8px 12px;
  border-radius: 12px;
  margin-bottom: 6px;
  max-width: 70%;
  word-wrap: break-word;
}

.aware-message.mine {
  background: var(--aware-primary);
  color: #fff;
  margin-left: auto;
  text-align: right;
}

.aware-message.other {
  background: #eee;
}

@media (max-width: 575px) {
  .aware-message {
    max-width: 85%;
  }
}

/* Oculto por defecto */
.message-actions {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}


/* Mostrar SOLO al hover del mensaje */
.aware-message:hover .message-actions {
  display: block;
  opacity: 1;
}

.aware-message.mine .message-actions {
  left: -26px; /* fuera del globo */
}

.aware-message.other .message-actions {
  right: -26px; /* fuera del globo */
}

.reaction-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.6;
}

.reaction-menu {
  position: absolute;
  bottom: 100%;       /* encima del mensaje */
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  z-index: 20;
}

.reaction-menu.hidden {
  display: none;
}

.reaction-menu span {
  cursor: pointer;
}

.aware-message.mine .reaction-menu {
  left: 0;
}

.aware-message.other .reaction-menu {
  right: 0;
}

.chat-image {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  margin-top: 6px;
  display: block;
  cursor: pointer;
}

.aware-message.mine .chat-image {
  margin-left: auto;
}

/* ==========================
   IMAGE MODAL
========================== */

.aware-image-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aware-image-modal.hidden {
  display: none;
}

.aware-image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.aware-image-modal-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aware-image-modal-content img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.aware-image-modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #000;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.chat-attachment {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.15);
  max-width: 260px;
}

.chat-attachment-icon {
  font-size: 28px;
}

.chat-attachment-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0; /* MUY importante en flex */
}

.chat-attachment-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}


.chat-attachment-meta {
  font-size: 11px;
  opacity: .7;
}

.chat-attachment-link {
  font-size: 12px;
  color: var(--aware-primary);
  text-decoration: underline;
}

.aware-message.mine .chat-attachment {
  background: rgba(255,255,255,.25);
}

.aware-message.mine .chat-attachment-link {
  color: #fff;
}

/* =========================
   BOTONES
========================= */

/* Botón genérico (back, new chat, etc.) */
.aware-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: inherit;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aware-btn:hover {
  opacity: 0.8;
}

/* Botón adjuntar */
.aware-attach-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aware-attach-btn:hover {
  color: var(--aware-primary);
}

/* Botón enviar */
.aware-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--aware-primary);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.aware-send-btn:hover {
  opacity: 0.9;
}

.aware-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.aware-chat-input {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}

.aware-chat-input input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  width: 70%;
}

@media (max-width: 575px) {
  .aware-chat-input input {
    font-size: 16px; /* evita zoom iOS */
  }
}

.aware-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--aware-primary);
  color: #fff;
  border: none;
  cursor: pointer;
}

.aware-attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f1f3f5;
  font-size: 12px;
}

.attachment-preview img {
  max-width: 50px;
  max-height: 50px;
  border-radius: 6px;
}

.attachment-preview .remove {
  cursor: pointer;
  color: #dc3545;
  font-weight: bold;
}
