/* ZeroProof Support Chat Widget Styles */

#support-chat-widget {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  right: 24px;
  z-index: 9999;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Toggle Button */
.chat-toggle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7BAE7F 0%, #5B9EA6 100%);
  border: none;
  box-shadow: 0 4px 20px rgba(123, 174, 127, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.chat-toggle-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(123, 174, 127, 0.5);
}

.chat-toggle-btn:active {
  transform: scale(0.95);
}

.chat-toggle-btn .chat-icon {
  display: block;
  transition: all 0.3s;
}

.chat-toggle-btn .close-icon {
  display: none;
  transition: all 0.3s;
}

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

.chat-toggle-btn.open .close-icon {
  display: block;
}

/* Chat Panel */
.chat-panel {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 140px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 40px 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);
}

.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Chat Header */
.chat-header {
  padding: 20px 20px 16px;
  background: linear-gradient(135deg, #7BAE7F 0%, #5B9EA6 100%);
  color: white;
  border-radius: 16px 16px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.chat-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 0 4px 0;
}

.chat-status {
  font-size: 0.85rem;
  opacity: 0.9;
  margin: 0;
}

.chat-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all 0.2s;
}

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

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

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

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

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

/* Messages */
.chat-message {
  display: flex;
  animation: slideIn 0.3s ease-out;
}

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

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  font-size: 0.95rem;
  line-height: 1.5;
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-content {
  background: linear-gradient(135deg, #7BAE7F 0%, #5B9EA6 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.bot-message {
  justify-content: flex-start;
}

.bot-message .message-content {
  background: white;
  color: #1A1A1A;
  border: 1px solid #EBEBEB;
  border-bottom-left-radius: 4px;
}

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

.bot-message .message-content li {
  margin: 4px 0;
}

.bot-message .message-content p {
  margin: 0 0 8px 0;
}

.bot-message .message-content p:last-child {
  margin-bottom: 0;
}

/* Typing Indicator */
.typing-indicator .message-content {
  padding: 16px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #7BAE7F;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

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

/* Input Area */
.chat-input-wrapper {
  padding: 16px;
  background: white;
  border-top: 1px solid #EBEBEB;
  border-radius: 0 0 16px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 2px solid #EBEBEB;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  max-height: 120px;
  line-height: 1.4;
}

.chat-input:focus {
  border-color: #7BAE7F;
}

.chat-input::placeholder {
  color: #8E8E8E;
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7BAE7F 0%, #5B9EA6 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all 0.2s;
}

.chat-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(123, 174, 127, 0.3);
}

.chat-send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  #support-chat-widget {
    bottom: calc(72px + env(safe-area-inset-bottom));
    right: 16px;
  }

  .chat-toggle-btn {
    width: 56px;
    height: 56px;
  }

  .chat-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 160px);
    bottom: 72px;
  }
}
