:root {
  --chat-width: 375px;
  --chat-max-width: unset;
  --chat-margin-x: 1rem;
  --chat-margin-y: 1rem;
  --progress-color: gray;
  --button-bg: #007bff;
}

.chat-widget * {
  list-style-type: disc !important;
  font-family: 'Inter', serif;
}

.chat-widget button {
  padding: 15px;
  margin: unset !important;
}

.chat-widget {
  width: var(--chat-width, 375px);
  max-width: var(--chat-max-width, unset);
  display: flex;
  flex-direction: column;
  background: #dae5ea;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  z-index: 9999;
  overflow: hidden;
  border-radius: 20px;
}

.chat-widget.chat-floating {
  position: fixed;
  max-height: 85%;
}

.chat-widget.chat-in-container {
  height: 100vh;
}

.chat-bottom-right {
  bottom: var(--chat-margin-y, 1rem);
  right: var(--chat-margin-x, 1rem);
}

.chat-bottom-left {
  bottom: var(--chat-margin-y, 1rem);
  left: var(--chat-margin-x, 1rem);
}

.chat-header .chat-title {
  display: flex;
  align-items: center;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #0d47a1;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 20px;
  box-sizing: border-box;
  border-bottom: 5px solid rgb(221, 224, 228);
}

.chat-header .header-item {
  display: flex;
  align-items: center;
}

.chat-header .header-item img {
  max-height: 60px;
}

.chat-header .header-item img.logo-svg {
  height: 60px;
  width: 200px;
  min-width: 200px;
  min-height: 60px;
}

.chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding: 0;
  scroll-behavior: smooth;
  scrollbar-width: auto;
  scrollbar-color: rgba(128, 128, 128, 0.5) rgba(255, 255, 255, 0.4);
}
             

.chat-history::-webkit-scrollbar {
  width: 4px;
}

