/* ═══════════════════════════════════════════════════════════
   MESSAGES — Chat / Messaging System
   ═══════════════════════════════════════════════════════════ */

/* ── Panel Container ── */
.mensajes-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.mensajes-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Conversation List (Left Panel) ── */
.mensajes-list-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e7eb;
  background: #fff;
  min-height: 0;
}

.mensajes-list-header {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.mensajes-list-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.mensajes-list-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
}

.mensajes-search-wrap {
  position: relative;
}

.mensajes-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  font-size: 0.8125rem;
  background: #f9fafb;
  outline: none;
  transition: all 0.2s;
}

.mensajes-search-input:focus {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.mensajes-search-icon {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  width: 1rem;
  height: 1rem;
}

/* ── Conversation Cards ── */
.mensajes-conv-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.mensajes-conv-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px solid #f3f4f6;
  position: relative;
}

.mensajes-conv-card:hover {
  background: #f0f4ff;
}

.mensajes-conv-card--active {
  background: #eef2ff;
  border-left: 3px solid #6366f1;
}

/* ── Archive: 3-dot menu ── */
.mensajes-conv-menu-btn {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #b0b8c4;
  transition: all 0.15s;
  z-index: 2;
}
.mensajes-conv-menu-btn:hover,
.mensajes-conv-menu-btn:active {
  background: #e2e8f0;
  color: #475569;
}

/* Dropdown */
.mensajes-conv-dropdown {
  position: absolute;
  right: 0.5rem;
  top: 2.25rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 10;
  min-width: 150px;
  overflow: hidden;
  animation: msgDropIn 0.12s ease;
}
@keyframes msgDropIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.mensajes-conv-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: #334155;
  transition: background 0.1s;
}
.mensajes-conv-dropdown-item:hover {
  background: #f1f5f9;
}
.mensajes-conv-dropdown-item--danger {
  color: #dc2626;
}
.mensajes-conv-dropdown-item--danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

/* Archived section header */
.mensajes-archived-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6366f1;
}
.mensajes-archived-header:hover {
  background: #eef2ff;
}
.mensajes-archived-count {
  background: #6366f1;
  color: #fff;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-weight: 700;
}

.mensajes-conv-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.mensajes-conv-avatar-text {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.mensajes-conv-info {
  flex: 1;
  min-width: 0;
}

.mensajes-conv-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mensajes-conv-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mensajes-conv-time {
  font-size: 0.6875rem;
  color: #9ca3af;
  flex-shrink: 0;
  font-weight: 500;
}

.mensajes-conv-preview {
  font-size: 0.8125rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.125rem;
  line-height: 1.4;
}

.mensajes-conv-unread {
  position: absolute;
  right: 1rem;
  bottom: 0.875rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* ── Chat Area (Right Panel) ── */
.mensajes-chat-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #fafbfc;
}

.mensajes-chat-panel--active {
  display: flex;
}

/* Chat Header */
.mensajes-chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Chat header options (3-dot menu) */
.mensajes-chat-options-wrap {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
}

.mensajes-chat-options-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.mensajes-chat-options-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.mensajes-chat-options-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.mensajes-chat-dropdown {
  position: absolute;
  right: 0;
  top: 2.25rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 20;
  min-width: 200px;
  overflow: hidden;
  animation: msgDropIn 0.12s ease;
}

.mensajes-chat-dropdown.hidden {
  display: none;
}

.mensajes-chat-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  transition: background 0.1s;
}

.mensajes-chat-dropdown-item:hover {
  background: #f1f5f9;
}

.mensajes-chat-dropdown-item--danger {
  color: #dc2626;
}

.mensajes-chat-dropdown-item--danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.mensajes-chat-dropdown-item svg {
  flex-shrink: 0;
}

.mensajes-chat-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.mensajes-chat-back:hover {
  background: #f3f4f6;
  color: #374151;
}

.mensajes-chat-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.mensajes-chat-avatar-text {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.mensajes-chat-header-info {
  flex: 1;
  min-width: 0;
}

.mensajes-chat-header-name {
  font-weight: 700;
  font-size: 0.9375rem;
  color: #1e293b;
  line-height: 1.2;
}

.mensajes-chat-header-status {
  font-size: 0.6875rem;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 500;
}

.mensajes-chat-header-status::before {
  content: '';
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  transition: background 0.3s;
}

/* Offline: yellow dot + "Última vez a las..." */
.mensajes-chat-header-status--offline {
  color: #d97706;
}

.mensajes-chat-header-status--offline::before {
  background: #f59e0b;
}

/* Chat Messages Area */
.mensajes-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}

