
:root {
  --chat-primary: #4a5259;
  --chat-primary-dark: #3d444a;
  --chat-primary-darker: #2d3238;
  --chat-primary-light: #6b7280;
  --chat-primary-lighter: #9ca3af;
  --chat-accent: #656f77;
  --chat-bg-light: #f5f5f7;
}

.user-chat-full-container {
  display: flex;
  height: calc(100vh - 160px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(74, 82, 89, 0.1);
  overflow: hidden;
}

.user-chat-conversations-panel {
  width: 350px;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  background: white;
}

.user-chat-conversations-header {
  padding: 39px;
  background: #4a5259;
  color: white;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-chat-conversations-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.01em;
}

.user-chat-conversations-list {
  flex: 1;
  overflow-y: auto;
}

.user-chat-conversation-item {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f3f4f6;
}

.user-chat-conversation-item:hover {
  background: #f9fafb;
}

.user-chat-conversation-item.active {
  background: var(--chat-bg-light);
  border-left: 3px solid var(--chat-primary);
}

.user-chat-conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(74, 82, 89, 0.08);
  color: #4a5259;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}

.user-chat-conv-info {
  flex: 1;
  min-width: 0;
  position: relative;
}

.user-chat-conv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.user-chat-conv-name {
  font-weight: 500;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: #1e1e1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chat-conv-time {
  font-size: 12px;
  color: #9ca3af;
  flex-shrink: 0;
  margin-left: 8px;
}

.user-chat-conv-preview {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.user-chat-conv-unread {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--chat-primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}

.user-chat-messages-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f8f9fa;
}

.user-chat-header {
  background: #1e1e1e;
  color: white;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.01em;
}

.user-chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  opacity: 0.9;
  margin-top: 4px;
}

.user-chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2s infinite;
}

.user-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-chat-message {
  display: flex;
  gap: 10px;
  animation: messageSlideIn 0.3s ease-out;
}

.user-chat-message.sent {
  flex-direction: row-reverse;
}

.user-chat-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(74, 82, 89, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a5259;
  font-weight: 500;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}

.user-chat-message.sent .user-chat-message-avatar {
  background: rgba(74, 82, 89, 0.08);
}

.user-chat-message.received .user-chat-message-avatar {
  background: rgba(74, 82, 89, 0.08);
}

.user-chat-message-content {
  max-width: 60%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-chat-message-sender {
  font-size: 11px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: #6b7280;
  padding: 0 4px;
}

.user-chat-sender-type {
  font-weight: 400;
  color: #9ca3af;
  font-size: 11px;
}

.user-chat-message.sent .user-chat-message-sender {
  text-align: right;
  color: var(--chat-primary);
}

.user-chat-message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  max-width: 100%;
}

.user-chat-message.sent .user-chat-message-bubble {
  background: #1e1e1e;
  color: white;
  border-bottom-right-radius: 4px;
}

.user-chat-message.received .user-chat-message-bubble {
  background: white;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-chat-message-time {
  font-size: 11px;
  color: #999;
  padding: 0 4px;
}

.user-chat-message.sent .user-chat-message-time {
  text-align: right;
}

.user-chat-input-area {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: all 0.2s ease;
}

.user-chat-input:focus {
  border-color: #4a5259;
  box-shadow: none;
}

.user-chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1e1e1e;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.user-chat-send-btn:hover {
  background: #2d2d2d;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.user-chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Ocultar botón volver en desktop */
.user-chat-header .chat-back-btn {
  display: none;
}

.show-mobile-only {
  display: none;
}

.user-chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(74, 82, 89, 0.1);
  border-radius: 16px;
  font-size: 13px;
  color: var(--chat-primary);
  align-self: flex-start;
  animation: fadeIn 0.3s ease-out;
}

.user-chat-typing-dots {
  display: flex;
  gap: 4px;
}

.user-chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chat-primary);
  animation: typingBounce 1.4s infinite;
}

.user-chat-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.user-chat-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

.user-chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  gap: 12px;
  padding: 40px;
  text-align: center;
}

.user-chat-empty i {
  opacity: 0.5;
}

.user-chat-empty p {
  margin: 0;
  font-size: 15px;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ── Chat Milestone: Consulta Resuelta ── */
.chat-milestone-resolved {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  width: 100%;
  box-sizing: border-box;
}

.chat-milestone-line {
  flex: 1;
  height: 1px;
  background: #22c55e;
  opacity: 0.4;
}

.chat-milestone-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* Disabled state for user chat input */
.user-chat-input:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.user-chat-attach-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.chat-close-conversation-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-close-conversation-btn:hover {
  background: rgba(220, 38, 38, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  transform: translateY(-1px);
}

.chat-close-conversation-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}

.chat-close-conversation-btn i {
  transition: transform 0.3s ease;
}

.chat-close-conversation-btn:hover i {
  transform: rotate(90deg);
}

.user-chat-conversations-list::-webkit-scrollbar,
.user-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.user-chat-conversations-list::-webkit-scrollbar-track,
.user-chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.user-chat-conversations-list::-webkit-scrollbar-thumb,
.user-chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.user-chat-conversations-list::-webkit-scrollbar-thumb:hover,
.user-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

@media (max-width: 768px) {
  .user-chat-full-container {
    flex-direction: column;
  }
  
  .user-chat-conversations-panel {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }
  
  .user-chat-message-content {
    max-width: 80%;
  }
}


.user-chat-attach-btn {
  background: #f3f4f6;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  margin-right: 8px;
}

.user-chat-attach-btn:hover {
  background: #e5e7eb;
  color: var(--chat-primary);
  transform: scale(1.05);
}

.user-chat-attach-btn:active {
  transform: scale(0.95);
}

.chat-file-attachment {
  margin-top: 8px;
  margin-bottom: 4px;
}

.chat-image-preview {
  max-width: 300px;
  max-height: 400px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-image-preview:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.chat-file-attachment.pdf {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  max-width: 350px;
  transition: all 0.2s ease;
}

.chat-file-attachment.pdf:hover {
  border-color: var(--chat-primary);
  box-shadow: 0 2px 8px rgba(74, 82, 89, 0.15);
}

.chat-pdf-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.chat-pdf-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.chat-pdf-type {
  font-size: 12px;
  color: #6b7280;
}

.chat-pdf-download {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.chat-pdf-download:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(74, 82, 89, 0.35);
}

.chat-pdf-download:active {
  transform: scale(0.95);
}

.user-chat-message.sent .chat-image-preview {
  border: 2px solid rgba(74, 82, 89, 0.25);
}

.user-chat-message.received .chat-image-preview {
  border: 2px solid rgba(107, 114, 128, 0.2);
}

/* Forzar Inter en todos los elementos de mensajes */
.user-chat-full-container,
.user-chat-full-container *,
.user-chat-conversations-panel,
.user-chat-conversations-panel *,
.user-chat-messages-panel,
.user-chat-messages-panel *,
.user-chat-conversation-item,
.user-chat-conv-name,
.user-chat-conv-preview,
.user-chat-conv-time,
.user-chat-message,
.user-chat-message-sender,
.user-chat-message-bubble,
.user-chat-message-time,
.user-chat-input,
.user-chat-header h3,
.user-chat-status span,
.user-chat-empty p,
.chat-pdf-name,
.chat-pdf-type,
.user-chat-typing span,
.user-chat-no-messages p {
  font-family: 'Inter', sans-serif !important;
}
