/* Indos Chatbot Styles */

/* CSS Variables for easy theming */
:root {
  --chatbot-primary-color: oklch(0.3809 0.1346 257.28);
  --chatbot-secondary-color: oklch(0.7222 0.1713 53.92);
  --chatbot-gradient: linear-gradient(
    135deg,
    var(--chatbot-primary-color) 0%,
    var(--chatbot-primary-color) 40%,
    var(--chatbot-secondary-color) 100%
  );
  --chatbot-icon-gradient: linear-gradient(
    135deg,
    var(--chatbot-primary-color) 0%,
    var(--chatbot-primary-color) 20%,
    var(--chatbot-secondary-color) 100%
  );
  --chatbot-bg-color: #ffffff;
  --chatbot-messages-bg: #f8f9fa;
  --chatbot-border-color: #e1e5e9;
  --chatbot-text-color: #333;
  --chatbot-text-light: #666;
  --chatbot-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  --chatbot-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.2);
  --chatbot-border-radius: 10px;
  --chatbot-border-radius-sm: 6px;
  --chatbot-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Chat window sizes */
  --chatbot-width: 350px;
  --chatbot-height: 500px;
  --chatbot-width-expanded: 500px;
  --chatbot-height-expanded: 650px;
}

/* Chat button */
#indos-chatbot-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: var(--chatbot-icon-gradient);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  z-index: 9997;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: none;
}

#indos-chatbot-button:hover {
  transform: scale(1.05);
  box-shadow: var(--chatbot-shadow-hover);
}

#indos-chatbot-button svg {
  width: 30px;
  height: 30px;
  fill: white;
}

/* Chat window */
#indos-chatbot-window {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: var(--chatbot-width);
  height: var(--chatbot-height);
  background: var(--chatbot-bg-color);
  border-radius: var(--chatbot-border-radius);
  box-shadow: var(--chatbot-shadow);
  display: none;
  flex-direction: column;
  z-index: 9999;
  font-family: var(--chatbot-font-family);
  overflow: hidden;
  transition: all 0.3s ease;
}

#indos-chatbot-window.expanded {
  width: var(--chatbot-width-expanded);
  height: var(--chatbot-height-expanded);
}

#indos-chatbot-window.open {
  display: flex;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat header */
.indos-chatbot-header {
  background: var(--chatbot-gradient);
  color: white;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.indos-chatbot-title-section {
  flex: 1;
}

.indos-chatbot-title {
  color: white;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.indos-chatbot-caption {
  margin: 2px 0 0 0;
  font-size: 12px;
  opacity: 0.85;
  font-weight: 400;
  line-height: 1;
}

.indos-chatbot-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.indos-chatbot-expand,
.indos-chatbot-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.indos-chatbot-expand:hover,
.indos-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Chat messages area */
.indos-chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--chatbot-messages-bg);
}

.indos-chatbot-message {
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
}

.indos-chatbot-message.user {
  justify-content: flex-end;
}

.indos-chatbot-message.bot {
  justify-content: flex-start;
}

.indos-chatbot-message-content {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.indos-chatbot-message.user .indos-chatbot-message-content {
  background: var(--chatbot-primary-color);
  color: white;
  border-bottom-right-radius: 4px;
}

.indos-chatbot-message.bot .indos-chatbot-message-content {
  background: var(--chatbot-bg-color);
  color: var(--chatbot-text-color);
  border: 1px solid var(--chatbot-border-color);
  border-bottom-left-radius: 4px;
}

/* Chat input area */
.indos-chatbot-input-area {
  padding: 15px 20px;
  border-top: 1px solid var(--chatbot-border-color);
  background: var(--chatbot-bg-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.indos-chatbot-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid var(--chatbot-border-color);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.indos-chatbot-input:focus {
  border-color: var(--chatbot-primary-color);
}

.indos-chatbot-send {
  width: 40px;
  height: 40px;
  background: var(--chatbot-primary-color);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.indos-chatbot-send:hover:not(:disabled) {
  transform: scale(1.05);
}

.indos-chatbot-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.indos-chatbot-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Loading indicator */
.indos-chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 15px;
  background: var(--chatbot-bg-color);
  border: 1px solid var(--chatbot-border-color);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  max-width: 60px;
}

.indos-chatbot-typing-dot {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.indos-chatbot-typing-dot:nth-child(1) {
  animation-delay: 0s;
}
.indos-chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.indos-chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  30% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Scrollbar styling */
.indos-chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.indos-chatbot-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.indos-chatbot-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.indos-chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Mobile responsiveness */
@media (max-width: 580px) {
  #indos-chatbot-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    right: 20px;
    bottom: 20px;
  }
  #indos-chatbot-window.expanded {
    width: calc(100vw - 40px) !important;
    height: calc(100vh - 40px) !important;
    right: 20px !important;
    bottom: 20px !important;
  }

  #indos-chatbot-button {
    width: 50px;
    height: 50px;
    bottom: 15px;
    right: 15px;
  }

  #indos-chatbot-button svg {
    width: 24px;
    height: 24px;
  }

  .indos-chatbot-title {
    font-size: 14px;
  }

  .indos-chatbot-caption {
    font-size: 11px;
  }

  .indos-chatbot-expand {
    display: none;
  }
}

