/**
 * ============================================================================
 * BotinesDeAscenso — Centro de Mensajes y Chat en Tiempo Real (Estilos CSS)
 * ============================================================================
 */

:root {
  --chat-bg: #0b0d11;
  --chat-bg-sidebar: #0f1217;
  --chat-bg-header: #14181f;
  --chat-bg-card: #181d26;
  --chat-bg-input: #12151c;
  --chat-bubble-out: #990014;
  --chat-bubble-in: #1c222c;
  --chat-accent: #ff1744;
  --chat-accent-dark: #d5002b;
  --chat-accent-glow: rgba(255, 23, 68, 0.4);
  --chat-green: #00e676;
  --chat-blue: #29b6f6;
  --chat-border: rgba(255, 255, 255, 0.08);
  --chat-border-soft: rgba(255, 255, 255, 0.05);
  --chat-text: #f5f6f8;
  --chat-text-muted: #8e95a2;
  --chat-text-dim: #5c6473;
  --chat-radius-sm: 8px;
  --chat-radius-md: 14px;
  --chat-radius-lg: 20px;
  --chat-font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --chat-font-heading: 'Oswald', sans-serif;
}

/* ==========================================================================
   BOTÓN FLOTANTE (CLIENTE / INDEX)
   ========================================================================== */
#bda-chat-launcher {
  position: fixed;
  bottom: 160px;
  right: 28px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 12px 16px;
  background: linear-gradient(135deg, #e50932, #b3001f);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 40px;
  color: #fff;
  font-family: var(--chat-font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(229, 9, 50, 0.45), 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
#bda-chat-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 40px rgba(255, 23, 68, 0.6), 0 4px 12px rgba(0, 0, 0, 0.6);
  background: linear-gradient(135deg, #ff1744, #c90024);
}
#bda-chat-launcher:active {
  transform: scale(0.97);
}
#bda-chat-launcher .launcher-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}
#bda-chat-launcher .launcher-text {
  font-family: var(--chat-font-heading);
  font-size: 15px;
  letter-spacing: 1px;
}
.bda-unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #00e676;
  color: #000;
  font-family: var(--chat-font-sans);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 0 2px #0b0d11;
  animation: bdaBadgePulse 1.8s infinite;
}
@keyframes bdaBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ==========================================================================
   VENTANA / MODAL DEL CHAT CLIENTE
   ========================================================================== */
#bda-chat-modal {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--chat-bg);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1201;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
#bda-chat-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* HEADER DEL CHAT CLIENTE */
.bda-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(180deg, #181d26, #12161e);
  border-bottom: 1px solid var(--chat-border);
}
.bda-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bda-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e50932, #8b0015);
  color: #fff;
  font-family: var(--chat-font-heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(229, 9, 50, 0.35);
  position: relative;
}
.bda-avatar .online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--chat-green);
  border: 2px solid #14181f;
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.8);
}
.bda-avatar .online-dot.offline {
  background: #5c6473;
  box-shadow: none;
}
.bda-chat-title-group h4 {
  margin: 0;
  font-family: var(--chat-font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bda-chat-subtitle {
  font-size: 11px;
  color: var(--chat-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.bda-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bda-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--chat-radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--chat-border);
  color: var(--chat-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.bda-icon-btn:hover {
  background: rgba(255, 23, 68, 0.15);
  border-color: var(--chat-accent);
  color: #fff;
}

/* FORMULARIO DE INICIO DE CHAT */
.bda-auth-view {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  overflow-y: auto;
}
.bda-auth-header {
  text-align: center;
  margin-bottom: 24px;
}
.bda-auth-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(255, 23, 68, 0.12);
  border: 1px solid rgba(255, 23, 68, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chat-accent);
}
.bda-auth-header h3 {
  font-family: var(--chat-font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: #fff;
}
.bda-auth-header p {
  font-size: 13px;
  color: var(--chat-text-muted);
  line-height: 1.5;
}
.bda-form-group {
  margin-bottom: 16px;
}
.bda-form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--chat-text-muted);
  margin-bottom: 6px;
}
.bda-form-label span {
  color: var(--chat-accent);
}
.bda-form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--chat-bg-input);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-sm);
  color: var(--chat-text);
  font-family: var(--chat-font-sans);
  font-size: 13px;
  transition: all 0.2s;
  box-sizing: border-box;
}
.bda-form-input:focus {
  outline: none;
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 3px rgba(255, 23, 68, 0.2);
}
.bda-auth-btn {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--chat-accent), var(--chat-accent-dark));
  border: none;
  border-radius: var(--chat-radius-sm);
  color: #fff;
  font-family: var(--chat-font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 6px 20px rgba(255, 23, 68, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.bda-auth-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 8px 26px rgba(255, 23, 68, 0.6);
}
.bda-auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   ÁREA DE MENSAJES / CONVERSACIÓN
   ========================================================================== */
.bda-chat-body {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 23, 68, 0.03), transparent 40%),
    #0d0f14;
  position: relative;
}
.bda-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}
.bda-date-pill {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  border: 1px solid var(--chat-border-soft);
  color: var(--chat-text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 12px;
}

/* BURBUJAS DE MENSAJE */
.bda-message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  position: relative;
  animation: bdaMsgFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes bdaMsgFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.bda-message.outgoing {
  align-self: flex-end;
}
.bda-message.incoming {
  align-self: flex-start;
}
.bda-bubble {
  padding: 10px 14px 8px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  position: relative;
}
.bda-message.outgoing .bda-bubble {
  background: linear-gradient(135deg, #b8001a, #8f0012);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bda-message.incoming .bda-bubble {
  background: #181d26;
  border: 1px solid var(--chat-border);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}
.bda-msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}
.bda-message.incoming .bda-msg-meta {
  color: var(--chat-text-dim);
}
.bda-check-icon {
  display: inline-flex;
}
.bda-check-icon.read {
  color: var(--chat-blue);
}

/* MENSAJES DE SISTEMA */
.bda-message.system-msg {
  align-self: center;
  max-width: 90%;
  margin: 8px 0;
}
.bda-message.system-msg .bda-bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--chat-border);
  color: var(--chat-text-muted);
  font-size: 12px;
  text-align: center;
  border-radius: 12px;
  padding: 6px 14px;
  box-shadow: none;
}
.bda-message.system-msg .bda-msg-meta {
  display: none;
}

