/* Chat Widget Styles - Entregas no Cubico */

/* CSS Variables - matching site theme */
:root {
  --chat-primary: #f44749;
  --chat-primary-dark: #d93d3f;
  --chat-secondary: #f3af24;
  --chat-bg: #ffffff;
  --chat-text: #333333;
  --chat-text-light: #666666;
  --chat-border: #e0e0e0;
  --chat-shadow: rgba(0, 0, 0, 0.15);
  --chat-user-bubble: #f44749;
  --chat-ai-bubble: #f5f5f5;
}

/* Chat Toggle Button */
.chat-widget-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--chat-primary);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--chat-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: all 0.3s ease;
}

.chat-widget-toggle:hover {
  background: var(--chat-primary-dark);
  transform: scale(1.05);
}

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

.chat-widget-toggle .chat-icon-close {
  display: none;
}

.chat-widget-toggle.active .chat-icon-open {
  display: none;
}

.chat-widget-toggle.active .chat-icon-close {
  display: block;
}

/* Notification badge */
.chat-widget-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--chat-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #000;
  animation: pulse 2s infinite;
}

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

/* Chat Window */
.chat-widget-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: var(--chat-bg);
  border-radius: 16px;
  box-shadow: 0 8px 32px var(--chat-shadow);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
  overflow: hidden;
}

.chat-widget-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-widget-header {
  background: var(--chat-primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-widget-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-widget-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-widget-avatar svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.chat-widget-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.chat-widget-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-widget-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
}

/* Language Toggle */
.chat-widget-lang {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 4px;
}

.chat-widget-lang button {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.chat-widget-lang button.active {
  background: white;
  color: var(--chat-primary);
}

.chat-widget-lang button:hover:not(.active) {
  color: white;
}

/* Chat Messages Area */
.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafafa;
}

.chat-widget-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-widget-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

/* Message Bubbles */
.chat-message {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  animation: messageIn 0.3s ease;
}

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

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.chat-message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.user .chat-message-bubble {
  background: var(--chat-user-bubble);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-message-bubble {
  background: var(--chat-ai-bubble);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}

.chat-message-time {
  font-size: 11px;
  color: var(--chat-text-light);
  margin-top: 4px;
  padding: 0 4px;
}

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

/* Typing Indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--chat-ai-bubble);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.chat-typing span {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Welcome Message */
.chat-welcome {
  text-align: center;
  padding: 20px;
  color: var(--chat-text-light);
}

.chat-welcome h4 {
  color: var(--chat-text);
  margin-bottom: 8px;
  font-size: 16px;
}

.chat-welcome p {
  font-size: 14px;
  margin: 0;
}

/* Quick Actions */
.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
  background: #fafafa;
}

.chat-quick-btn {
  padding: 8px 14px;
  border: 1px solid var(--chat-border);
  background: white;
  border-radius: 20px;
  font-size: 13px;
  color: var(--chat-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Chat Input Area */
.chat-widget-input {
  padding: 16px;
  background: white;
  border-top: 1px solid var(--chat-border);
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-widget-input textarea {
  flex: 1;
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 100px;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-widget-input textarea:focus {
  border-color: var(--chat-primary);
}

.chat-widget-input textarea::placeholder {
  color: #999;
}

.chat-widget-send {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--chat-primary);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-widget-send:hover {
  background: var(--chat-primary-dark);
}

.chat-widget-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.chat-widget-send svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Error State */
.chat-error {
  background: #fef2f2;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  margin: 8px 16px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chat-widget-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .chat-widget-toggle {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .chat-widget-window.active + .chat-widget-toggle {
    display: none;
  }
}

/* Print - hide chat widget */
@media print {
  .chat-widget-toggle,
  .chat-widget-window {
    display: none !important;
  }
}
