/* Frontend Styles for WP Custom Chatbot */

/* Chatbot Container */
.wp-chatbot-container {
  --primary-color: #4F46E5;
  --secondary-color: #10B981;
  --bg-color: #FFFFFF;
  --text-color: #111827;
  --border-radius: 12px;
  --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --transition: all 0.3s ease;
  
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  position: fixed;
  z-index: 9999;
}

/* Position Variants */
.wp-chatbot-bottom-right {
  right: 20px;
  bottom: 20px;
}

.wp-chatbot-bottom-left {
  left: 20px;
  bottom: 20px;
}

.wp-chatbot-top-right {
  right: 20px;
  top: 20px;
}

.wp-chatbot-top-left {
  left: 20px;
  top: 20px;
}

/* Toggle Button */
.wp-chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  position: relative;
  z-index: 1;
}

.wp-chatbot-toggle:hover {
  transform: scale(1.05);
}

.wp-chatbot-icon,
.wp-chatbot-default-icon,
.wp-chatbot-close-icon {
  width: 30px;
  height: 30px;
  color: white;
}

.wp-chatbot-icon {
  max-width: 30px;
  max-height: 30px;
  object-fit: contain;
}

/* Chat Box */
.wp-chatbot-box {
  position: absolute;
  width: 350px;
  height: 450px;
  background-color: var(--bg-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
  transform-origin: bottom right;
  transition: var(--transition);
}

.wp-chatbot-bottom-right .wp-chatbot-box {
  right: 0;
  bottom: 70px;
  transform-origin: bottom right;
}

.wp-chatbot-bottom-left .wp-chatbot-box {
  left: 0;
  bottom: 70px;
  transform-origin: bottom left;
}

.wp-chatbot-top-right .wp-chatbot-box {
  right: 0;
  top: 70px;
  transform-origin: top right;
}

.wp-chatbot-top-left .wp-chatbot-box {
  left: 0;
  top: 70px;
  transform-origin: top left;
}

.wp-chatbot-container.wp-chatbot-open .wp-chatbot-box {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

/* Chat Header */
.wp-chatbot-header {
  background-color: var(--primary-color);
  color: white;
  padding: 15px 20px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wp-chatbot-header-title {
  font-size: 1.1em;
}

/* Messages Container */
.wp-chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Message Bubbles */
.wp-chatbot-message {
  display: flex;
  margin-bottom: 10px;
}

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

.wp-chatbot-message-user {
  align-self: flex-end;
  justify-content: flex-end;
}

.wp-chatbot-message-content {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  word-break: break-word;
}

.wp-chatbot-message-bot .wp-chatbot-message-content {
  border-radius: 18px 18px 18px 4px;
  background-color: var(--secondary-color);
  color: white;
}

.wp-chatbot-message-user .wp-chatbot-message-content {
  border-radius: 18px 18px 4px 18px;
  background-color: var(--primary-color);
  color: white;
}

/* Typing Indicator */
.wp-chatbot-typing {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.wp-chatbot-typing-dot {
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background-color: var(--secondary-color);
  margin: 0 2px;
  display: inline-block;
  animation: typing 1s infinite ease-in-out;
}

.wp-chatbot-typing-dot:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes typing {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0);
  }
}

/* Chat Footer */
.wp-chatbot-footer {
  padding: 15px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.wp-chatbot-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wp-chatbot-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
}

.wp-chatbot-input:focus {
  border-color: var(--primary-color);
}

.wp-chatbot-submit {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}

.wp-chatbot-submit:hover {
  background-color: rgba(var(--primary-rgb), 0.9);
  transform: scale(1.05);
}

.wp-chatbot-submit svg {
  width: 20px;
  height: 20px;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
  .wp-chatbot-box {
    width: 300px;
    height: 400px;
  }
  
  .wp-chatbot-bottom-right .wp-chatbot-box,
  .wp-chatbot-bottom-left .wp-chatbot-box {
    width: calc(100vw - 40px);
    left: 20px;
    right: 20px;
  }
  
  .wp-chatbot-top-right .wp-chatbot-box,
  .wp-chatbot-top-left .wp-chatbot-box {
    width: calc(100vw - 40px);
    left: 20px;
    right: 20px;
  }
}

/* Animations */
@keyframes bounceIn {
  from,
  20%,
  40%,
  60%,
  80%,
  to {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }

  0% {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 0.3);
  }

  20% {
    transform: scale3d(1.1, 1.1, 1.1);
  }

  40% {
    transform: scale3d(0.9, 0.9, 0.9);
  }

  60% {
    opacity: 1;
    transform: scale3d(1.03, 1.03, 1.03);
  }

  80% {
    transform: scale3d(0.97, 0.97, 0.97);
  }

  to {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

.wp-chatbot-message-content {
  animation: bounceIn 0.6s;
}

/* Scrollbar Styling */
.wp-chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.wp-chatbot-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.wp-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.wp-chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Iframe Container */
.wp-chatbot-iframe-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.wp-chatbot-iframe-container .wp-chatbot-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.wp-chatbot-iframe-container .wp-chatbot-box {
  position: relative;
  width: 100%;
  height: 100%;
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
  box-shadow: none;
}

.wp-chatbot-iframe-container .wp-chatbot-toggle {
  display: none;
}