/* BANNER CHAT FINALIZADO (CLIENTE) */
.bda-chat-ended-banner {
  padding: 16px 20px;
  background: linear-gradient(180deg, #181d26, #12151c);
  border-top: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: bdaMsgFade 0.3s ease;
}
.bda-chat-ended-text strong {
  display: block;
  font-family: var(--chat-font-heading);
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.bda-chat-ended-text span {
  font-size: 12px;
  color: var(--chat-text-muted);
}
.bda-restart-chat-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--chat-accent), var(--chat-accent-dark));
  border: none;
  border-radius: var(--chat-radius-sm);
  color: #fff;
  font-family: var(--chat-font-heading);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 23, 68, 0.4);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bda-restart-chat-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(255, 23, 68, 0.6);
}

/* BOTÓN ELIMINAR CHAT (ADMIN) */
.btn-delete-chat {
  background: transparent;
  border: 1px solid rgba(255, 23, 68, 0.35);
  color: #ff6b7a;
  font-size: 11px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: var(--chat-radius-sm);
  font-family: var(--chat-font-sans);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-delete-chat:hover {
  background: rgba(255, 23, 68, 0.15);
  border-color: #ff1744;
  color: #fff;
}

/* ADJUNTOS EN BURBUJA */
.bda-msg-img {
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 4px;
  cursor: pointer;
  max-width: 260px;
}
.bda-msg-img img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.2s;
}
.bda-msg-img img:hover {
  transform: scale(1.02);
}

/* REPRODUCTOR DE AUDIO */
.bda-audio-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  min-width: 190px;
}
.bda-audio-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.bda-audio-btn:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.3);
}
.bda-audio-wave {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}
.bda-audio-progress {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}
.bda-audio-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* TYPING INDICATOR */
.bda-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(24, 29, 38, 0.8);
  border: 1px solid var(--chat-border-soft);
  border-radius: 14px;
  font-size: 11px;
  color: var(--chat-text-muted);
  width: fit-content;
  align-self: flex-start;
  margin-top: 4px;
}
.bda-typing-dots {
  display: flex;
  gap: 3px;
}
.bda-typing-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--chat-accent);
  animation: bdaTypingDot 1.4s infinite ease-in-out;
}
.bda-typing-dots span:nth-child(1) { animation-delay: 0s; }
.bda-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.bda-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bdaTypingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ==========================================================================
   FOOTER DEL CHAT / INPUT Y GRABACIÓN
   ========================================================================== */
.bda-chat-footer {
  padding: 12px 14px;
  background: #14181f;
  border-top: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.bda-chat-input {
  flex: 1;
  background: #0d0f14;
  border: 1px solid var(--chat-border);
  border-radius: 20px;
  padding: 10px 16px;
  color: #fff;
  font-family: var(--chat-font-sans);
  font-size: 13px;
  resize: none;
  max-height: 90px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.bda-chat-input:focus {
  border-color: var(--chat-accent);
}
.bda-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-accent), var(--chat-accent-dark));
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255, 23, 68, 0.4);
}
.bda-send-btn:hover {
  transform: scale(1.06);
  filter: brightness(1.1);
}
.bda-send-btn:active {
  transform: scale(0.95);
}