/* Markdown content styling for bot messages */
.indos-chatbot-message.bot .indos-chatbot-message-content h1,
.indos-chatbot-message.bot .indos-chatbot-message-content h2,
.indos-chatbot-message.bot .indos-chatbot-message-content h3,
.indos-chatbot-message.bot .indos-chatbot-message-content h4,
.indos-chatbot-message.bot .indos-chatbot-message-content h5,
.indos-chatbot-message.bot .indos-chatbot-message-content h6 {
  margin: 0.5em 0;
  font-weight: 600;
  line-height: 1.3;
}

.indos-chatbot-message.bot .indos-chatbot-message-content h1 {
  font-size: 1.2em;
}
.indos-chatbot-message.bot .indos-chatbot-message-content h2 {
  font-size: 1.15em;
}
.indos-chatbot-message.bot .indos-chatbot-message-content h3 {
  font-size: 1.1em;
}
.indos-chatbot-message.bot .indos-chatbot-message-content h4,
.indos-chatbot-message.bot .indos-chatbot-message-content h5,
.indos-chatbot-message.bot .indos-chatbot-message-content h6 {
  font-size: 1em;
}

.indos-chatbot-message.bot .indos-chatbot-message-content p {
  margin: 0.5em 0;
}

.indos-chatbot-message.bot .indos-chatbot-message-content p:first-child {
  margin-top: 0;
}

.indos-chatbot-message.bot .indos-chatbot-message-content p:last-child {
  margin-bottom: 0;
}

.indos-chatbot-message.bot .indos-chatbot-message-content ul,
.indos-chatbot-message.bot .indos-chatbot-message-content ol {
  margin: 0.5em 0;
  padding-left: 20px;
}

.indos-chatbot-message.bot .indos-chatbot-message-content li {
  margin: 0.25em 0;
}

.indos-chatbot-message.bot .indos-chatbot-message-content strong,
.indos-chatbot-message.bot .indos-chatbot-message-content b {
  font-weight: 600;
}

.indos-chatbot-message.bot .indos-chatbot-message-content em,
.indos-chatbot-message.bot .indos-chatbot-message-content i {
  font-style: italic;
}

.indos-chatbot-message.bot .indos-chatbot-message-content code {
  background: #f1f3f4;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: "Monaco", "Consolas", "Courier New", monospace;
  font-size: 0.9em;
  color: inherit;
}

.indos-chatbot-message.bot .indos-chatbot-message-content pre {
  background: #f8f9fa;
  border: 1px solid #e1e5e9;
  border-radius: 6px;
  padding: 12px;
  margin: 0.5em 0;
  overflow-x: auto;
  font-family: "Monaco", "Consolas", "Courier New", monospace;
  font-size: 0.85em;
  line-height: 1.4;
}

.indos-chatbot-message.bot .indos-chatbot-message-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
}

.indos-chatbot-message.bot .indos-chatbot-message-content blockquote {
  border-left: 3px solid var(--chatbot-primary-color);
  margin: 0.5em 0;
  padding: 0.5em 0 0.5em 12px;
  background: rgba(102, 126, 234, 0.05);
  font-style: italic;
}

.indos-chatbot-message.bot .indos-chatbot-message-content a {
  color: var(--chatbot-primary-color);
  text-decoration: none;
  border-bottom: 1px solid rgba(102, 126, 234, 0.3);
  transition: border-color 0.2s;
}

.indos-chatbot-message.bot .indos-chatbot-message-content a:hover {
  border-bottom-color: var(--chatbot-primary-color);
}

.indos-chatbot-message.bot .indos-chatbot-message-content hr {
  border: none;
  border-top: 1px solid var(--chatbot-border-color);
  margin: 1em 0;
}

.indos-chatbot-message.bot .indos-chatbot-message-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5em 0;
  font-size: 0.9em;
}

.indos-chatbot-message.bot .indos-chatbot-message-content th,
.indos-chatbot-message.bot .indos-chatbot-message-content td {
  border: 1px solid var(--chatbot-border-color);
  padding: 6px 8px;
  text-align: left;
}

.indos-chatbot-message.bot .indos-chatbot-message-content th {
  background: var(--chatbot-messages-bg);
  font-weight: 600;
}
