/* ================= RESET ================= */
* {
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
  background: #f0f2f5;
}

/* ================= LAYOUT ================= */
.layout {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* ================= SIDEBAR ================= */
.sidebar {
  width: 260px;
  border-right: 1px solid #ddd;
  padding: 12px;
  overflow-y: auto;
  background: #ffffff;
}

.sidebar h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 600;
}

/* ================= CONVERSACIONES ================= */
.conversation {
  background: #ffffff;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid #eee;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.conversation:hover {
  background: #f7f9fb;
}

.conversation.active {
  border-left: 4px solid #25d366;
  background: #eefaf3;
}

/* Teléfono */
.conversation-header {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Preview mensaje */
.conversation .preview {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge no leídos */
.unread-badge {
  background: #25d366;
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
}

/* Mute */
.conversation.muted {
  opacity: 0.55;
}

.mute-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

/* ================= CHAT ================= */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
}

/* ================= HEADER CHAT ================= */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
  background: #ffffff;
}

.chat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-phone {
  font-weight: 600;
  font-size: 15px;
}

/* ================= BOTONES HEADER ================= */
.chat-actions button {
  margin-left: 6px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
}

.chat-actions button:hover {
  background: #f1f1f1;
}

/* ================= MENSAJES ================= */
.messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

/* ================= BURBUJAS ================= */
.bubble {
  max-width: 70%;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.bubble.in {
  background: #ffffff;
  align-self: flex-start;
}

.bubble.out {
  background: #dcf8c6;
  align-self: flex-end;
}

.bubble-time {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}

/* ================= INPUT ================= */
.input-bar {
  display: flex;
  padding: 10px;
  border-top: 1px solid #ddd;
  background: #ffffff;
}

.input-bar input {
  flex: 1;
  padding: 10px;
  font-size: 14px;
}

.input-bar button {
  margin-left: 8px;
  padding: 10px 16px;
  cursor: pointer;
}

/* ================= MODO BOT / HUMANO ================= */
.mode-indicator {
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  display: inline-block;
}

.mode-bot {
  background: #e8f1ff;
  color: #0b5ed7;
  border: 1px solid #b6d4fe;
}

.mode-human {
  background: #e6f8ee;
  color: #146c43;
  border: 1px solid #badbcc;
}

/* ================= PANEL DERECHO ================= */
.activity-panel {
  width: 320px;
  border-left: 1px solid #ddd;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.activity-header {
  padding: 12px;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid #eee;
}

.activity-list {
  padding: 10px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  padding: 8px 6px;
  font-size: 13px;
  border-bottom: 1px solid #f1f1f1;
}

/* Punto estado */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}

.dot.green { background: #25d366; }
.dot.blue  { background: #0d6efd; }
.dot.gray  { background: #6c757d; }

/* ================= DETALLES ================= */
#typing-indicator {
  font-size: 12px;
  opacity: 0.6;
  font-style: italic;
}

/* ================= TOOLS ================= */
.chat-tools {
  display: inline-flex;
  gap: 6px;
  margin-left: 12px;
}

.tool-btn {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #dcdcdc;
  background: #ffffff;
  cursor: pointer;
}

.tool-btn:hover {
  background: #f1f3f5;
}

.logout-btn {
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  font-weight: 600;
}