/* BARRA DE GRABACIÓN DE AUDIO */
.bda-record-bar {
  position: absolute;
  inset: 0;
  background: #181d26;
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
}
.bda-record-bar.active {
  display: flex;
}
.bda-record-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ff1744;
  font-size: 13px;
  font-weight: 600;
}
.bda-record-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff1744;
  animation: bdaPulseRed 1s infinite;
}
@keyframes bdaPulseRed {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}
.bda-record-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bda-record-cancel {
  background: transparent;
  border: none;
  color: var(--chat-text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 6px 10px;
}
.bda-record-cancel:hover {
  color: #ff1744;
}

/* ==========================================================================
   PANEL ADMINISTRATIVO: CENTRO DE MENSAJES (admin.php)
   ========================================================================== */
#admin-chat-container {
  display: flex;
  height: calc(100vh - 200px);
  min-height: 580px;
  background: var(--chat-bg-sidebar);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* SIDEBAR IZQUIERDO ADMIN */
.chat-admin-sidebar {
  width: 360px;
  border-right: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  background: var(--chat-bg-sidebar);
  flex-shrink: 0;
}
.chat-admin-search-box {
  padding: 16px;
  border-bottom: 1px solid var(--chat-border-soft);
}
.chat-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.chat-search-wrap svg {
  position: absolute;
  left: 12px;
  color: var(--chat-text-dim);
}
.chat-search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--chat-bg-input);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  color: #fff;
  font-size: 12px;
  outline: none;
  transition: all 0.2s;
}
.chat-search-input:focus {
  border-color: var(--chat-accent);
}

/* FILTROS PILLS */
.chat-filters {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
  overflow-x: auto;
}
.chat-filter-btn {
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--chat-border-soft);
  color: var(--chat-text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.chat-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.chat-filter-btn.active {
  background: var(--chat-accent);
  border-color: var(--chat-accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(255, 23, 68, 0.35);
}

/* LISTA DE CHATS */
.chat-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--chat-border-soft);
  cursor: pointer;
  transition: background 0.18s;
  position: relative;
}
.chat-item:hover {
  background: rgba(255, 255, 255, 0.03);
}
.chat-item.active {
  background: rgba(255, 23, 68, 0.08);
  border-left: 3px solid var(--chat-accent);
}
.chat-item-content {
  flex: 1;
  min-width: 0;
}
.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.chat-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-time {
  font-size: 11px;
  color: var(--chat-text-dim);
  flex-shrink: 0;
}
.chat-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-item-msg {
  font-size: 12px;
  color: var(--chat-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-badge {
  background: var(--chat-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--chat-accent-glow);
}

/* ÁREA PRINCIPAL CONVERSACIÓN ADMIN */
.chat-admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  min-width: 0;
}
.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--chat-text-dim);
  gap: 12px;
  padding: 40px;
  text-align: center;
}
.chat-empty-state svg {
  opacity: 0.3;
}
/* La vista de conversación y el estado vacío nunca deben mostrarse juntos:
   el toggle se maneja con esta única clase en .chat-admin-main, no con
   estilos inline sueltos (evita que ambas queden visibles a la vez). */
#admin-conversation-view {
  display: none;
}
.chat-admin-main.has-conversation #admin-chat-empty {
  display: none;
}
.chat-admin-main.has-conversation #admin-conversation-view {
  display: flex;
}

/* HEADER ADMIN CHAT */
.chat-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--chat-bg-header);
  border-bottom: 1px solid var(--chat-border);
}
.chat-main-header-client {
  display: flex;
  align-items: center;
  gap: 14px;
}
.chat-client-details {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--chat-text-muted);
  margin-top: 3px;
}
.chat-client-details strong {
  color: #fff;
}
.chat-back-mobile {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  margin-right: 8px;
}

/* LIGHTBOX DE IMAGEN */
#bda-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#bda-lightbox.active {
  display: flex;
}
#bda-lightbox img {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}
.bda-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   RESPONSIVE (TABLET & MOBILE)
   ========================================================================== */
