/* ============================================
   LATIDO PROPIEDADES - Chat Widget
   ============================================ */

.chat-widget {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 1500;
  font-family: var(--font-primary);
}

/* Toggle Button */
.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(230, 57, 70, 0.4);
  transition: all var(--transition-base);
  position: relative;
}

.chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(230, 57, 70, 0.5);
}

.chat-toggle svg { width: 28px; height: 28px; }

.chat-toggle .chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: var(--color-success);
  border: 2px solid white;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Chat Window */
.chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: var(--chat-width);
  height: var(--chat-height);
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  box-shadow: 0 10px 40px rgba(29, 53, 87, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.chat-window.open { display: flex; }

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

@media (max-width: 639px) {
  .chat-window {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 85vh;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  }

  .chat-widget { bottom: 0; right: 0; }
  .chat-toggle {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
  }
}

/* Chat Header */
.chat-header {
  padding: var(--space-4) var(--space-5);
  background: var(--color-secondary);
  color: white;
  flex-shrink: 0;
}

.chat-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.chat-agent-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chat-agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
}

.chat-agent-name {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
}

.chat-agent-status {
  font-size: var(--font-size-xs);
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.chat-agent-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--color-success);
  border-radius: 50%;
}

.chat-close-btn {
  color: white;
  opacity: 0.7;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.chat-close-btn:hover { opacity: 1; background: rgba(255, 255, 255, 0.1); }

/* Chat Tabs */
.chat-tabs {
  display: flex;
  gap: var(--space-1);
}

.chat-tab {
  flex: 1;
  padding: var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  text-align: center;
  transition: all var(--transition-fast);
}

.chat-tab:hover { color: white; background: rgba(255, 255, 255, 0.15); }

.chat-tab.active {
  color: var(--color-secondary);
  background: white;
  font-weight: var(--font-weight-semibold);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--color-bg);
}

.chat-message {
  max-width: 85%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  animation: fadeIn 0.2s ease;
}

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

.chat-message-assistant {
  align-self: flex-start;
  background: var(--color-surface);
  color: var(--color-text);
  border-bottom-left-radius: var(--space-1);
  box-shadow: var(--shadow-sm);
}

.chat-message-user {
  align-self: flex-end;
  background: var(--gradient-primary);
  color: white;
  border-bottom-right-radius: var(--space-1);
}

.chat-typing {
  align-self: flex-start;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--space-1);
  box-shadow: var(--shadow-sm);
}

/* Quick Actions */
.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-3);
  background: var(--color-bg);
}

.chat-quick-btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-primary-light);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.chat-quick-btn:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Chat Input */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: none;
  background: var(--color-bg-alt);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  min-height: 40px;
}

.chat-input:focus { background: var(--color-bg); box-shadow: 0 0 0 2px var(--color-primary-light); }
.chat-input::placeholder { color: var(--color-text-muted); }

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.chat-send:hover { transform: scale(1.05); }
.chat-send:disabled { opacity: 0.5; }
.chat-send svg { width: 18px; height: 18px; }