/* Date separator */
.mensajes-date-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0;
}

.mensajes-date-sep span {
  background: #e5e7eb;
  color: #6b7280;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Message Bubbles */
.mensajes-msg-row {
  display: flex;
  max-width: 80%;
  animation: msgSlideIn 0.25s ease-out;
}

.mensajes-msg-row--sent {
  align-self: flex-end;
}

.mensajes-msg-row--received {
  align-self: flex-start;
}

.mensajes-bubble {
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

.mensajes-bubble--sent {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border-radius: 1.125rem 1.125rem 0.25rem 1.125rem;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.mensajes-bubble--received {
  background: #fff;
  color: #374151;
  border-radius: 1.125rem 1.125rem 1.125rem 0.25rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.mensajes-bubble-time {
  font-size: 0.625rem;
  margin-top: 0.25rem;
  display: block;
  text-align: right;
}

.mensajes-bubble--sent .mensajes-bubble-time {
  color: rgba(255, 255, 255, 0.7);
}

.mensajes-bubble--received .mensajes-bubble-time {
  color: #9ca3af;
}

/* Images inside chat bubbles */
.mensajes-bubble-img {
  max-width: 220px;
  max-height: 300px;
  border-radius: 0.5rem;
  cursor: pointer;
  display: block;
  margin-bottom: 0.25rem;
  object-fit: cover;
  transition: opacity 0.2s;
}

.mensajes-bubble-img:hover {
  opacity: 0.85;
}

/* Typing indicator — hidden by default, shown via JS */
.mensajes-typing {
  display: none;
  align-items: center;
  gap: 0.375rem;
  padding: 0.75rem 1rem;
  align-self: flex-start;
}

.mensajes-typing--visible {
  display: flex;
}

.mensajes-typing-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: #9ca3af;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.mensajes-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.mensajes-typing-dot:nth-child(3) { animation-delay: 0.4s; }

.mensajes-typing-text {
  font-size: 0.75rem;
  color: #9ca3af;
  font-style: italic;
}

/* Chat Input Bar */
.mensajes-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.mensajes-input-field {
  flex: 1;
  min-height: 2.5rem;
  max-height: 6rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid #e5e7eb;
  border-radius: 1.25rem;
  font-size: 0.875rem;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s;
  font-family: inherit;
  background: #f9fafb;
}

.mensajes-input-field:focus {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.mensajes-send-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.mensajes-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.mensajes-send-btn:active {
  transform: scale(0.95);
}

.mensajes-send-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* Photo attach button */
.mensajes-photo-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.mensajes-photo-btn:hover {
  background: #e5e7eb;
  color: #374151;
  border-color: #d1d5db;
}

.mensajes-photo-btn:active {
  transform: scale(0.95);
}

.mensajes-photo-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* Photo Preview Bar — hidden by default, shown via JS */
.mensajes-photo-preview {
  display: none;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #f0f4ff, #e8ecf7);
  border-top: 1px solid #c7d2fe;
  flex-shrink: 0;
  animation: msgSlideIn 0.2s ease-out;
}

.mensajes-photo-preview--visible {
  display: flex;
}

/* Thumbnail list — horizontal scroll */
.mensajes-photo-preview-list {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  overflow-x: auto;
  min-width: 0;
  padding: 0.125rem 0;
}

/* Each thumbnail wrapper — relative for the X button */
.mensajes-photo-thumb-wrap {
  position: relative;
  flex-shrink: 0;
}

.mensajes-photo-preview-thumb {
  width: 44px;
  height: 44px;
  border-radius: 0.5rem;
  object-fit: cover;
  border: 2px solid #6366f1;
  display: block;
}

/* Small X button on top-right corner of thumbnail */
.mensajes-photo-thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: 2px solid #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  transition: all 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.mensajes-photo-thumb-remove:hover {
  background: #dc2626;
  transform: scale(1.15);
}

.mensajes-photo-preview-send {
  padding: 0.375rem 0.875rem;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.mensajes-photo-preview-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

/* Photo uploading placeholder — spinner overlay */
.mensajes-photo-uploading {
  position: relative;
  display: inline-block;
}

.mensajes-photo-uploading .mensajes-bubble-img {
  opacity: 0.6;
}

.mensajes-photo-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: msgSpinPhoto 0.7s linear infinite;
}

@keyframes msgSpinPhoto {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── Lightbox Modal — Fullscreen image viewer ── */
.mensajes-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mensajes-lightbox--visible {
  opacity: 1;
}

.mensajes-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.mensajes-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.mensajes-lightbox-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
}

.mensajes-lightbox-wrap:active {
  cursor: grabbing;
}

.mensajes-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 0.5rem;
  transition: transform 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

/* Empty State */
.mensajes-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #9ca3af;
  text-align: center;
}

.mensajes-empty-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.mensajes-empty-title {
  font-weight: 700;
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.mensajes-empty-text {
  font-size: 0.8125rem;
}

/* ── Sidebar badge ── */
.sidebar-msg-badge {
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.3rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #ef4444, #f43f5e);
  color: #fff;
  font-size: 0.5625rem;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

.sidebar-msg-badge--visible {
  display: flex;
}

/* ── Animations ── */
@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ── Responsive ── */
@media (min-width: 768px) {
  .mensajes-list-panel {
    width: 320px;
    flex-shrink: 0;
  }

  .mensajes-chat-panel {
    display: flex;
  }

  .mensajes-chat-back {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .mensajes-list-panel--hidden {
    display: none;
  }

  .mensajes-chat-panel {
    display: none;
  }

  .mensajes-chat-panel--mobile-active {
    display: flex;
    width: 100%;
  }

  .mensajes-chat-back {
    display: flex;
  }

  .mensajes-msg-row {
    max-width: 85%;
  }
}

/* ═══════════════════════════════════════════════════════════
 *  VOICE MESSAGES
 * ═══════════════════════════════════════════════════════════ */

/* Mic button */
.mensajes-mic-btn {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.mensajes-mic-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(99,102,241,0.4);
}

/* Recording bar */
.mensajes-recording-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #fef2f2, #fff1f2);
  border-top: 1px solid #fecaca;
  animation: recBarIn 0.2s ease;
}
@keyframes recBarIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mensajes-rec-cancel {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: #fee2e2;
  color: #ef4444;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.mensajes-rec-cancel:hover { background: #fecaca; }

.mensajes-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: recPulse 1s ease infinite;
}
@keyframes recPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.8); }
}

.mensajes-rec-timer {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ef4444;
  min-width: 2.5rem;
  font-variant-numeric: tabular-nums;
}

/* Animated wave */
.mensajes-rec-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}
.mensajes-rec-wave span {
  width: 3px;
  height: 16px;
  background: #ef4444;
  border-radius: 2px;
  animation: recWave 0.6s ease-in-out infinite;
}
.mensajes-rec-wave span:nth-child(1) { animation-delay: 0s; }
.mensajes-rec-wave span:nth-child(2) { animation-delay: 0.1s; }
.mensajes-rec-wave span:nth-child(3) { animation-delay: 0.2s; }
.mensajes-rec-wave span:nth-child(4) { animation-delay: 0.3s; }
.mensajes-rec-wave span:nth-child(5) { animation-delay: 0.4s; }
@keyframes recWave {
  0%, 100% { height: 6px; opacity: 0.5; }
  50%      { height: 20px; opacity: 1; }
}

.mensajes-rec-stop {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.mensajes-rec-stop:hover { transform: scale(1.1); }

/* ── Audio Player in Bubbles ── */

/* Audio uploading — optimistic UI spinner */
.mensajes-audio-uploading {
  position: relative;
}

.mensajes-audio-uploading .mensajes-audio-spinner {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: msgSpinPhoto 0.7s linear infinite;
  z-index: 2;
}

.mensajes-audio-player {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  min-width: 180px;
}

.mensajes-audio-play {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.mensajes-bubble--received .mensajes-audio-play {
  background: rgba(99,102,241,0.12);
  color: #6366f1;
}
.mensajes-audio-play:hover { background: rgba(255,255,255,0.4); }
.mensajes-bubble--received .mensajes-audio-play:hover { background: rgba(99,102,241,0.2); }

.mensajes-audio-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.mensajes-bubble--received .mensajes-audio-track {
  background: #e2e8f0;
}

.mensajes-audio-progress {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}
.mensajes-bubble--received .mensajes-audio-progress {
  background: #6366f1;
}

.mensajes-audio-dur {
  font-size: 0.7rem;
  opacity: 0.8;
  min-width: 2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