@media (max-width: 768px) {
  #bda-chat-launcher {
    bottom: 155px;
    right: 20px;
    padding: 10px 16px;
  }
  #bda-chat-modal {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    border: none;
  }
  #admin-chat-container {
    height: calc(100vh - 120px);
    border-radius: 12px;
  }
  .chat-admin-sidebar {
    width: 100%;
  }
  .chat-admin-main {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 20;
  }
  #admin-chat-container.mobile-conversation-open .chat-admin-sidebar {
    display: none;
  }
  #admin-chat-container.mobile-conversation-open .chat-admin-main {
    display: flex;
  }
  .chat-back-mobile {
    display: flex;
  }
}

/* ==========================================================================
   BOT / ASISTENTE VIRTUAL — ESTILOS
   ========================================================================== */

/* Burbuja del bot */
.bda-bubble-bot {
  background: linear-gradient(135deg, #1a2332, #151d28) !important;
  border: 1px solid rgba(0, 200, 255, 0.15) !important;
  border-bottom-left-radius: 4px !important;
  border-bottom-right-radius: 16px !important;
  position: relative;
  overflow: visible;
}
.bda-bubble-bot::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 200, 255, 0.4), transparent);
  border-radius: 16px 16px 0 0;
}

/* Sender label del bot */
.bda-bot-sender {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 200, 255, 0.1);
}
.bda-bot-icon {
  font-size: 16px;
  line-height: 1;
}
.bda-bot-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(0, 200, 255, 0.8);
}

/* Mensaje del bot - alineación */
.bda-message.bot-msg {
  align-self: flex-start;
  max-width: 85%;
}

/* Imagen adjunta a una respuesta del bot */
.bda-bot-imagen-link {
  display: block;
  margin-top: 8px;
}
.bda-bot-imagen {
  display: block;
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid rgba(0, 200, 255, 0.2);
  object-fit: cover;
}

/* Link adjunto a una respuesta del bot */
.bda-bot-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 7px 12px;
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid rgba(0, 200, 255, 0.3);
  border-radius: 10px;
  color: rgba(0, 200, 255, 0.95);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  word-break: break-word;
  transition: all 0.2s ease;
}
.bda-bot-link:hover {
  background: rgba(0, 200, 255, 0.18);
  border-color: rgba(0, 200, 255, 0.5);
  color: #fff;
}

/* Botones rápidos del bot */
.bda-bot-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 200, 255, 0.08);
}

.bda-bot-quick-btn {
  padding: 7px 14px;
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid rgba(0, 200, 255, 0.25);
  border-radius: 20px;
  color: rgba(0, 200, 255, 0.9);
  font-family: var(--chat-font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.3;
}
.bda-bot-quick-btn:hover {
  background: rgba(0, 200, 255, 0.18);
  border-color: rgba(0, 200, 255, 0.5);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 200, 255, 0.2);
}
.bda-bot-quick-btn:active {
  transform: scale(0.96);
}
.bda-bot-quick-btn.used {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* Badge de estado del bot en header */
.bda-bot-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(0, 200, 255, 0.1);
  border: 1px solid rgba(0, 200, 255, 0.25);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(0, 200, 255, 0.9);
  letter-spacing: 0.3px;
}

.bda-operator-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.25);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(0, 230, 118, 0.9);
  letter-spacing: 0.3px;
}

/* Indicador de typing del bot */
.bda-typing-indicator.bot-typing {
  background: rgba(0, 200, 255, 0.06);
  border-color: rgba(0, 200, 255, 0.15);
}
.bda-typing-indicator.bot-typing .bda-typing-dots span {
  background: rgba(0, 200, 255, 0.8);
}

/* Controles del bot en panel admin */
.chat-bot-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.chat-bot-controls .btn-bot {
  padding: 6px 12px;
  border-radius: var(--chat-radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-bot-take {
  background: rgba(0, 230, 118, 0.1);
  border-color: rgba(0, 230, 118, 0.3);
  color: var(--chat-green);
}
.btn-bot-take:hover {
  background: rgba(0, 230, 118, 0.2);
  border-color: var(--chat-green);
}
.btn-bot-return {
  background: rgba(0, 200, 255, 0.1);
  border-color: rgba(0, 200, 255, 0.3);
  color: #00c8ff;
}
.btn-bot-return:hover {
  background: rgba(0, 200, 255, 0.2);
  border-color: #00c8ff;
}

/* Toggle switch para el bot */
.admin-toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #2a3142;
  border-radius: 10px;
  transition: .3s;
  cursor: pointer;
}
.admin-toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .3s;
}
#admin-bot-toggle:checked + .admin-toggle-slider {
  background: rgba(0, 230, 118, 0.4);
}
#admin-bot-toggle:checked + .admin-toggle-slider::before {
  transform: translateX(16px);
  background: var(--chat-green);
}
