/**
 * App2Chat Web Chat Widget Styles
 * Mobile-responsive design with clean, modern UI
 */

/* Container */
.app2chat-widget-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Bubble */
.app2chat-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.4);
  transition: all 0.3s ease;
}

.app2chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 102, 255, 0.5);
}

.app2chat-bubble.app2chat-hidden {
  display: none;
}

/* Chat Window */
.app2chat-window {
  width: 380px;
  height: 600px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

@media (prefers-color-scheme: dark) {
  .app2chat-window {
    background: #1e293b;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }
}

.app2chat-window.app2chat-hidden {
  display: none;
}

/* Header */
.app2chat-header {
  background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app2chat-header-title {
  flex: 1;
}

.app2chat-header-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.app2chat-header-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
}

.app2chat-header-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 6px;
}

.app2chat-close-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

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

/* Messages Container */
.app2chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (prefers-color-scheme: dark) {
  .app2chat-messages {
    background: #0f172a;
  }
}

/* Custom Scrollbar */
.app2chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

.app2chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.app2chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Message */
.app2chat-message {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  animation: slideIn 0.3s ease;
}

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

.app2chat-message-bot {
  align-self: flex-start;
}

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

.app2chat-message-content {
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 14px;
}

.app2chat-message-bot .app2chat-message-content {
  background: #ffffff;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  .app2chat-message-bot .app2chat-message-content {
    background: #334155;
    color: #e2e8f0;
  }
}

.app2chat-message-user .app2chat-message-content {
  background: #0066FF;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

@media (prefers-color-scheme: dark) {
  .app2chat-message-user .app2chat-message-content {
    background: #3b82f6;
    color: #ffffff;
  }
}

.app2chat-message-time {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  padding: 0 4px;
}

@media (prefers-color-scheme: dark) {
  .app2chat-message-time {
    color: #94a3b8;
  }
}

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

/* Typing Indicator */
.app2chat-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  width: fit-content;
}

@media (prefers-color-scheme: dark) {
  .app2chat-typing-indicator {
    background: #334155;
  }
}

.app2chat-typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cbd5e1;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    background: #cbd5e1;
  }
  30% {
    transform: translateY(-8px);
    background: #94a3b8;
  }
}

/* Input Container */
.app2chat-input-container {
  padding: 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}

@media (prefers-color-scheme: dark) {
  .app2chat-input-container {
    background: #1e293b;
    border-top: 1px solid #334155;
  }
}

.app2chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  background: #ffffff;
  color: #1e293b;
}

@media (prefers-color-scheme: dark) {
  .app2chat-input {
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
  }
}

.app2chat-input:focus {
  border-color: #0066FF;
}

@media (prefers-color-scheme: dark) {
  .app2chat-input:focus {
    border-color: #3b82f6;
  }
}

.app2chat-send-btn {
  width: 40px;
  height: 40px;
  background: #0066FF;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.app2chat-send-btn:hover {
  background: #0052CC;
}

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

/* Mobile Responsive */
@media (max-width: 480px) {
  .app2chat-widget-container {
    bottom: 0;
    right: 0;
    left: 0;
  }

  .app2chat-bubble {
    position: absolute;
    bottom: 20px;
    right: 20px;
  }

  .app2chat-window {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    max-height: 100vh;
  }

  .app2chat-message {
    max-width: 85%;
  }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
  .app2chat-window {
    width: 360px;
    height: 550px;
  }
}

/* Utility Classes */
.app2chat-hidden {
  display: none !important;
}
