/* Pencly AI Assistant Chat Widget Styles */

* {
  box-sizing: border-box;
}

/* Chat Button */
.chat-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(45deg, #9d4edd, #6a00f4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 10px #9d4edd, 0 0 20px #6a00f4;
  transition: all 0.3s ease;
  z-index: 9998;
}

.chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px #9d4edd, 0 0 30px #6a00f4;
}

.chat-button svg {
  color: white;
}

.chat-button.hidden {
  display: none;
}

/* Chat Widget Container */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 40px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: all 0.3s ease;
  overflow: hidden;
}

.chat-widget.hidden {
  display: none;
}

/* Chat Header */
.chat-header {
  background: linear-gradient(45deg, #9d4edd, #6a00f4);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 16px 16px 0 0;
}

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

.avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-text h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.header-text .status {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-text .status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #4caf50;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.close-button {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

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

/* Messages Container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f5f5f5;
  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: #ccc;
  border-radius: 3px;
}

/* Message Styles */
.message {
  display: flex;
  animation: fadeIn 0.3s ease;
}

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

.message-content {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 14px;
}

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

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

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

.bot-message .message-content {
  background: white;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.user-message .message-content {
  background: linear-gradient(45deg, #9d4edd, #6a00f4);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 12px;
  width: fit-content;
  margin: 0 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-indicator.hidden {
  display: none;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #9d4edd;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

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

/* Contact Form */
.contact-form-container {
  padding: 20px;
  background: #f9f9f9;
  border-top: 1px solid #e0e0e0;
}

.contact-form-container.hidden {
  display: none;
}

.form-header {
  margin-bottom: 16px;
}

.form-header h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: #333;
}

.form-header p {
  margin: 0;
  font-size: 13px;
  color: #666;
}

#contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#contact-form input,
#contact-form textarea {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
}

#contact-form input:focus,
#contact-form textarea:focus {
  outline: none;
  border-color: #9b59b6;
}

#contact-form textarea {
  resize: vertical;
  min-height: 60px;
}

.submit-button {
  background: linear-gradient(45deg, #9d4edd, #6a00f4);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 10px #9d4edd, 0 0 20px #6a00f4;
}

.submit-button:active {
  transform: translateY(0);
}

/* Input Container */
.chat-input-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e0e0e0;
}

#chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 24px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
}

#chat-input:focus {
  outline: none;
  border-color: #9d4edd;
}

.send-button {
  width: 44px;
  height: 44px;
  background: linear-gradient(45deg, #9d4edd, #6a00f4);
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 0 5px #9d4edd;
}

.send-button:hover {
  transform: scale(1.1);
}

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

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

/* Powered By */
.powered-by {
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: #999;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
}

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

  .chat-header {
    border-radius: 0;
  }

  .chat-button {
    bottom: 16px;
    right: 16px;
  }
}

/* Success Animation */
.success-message {
  text-align: center;
  padding: 40px 20px;
}

.success-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.success-message h4 {
  margin: 0 0 8px 0;
  color: #4caf50;
}

.success-message p {
  margin: 0;
  color: #666;
  font-size: 14px;
}
