/* Botón para abrir chat - Actualizado para modo oscuro - v2.1 */
.open-chat-btn {
  background: var(--action-btn-bg);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: var(--action-btn-text);
  border: none;
  padding: 8px 16px;
  border-radius: 17.5px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 2px 4px var(--shadow-primary);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
  min-width: 80px;
  height: 35px;
}

.open-chat-btn:hover {
  background: var(--action-btn-hover-bg);
  color: var(--action-btn-hover-text);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--shadow-secondary);
}

.open-chat-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.open-chat-btn i {
  font-size: 1rem;
}

/* Overlay y modal de chat */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.overlay.show {
  display: flex;
}

.overlay.show ~ body {
  overflow: hidden;
}

.chat-container {
  width: 100%;
  max-width: 400px;
  height: 600px;
  background: var(--bg-secondary);
  border-radius: 16px;
  box-shadow: 0 10px 25px var(--shadow-xl);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-container.maximized {
  max-width: 100%;
  width: 100%;
  height: 100vh;
  border-radius: 0;
  transform: none;
}

.overlay.show .chat-container {
  transform: translateY(0);
  opacity: 1;
}

.overlay.show .chat-container.maximized {
  transform: none;
}

/* Header del chat */
.chat-header {
  background: var(--primary-color);
  color: #1F2937;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 2px 4px var(--shadow-primary);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 4px var(--shadow-primary);
  border: 2px solid var(--bg-secondary);
}

.header-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header .header-title {
  font-weight: 700;
  color: #1F2937;
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.chat-header .header-btn {
  background: rgba(255, 255, 255, 0.6);
  color: #1F2937;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px var(--shadow-primary);
}

.chat-header .header-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
  color: #1F2937;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px var(--shadow-secondary);
}

.chat-header .header-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: #1F2937;
}

.chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-primary);
  position: relative;
}

/* Mensajes */
.message {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 15px;
  position: relative;
  animation: fadeIn 0.3s ease;
  box-shadow: 0 2px 4px var(--shadow-primary);
}

.bot {
  align-self: flex-start;
  background: var(--chat-message-other-bg);
  color: var(--chat-message-other-text);
  border-top-left-radius: 4px;
}

.user {
  align-self: flex-end;
  background: var(--chat-message-own-bg);
  color: var(--chat-message-own-text);
  border-top-right-radius: 4px;
}

.message-time {
  display: block;
  font-size: 11px;
  margin-top: 6px;
  opacity: 0.7;
  text-align: right;
  color: var(--chat-date-color);
}

.typing-indicator {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--chat-message-other-bg);
  border-radius: 18px;
  max-width: 70px;
  box-shadow: 0 2px 4px var(--shadow-primary);
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--primary-color);
  border-radius: 50%;
  margin: 0 2px;
  animation: typing 1.4s infinite ease-in-out;
}

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

/* Footer con botones en columna */
.chat-footer {
  padding: 16px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-primary);
  box-shadow: 0 -2px 6px var(--shadow-primary);
}

.quick-reply {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--primary-color);
  border-radius: 20px;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  width: 100%;
}

.quick-reply:hover:not(:disabled) {
  background: var(--primary-color);
  color: #1F2937;
  transform: translateY(-2px);
  box-shadow: 0 3px 6px var(--shadow-secondary);
}

.quick-reply:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.quick-reply i {
  font-size: 16px;
  min-width: 24px;
}

/* Animaciones */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive */
@media (max-width: 768px) {
  .chat-container {
    max-width: 90%;
    height: 85vh;
  }
  
  .open-chat-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    min-width: 70px;
    height: 32px;
  }
  
  .quick-reply {
    padding: 10px 16px;
    font-size: 13px;
  }
}
