/**
 * Octave Resolution - AI Chatbot Styles
 */

/* Chatbot Container */
#octave-chatbot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  touch-action: none; /* Prevent default touch behaviors */
  user-select: none; /* Prevent text selection while dragging */
}

#octave-chatbot.dragging {
  transition: none !important; /* Disable transitions while dragging */
}

#octave-chatbot.dragging * {
  pointer-events: none; /* Prevent interference while dragging */
}

/* Toggle Button */
.chatbot-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  box-shadow: 0 4px 12px rgba(61, 90, 107, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

.chatbot-button:active {
  cursor: grabbing;
}

.chatbot-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(61, 90, 107, 0.5);
}

.chatbot-button svg {
  width: 28px;
  height: 28px;
}

.chatbot-button .chatbot-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  animation: pulse 2s infinite;
}

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

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.chatbot-header {
  background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
  color: white;
  padding: 16px 20px;
  border-radius: 16px 16px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatbot-header-content h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.chatbot-header-content p {
  margin: 4px 0 0 0;
  font-size: 13px;
  opacity: 0.9;
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-country-select {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.chatbot-country-select:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chatbot-country-select option {
  background: var(--brand-teal-dark);
  color: white;
}

.chatbot-reset,
.chatbot-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  padding: 0;
}

.chatbot-reset:hover,
.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chatbot-reset:active {
  transform: rotate(180deg);
}

.chatbot-reset svg {
  width: 18px;
  height: 18px;
}

/* Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--off-white);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--light-gray);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Message */
.chatbot-message {
  display: flex;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-avatar .avatar-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.message-content {
  flex: 1;
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message-content p {
  margin: 0;
  line-height: 1.6;
  color: #2d3748;
  font-size: 14px;
}

.message-content ol,
.message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.message-content li {
  margin: 4px 0;
  line-height: 1.6;
  color: #2d3748;
  font-size: 14px;
}

.message-content strong {
  color: var(--dark-slate);
  font-weight: 600;
}

.message-content em {
  font-style: italic;
  color: var(--medium-gray);
}

/* User Message */
.user-message {
  flex-direction: row-reverse;
}

.user-message .message-content {
  background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
  color: white;
}

.user-message .message-content p {
  color: white;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.quick-action {
  background: var(--off-white);
  border: 1px solid #e2e8f0;
  color: var(--brand-teal);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-align: center;
}

.quick-action:hover {
  background: var(--brand-teal);
  color: white;
  border-color: var(--brand-teal);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(61, 90, 107, 0.2);
}

/* Action Buttons in Bot Responses */
.chatbot-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.chatbot-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  white-space: nowrap;
}

.chatbot-action-btn.primary {
  background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(61, 90, 107, 0.3);
}

.chatbot-action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(61, 90, 107, 0.4);
}

.chatbot-action-btn.secondary {
  background: white;
  color: var(--brand-teal);
  border: 1px solid #e2e8f0;
}

.chatbot-action-btn.secondary:hover {
  background: var(--off-white);
  border-color: var(--brand-teal);
  transform: translateY(-1px);
}

.chatbot-action-btn:active {
  transform: translateY(0);
}

/* Typing Indicator */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--light-gray);
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* Input Area */
.chatbot-input-area {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e2e8f0;
  align-items: flex-end;
}

#chatbot-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  transition: border-color 0.2s;
}

#chatbot-input:focus {
  outline: none;
  border-color: var(--brand-teal);
}

#chatbot-input::placeholder {
  color: #a0aec0;
}

.chatbot-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(61, 90, 107, 0.3);
}

.chatbot-send-btn:active {
  transform: scale(0.95);
}

/* Footer */
.chatbot-footer {
  padding: 12px 20px;
  background: var(--off-white);
  border-radius: 0 0 16px 16px;
  text-align: center;
  border-top: 1px solid #e2e8f0;
}

.chatbot-footer small {
  color: #718096;
  font-size: 12px;
}

.chatbot-footer a {
  color: var(--brand-teal);
  text-decoration: none;
}

.chatbot-footer a:hover {
  text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  #octave-chatbot {
    bottom: 10px;
    right: 10px;
  }
  
  .chatbot-window {
    bottom: 80px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    height: calc(100vh - 100px);
  }
  
  .chatbot-button {
    width: 56px;
    height: 56px;
  }
  
  .chatbot-header {
    padding: 14px 16px;
  }
  
  .chatbot-header-content h3 {
    font-size: 16px;
  }
  
  .chatbot-header-content p {
    font-size: 12px;
  }
  
  .chatbot-messages {
    padding: 16px;
  }
  
  .chatbot-input-area {
    padding: 12px 16px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .chatbot-window {
    background: #1a202c;
  }
  
  .chatbot-messages {
    background: #2d3748;
  }
  
  .message-content {
    background: #374151;
    color: #e2e8f0;
  }
  
  .message-content p,
  .message-content li {
    color: #e2e8f0;
  }
  
  .message-content strong {
    color: white;
  }
  
  #chatbot-input {
    background: #374151;
    border-color: var(--medium-gray);
    color: #e2e8f0;
  }
  
  #chatbot-input::placeholder {
    color: #718096;
  }
  
  .chatbot-input-area,
  .chatbot-footer {
    background: #1a202c;
    border-color: var(--medium-gray);
  }
  
  .quick-action {
    background: #374151;
    border-color: var(--medium-gray);
    color: #e2e8f0;
  }
  
  .quick-action:hover {
    background: var(--brand-teal);
    color: white;
  }
}
