/**
 * Chat Cliente - Drawer lateral estilo WhatsApp
 * 
 * Diseño: Drawer de pantalla completa que se abre desde el footer
 * Similar al carrito del tema
 */

/* Overlay oscuro */
.mcchat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s;
}

.mcchat-overlay.active {
  opacity: 1;
}

/* Drawer lateral */
.mcchat-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 450px;
  height: 100%;
  background: #f5f5f5;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.mcchat-drawer.active {
  right: 0;
}

/* Header del drawer */
.mcchat-drawer-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  min-height: 60px;
}

.mcchat-drawer-back {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  flex-shrink: 0;
}

.mcchat-drawer-back:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mcchat-drawer-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.mcchat-drawer-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mcchat-drawer-header-avatar svg {
  width: 24px;
  height: 24px;
}

.mcchat-drawer-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.mcchat-drawer-status {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Área de mensajes */
.mcchat-drawer-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  background: #e5ddd5;
  background-image: 
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(0,0,0,0.03) 10px,
      rgba(0,0,0,0.03) 20px
    );
}

/* Mensaje de bienvenida */
.mcchat-welcome {
  background: #fff8dc;
  padding: 12px 16px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mcchat-welcome p {
  margin: 4px 0;
  color: #333;
  font-size: 0.9rem;
}

/* Burbujas de mensajes */
.mcchat-message {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  max-width: 80%;
  animation: slideIn 0.2s;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mcchat-message--customer {
  align-self: flex-end;
}

.mcchat-message--cashier {
  align-self: flex-start;
}

.mcchat-message-bubble {
  padding: 10px 14px;
  border-radius: 8px;
  word-wrap: break-word;
  line-height: 1.5;
  position: relative;
}

.mcchat-message--customer .mcchat-message-bubble {
  background: #dcf8c6;
  border-radius: 8px 8px 0 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mcchat-message--cashier .mcchat-message-bubble {
  background: #fff;
  border-radius: 8px 8px 8px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Imágenes en mensajes */
.mcchat-message-image {
  max-width: 250px;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.mcchat-message-image:hover {
  opacity: 0.9;
}

.mcchat-message-image img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 300px;
  object-fit: cover;
}

.mcchat-message-time {
  font-size: 0.7rem;
  color: #666;
  margin-top: 4px;
  padding: 0 4px;
  text-align: right;
}

.mcchat-message--cashier .mcchat-message-time {
  text-align: left;
}

/* Input de mensaje */
.mcchat-drawer-input {
  background: #f0f0f0;
  padding: 12px 16px;
  border-top: 1px solid #ddd;
}

.mcchat-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mcchat-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  padding: 8px 0;
  background: transparent;
}

.mcchat-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.mcchat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.mcchat-send-btn:active {
  transform: scale(0.95);
}

/* Botón de adjuntar */
.mcchat-attach-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #667eea;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mcchat-attach-btn:hover {
  background: rgba(102, 126, 234, 0.1);
  transform: rotate(45deg);
}

.mcchat-attach-btn:active {
  transform: rotate(45deg) scale(0.9);
}

/* Preview de imagen */
.mcchat-image-preview {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.mcchat-image-preview-content {
  max-width: 500px;
  width: 100%;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.mcchat-image-preview-content img {
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  background: #f5f5f5;
}

.mcchat-image-preview-actions {
  display: flex;
  gap: 10px;
  padding: 16px;
  background: #fff;
}

.mcchat-preview-cancel,
.mcchat-preview-send {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.mcchat-preview-cancel {
  background: #f0f0f0;
  color: #666;
}

.mcchat-preview-cancel:hover {
  background: #e0e0e0;
}

.mcchat-preview-send {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.mcchat-preview-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Estados de carga */
.mcchat-loading {
  text-align: center;
  padding: 20px;
  color: #666;
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .mcchat-drawer {
    max-width: 100%;
  }
}

/* Scrollbar personalizado */
.mcchat-drawer-messages::-webkit-scrollbar {
  width: 6px;
}

.mcchat-drawer-messages::-webkit-scrollbar-track {
  background: transparent;
}

.mcchat-drawer-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.mcchat-drawer-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Botón flotante (solo visible si no existe el botón del tema) */
.mcchat-floating-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #075E54;
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 9997;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.mcchat-floating-btn:hover {
  background: #128C7E;
  transform: scale(1.1);
}

.mcchat-floating-btn:active {
  transform: scale(0.95);
}

/* Ocultar en desktop si ya existe el botón del tema */
@media (min-width: 769px) {
  .mcchat-floating-btn {
    display: none !important;
  }
}

/* Menú inicial de opciones */
.mcchat-initial-menu {
  padding: 20px;
  text-align: center;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.mcchat-menu-btn {
  width: 100%;
  transition: all 0.2s ease;
}

.mcchat-menu-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

.mcchat-menu-btn:active {
  transform: translateY(0) !important;
}
