/* public/assets/css/chat.css - Enhanced floating chat widget */
:root {
  --chat-bg: #ffffff;
  --chat-header-text: #ffffff;
  --chat-border: rgba(0,0,0,0.1);
  --chat-user-bg: #dcfce7;
  --chat-admin-bg: #e0e7ff;
  --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  --chat-shadow-hover: 0 12px 50px rgba(0, 0, 0, 0.2);
}

.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10000010;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-primary, linear-gradient(135deg, #6366f1, #22d3ee));
  color: #fff;
  box-shadow: var(--chat-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--chat-shadow-hover);
  filter: brightness(1.1);
}

.chat-toggle:active {
  transform: scale(0.95);
}

.chat-panel {
  width: 360px;
  height: 500px;
  background: var(--chat-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--chat-shadow);
  position: absolute;
  right: 0;
  bottom: 75px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.chat-panel.hidden { 
  display: none;
  opacity: 0;
  transform: translateY(20px);
}

.chat-header {
  background: var(--gradient-primary, linear-gradient(135deg, #6366f1, #22d3ee));
  color: var(--chat-header-text);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-title { 
  font-weight: 600;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#chat-agent {
  font-size: 12px;
  opacity: 1;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#chat-agent strong {
  font-weight: 600;
  color: #fff;
}

#chat-agent i {
  opacity: 0.9;
}

.chat-close {
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-body {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-message { 
  display: flex;
  flex-direction: column;
  max-width: 75%;
  animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message-user { 
  margin-left: auto;
  align-items: flex-end;
}

.chat-message-admin { 
  margin-right: auto;
  align-items: flex-start;
}

.chat-message-system {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 8px 0;
}

.chat-bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
}

.chat-message-user .chat-bubble { 
  background: var(--chat-user-bg);
  color: #166534;
  border-bottom-right-radius: 4px;
}

.chat-message-admin .chat-bubble { 
  background: var(--chat-admin-bg);
  color: #3730a3;
  border-bottom-left-radius: 4px;
}

.chat-message-system .chat-bubble {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #fbbf24;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.chat-time { 
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  padding: 0 4px;
}

.chat-footer { 
  padding: 12px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}

#chat-form { 
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  padding: 10px 16px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--primary-color, #6366f1);
  box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 99, 102, 241), 0.1);
}

.chat-input::placeholder {
  color: #9ca3af;
}

.chat-send {
  border: none;
  background: var(--gradient-primary, linear-gradient(135deg, #6366f1, #22d3ee));
  color: #fff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 16px;
}

.chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(var(--primary-color-rgb, 99, 102, 241), 0.3);
  filter: brightness(1.1);
}

.chat-send:active {
  transform: scale(0.95);
}

.chat-send i {
  margin-left: 2px;
}

@media (max-width: 480px) {
  .chat-widget {
    right: 12px;
    bottom: 12px;
  }
  
  .chat-panel { 
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    max-width: 360px;
    right: 0;
  }
  
  .chat-toggle {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
}

/* Animations */
@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message {
  animation: messageSlide 0.3s ease-out;
}