.chat-history::-webkit-scrollbar-track {
  background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.chat-busy {
  margin-bottom: 0.5rem;
  color: var(--progress-color, gray);
}

.chat-d-none {
  display: none !important;
}

.chat-input,
.chat-input:focus-visible {
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  padding: 1rem;
  border-radius: 25px;
  font-size: 1rem;
  font-family: inherit;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.chat-input:focus {
  background: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.chat-input::placeholder {
  color: #888;
  font-style: italic;
}

.chat-buttons {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.chat-message {
  text-align: left;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  overflow-wrap: break-word;
  display: block;
  flex-direction: column;
  margin-bottom: 0.75rem;
  max-width: 85%;
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-widget .disabled button,
.chat-widget .disabled .replyMultiitem {
  pointer-events: none;
}

.chat-widget .disabled button.disableoveride {
  pointer-events: all !important;
}

.chat-message.user {
  margin-left: auto;
  margin-right: 0;
    background-color: #0d47a1;
    color: white;
  border-bottom-right-radius: 0px;
  display: table;
}

.chat-message.model {
  margin-left: 0;
  margin-right: auto;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  border-bottom-left-radius: 0px;
}

.chat-message ul {
  padding-left: 20px;
  margin: 0.5rem 0;
}

.chat-message a {
  color: var(--button-bg, #007bff);
  font-style: italic;
  font-weight: bold;
}

.chat-widget-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.75rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 500;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chat-widget-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.chat-widget-btn.chat-widget-btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
}

.chat-widget-btn.chat-widget-btn-secondary:hover {
  background: rgba(255, 107, 107, 0.2);
  color: #ff5252;
}

.chat-widget-btn[type='submit']::before {
  content: '➤';
  font-size: 1.1rem;
}

.chat-widget-btn.chat-clear::before {
  content: '❌';
  font-size: 1rem;
}

.chat-widget-btn.chat-stopStream::before {
  content: '🚫';
  font-size: 1rem;
}

.chat-widget-btn.confirm-yes {
  background-color: white;
  color: #4caf50;
  border-color: rgba(76, 175, 80, 0.3);
  border-radius: 25px;
  padding: 0.75rem 1.5rem;
  width: auto;
  height: auto;
  margin: 0.5rem !important;
  display: inline;
}

.chat-widget-btn.confirm-yes::before {
  content: '✓ ';
  margin-right: 0.5rem;
}

.chat-widget-btn.confirm-no {
  background-color: white;
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
  border-radius: 25px;
  padding: 0.75rem 1.5rem;
  width: auto;
  height: auto;
  margin: 0.5rem !important;
  display: inline;
}

.chat-widget-btn.confirm-no::before {
  content: '✗ ';
  margin-right: 0.5rem;
}

.chat-widget-btn.confirm-yes:hover {
  background-color: rgba(255, 255, 255, 0.7);
  color: #388e3c;
}

.chat-widget-btn.confirm-no:hover {
  background-color: rgba(255, 255, 255, 0.7);
  color: #d32f2f;
}

.chat-open-button {
  position: fixed;
  z-index: 9998;
  padding: 1.2rem;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  background: linear-gradient(135deg, #4285f4 0%, #5a9cf8 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(66, 133, 244, 0.4);
  transition: all 0.3s ease;
  isolation: isolate;
}

.chat-open-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(66, 133, 244, 0.6);
}

.chat-bottom-right.chat-open-button {
  bottom: var(--chat-margin-y, 1rem);
  right: var(--chat-margin-x, 1rem);
}

.chat-bottom-left.chat-open-button {
  bottom: var(--chat-margin-y, 1rem);
  left: var(--chat-margin-x, 1rem);
}

.chat-open-button::before,
.chat-open-button::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  z-index: -1;
}

.chat-open-button::before {
  inset: 0;
  background: linear-gradient(135deg, #4285f4 0%, #5a9cf8 100%);
  animation: pulse-opacity 3s infinite;
}

.chat-open-button::after {
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  background: linear-gradient(135deg, #4285f4 0%, #5a9cf8 100%);
  opacity: 0.3;
  animation: halo-pulse 2s infinite;
}

@keyframes pulse-opacity {
  0%,
  25%,
  75%,
  95% {
    opacity: 1;
  }
  10%,
  20%,
  80%,
  90% {
    opacity: 0.9;
  }
}

@keyframes halo-pulse {
  0% {
    transform: scale(1);
    opacity: 0;
  }
  20% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.chat-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  z-index: 10000;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.chat-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

.chat-tooltip.visible,
.chat-widget-btn:hover .chat-tooltip {
  opacity: 1;
}

.chat-tooltips-container {
  position: fixed;
  z-index: 10001;
  margin-bottom: 80px;
  display: none;
}

.chat-tooltips-container.visible {
  display: block;
}

.chat-widget-btn .chat-tooltip {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0;
}

.typing-indicator {
  font-family: inherit;
  white-space: pre;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--progress-color, gray);
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.typing-indicator .highlight {
  opacity: 0.6;
}

.fade-in {
  opacity: 0.3;
  animation: fadeIn 0.1s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.chat-busy-listening {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
  font-style: italic;
  opacity: 0.7;
  padding: 0.5rem 1rem;
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.replyMultiitem {
  background: #e2e8f0 !important;
  color: #333 !important;
  padding: 0.5rem 1rem;
  border-radius: 15px;
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.replyMultiitem:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-1px);
}

.replyMultiitem_selected {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #333 !important;
  padding: 0.5rem 1rem;
  border-radius: 15px;
  margin-bottom: 0.5rem;
}

.chat-input-container {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 25px;
  padding: 0.25rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-input-container:focus-within {
  background: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.chat-send-button {
  background: linear-gradient(135deg, #4285f4 0%, #5a9cf8 100%);
  border: none;
  color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem;
  transition: all 0.2s ease;
}

.chat-send-button:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(66, 133, 244, 0.4);
}

.chat-send-button:before {
  content: '→';
  font-size: 1.2rem;
  font-weight: bold;
}

.debug-panel.compact {
  background-color: #a8bdd6;
  border-radius: 8px;
  padding: 0;
  margin-top: 0px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #9370db;
  max-width: 600px;
  width: 100%;
  font-size: 1em !important;
  overflow-x: hidden;
}

.debug-panel.compact .debug-header {
  background-color: #e0e6ed;
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dcdcdc;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.debug-panel.compact .debug-header:hover {
  background-color: #d1d9e2;
}

.debug-panel.compact .debug-header h3 {
  color: #7b68ee;
  margin: 0;
  font-size: 1em;
  font-weight: 600;
}

.debug-panel.compact .debug-header span {
  font-size: 0.9em;
  transition: transform 0.2s ease-in-out;
  color: #7b68ee;
}

.debug-panel.compact .debug-content {
  padding: 15px;
  border-top: none;
  transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out,
    padding 0.3s ease-in-out;
  overflow-x: hidden;
  max-height: 900px;
  opacity: 1;
  white-space: normal !important;
}

.debug-panel.compact .debug-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.debug-panel.compact .debug-header.open span {
  transform: rotate(180deg);
}

.debug-panel.compact .debug-item {
  margin-bottom: 8px;
  line-height: 1.4;
}

.debug-panel.compact .debug-item strong {
  color: #6a5acd;
  margin-right: 5px;
  font-size: 0.9em;
  font-weight: 500;
}

.debug-panel.compact .debug-item pre {
  background-color: #ffffff;
  border: 1px solid #e0e6ed;
  border-radius: 6px;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier,
    monospace;
  font-size: 0.8em;
  color: #6a5acd;
  margin-top: 4px;
}

.debug-panel.compact .debug-item.error {
  background-color: #ffebee;
  border-left: 4px solid #ef5350;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.debug-panel.compact .debug-item.error strong {
  color: #d32f2f;
}

.debug-panel.compact .debug-raw-content {
  background-color: #f8f9fa;
  border: 1px dashed #ced4da;
  border-radius: 6px;
  padding: 10px;
  margin-top: 15px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier,
    monospace;
  font-size: 0.75em;
  color: #8a2be2;
  white-space: pre-wrap;
  word-break: break-all;
}

.botmarkdown-list {
  padding-left: 20px;
  margin-bottom: 12px;
}

.botmarkdown-list-item {
  margin-bottom: 9px;
}

@media (max-width: 600px) {
  .chat-widget {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    border-radius: 0;
  }

  .chat-open-button {
    padding: 1rem !important;
    font-size: 1.3rem !important;
  }

  .chat-history {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  .chat-history::-webkit-scrollbar {
    display: none;
  }

  .chat-widget-btn,
  .chat-widget-btn.chat-widget-btn-secondary {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.3rem !important;
    padding: 0 !important;
  }

  .chat-widget-btn.confirm-yes,
  .chat-widget-btn.confirm-no {
    width: auto !important;
    height: auto !important;
    padding: 1rem 2rem !important;
    font-size: 1.1rem !important;
    flex: 1;
  }

  .chat-buttons {
    gap: 1rem;
    justify-content: center;
  }

  .chat-input {
    font-size: 1rem !important;
    padding: 1rem 1.25rem !important;
  }

  .chat-message {
    max-width: 90%;
    font-size: 1rem;
  }

  .chat-tooltips-container {
    position: fixed !important;
    bottom: 100px !important;
    left: 70% !important;
    margin-bottom: 0 !important;
    width: 25% !important;
    text-align: center;
  }

  .chat-tooltip {
    font-size: 0.75rem !important;
    padding: 0.3rem 0.5rem !important;
    white-space: normal !important;
    height: auto !important;
    max-width: 100% !important;
  }
}
