/* Chat Widget Styles */
/* CHAT ENABLED - Compact Design */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 340px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 40px);
  background: var(--card, rgba(20, 20, 25, 0.95));
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: translateY(0) scale(1);
  opacity: 1;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  visibility: visible;
}

.chat-widget.minimized {
  height: 60px;
  overflow: hidden;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-widget.hidden {
  transform: translateY(20px) scale(0.9);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-widget.opening {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* Chat Header - Compact */
.chat-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  background: var(--glass, rgba(255, 255, 255, 0.05));
  flex-shrink: 0;
  cursor: default;
}

.chat-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-icon {
  width: 16px;
  height: 16px;
  color: var(--primary, #6366f1);
  flex-shrink: 0;
}

.chat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg, #ffffff);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-action-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted, rgba(255, 255, 255, 0.6));
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg, #ffffff);
}

.chat-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Chat Body - Compact */
.chat-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

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

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

.chat-body::-webkit-scrollbar-thumb {
  background: var(--stroke, rgba(255, 255, 255, 0.2));
  border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
  background: var(--stroke, rgba(255, 255, 255, 0.3));
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: min-content;
}

/* Chat Message */
.chat-message {
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.3s ease-out;
}

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

.chat-message-user {
  align-items: flex-end;
}

.chat-message-assistant {
  align-items: flex-start;
}

.chat-message-content {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 8px;
  word-wrap: break-word;
}

.chat-message-user .chat-message-content {
  background: var(--primary, #6366f1);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-message-assistant .chat-message-content {
  background: var(--glass, rgba(255, 255, 255, 0.05));
  color: var(--fg, #ffffff);
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  border-bottom-left-radius: 4px;
}

.chat-message-text {
  font-size: 13px;
  line-height: 1.4;
  color: inherit;
}

.chat-message-text p {
  margin: 0 0 6px 0;
}

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

.chat-message-text ul,
.chat-message-text ol {
  margin: 6px 0;
  padding-left: 18px;
}

.chat-message-text li {
  margin: 3px 0;
}

.chat-suggestions {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
}

.chat-suggestions li {
  padding: 6px 10px;
  margin: 4px 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-suggestions li:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.chat-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  color: var(--muted, rgba(255, 255, 255, 0.6));
  font-size: 13px;
}

.chat-loading-dots {
  display: flex;
  gap: 4px;
}

.chat-loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted, rgba(255, 255, 255, 0.6));
  animation: chatBounce 1.4s infinite ease-in-out;
}

.chat-loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.chat-loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes chatBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat Input Area - Compact */
.chat-input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  background: var(--glass, rgba(255, 255, 255, 0.05));
  flex-shrink: 0;
}

.chat-input-container {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--card, rgba(20, 20, 25, 0.95));
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  border-radius: 8px;
  padding: 6px 10px;
  transition: all 0.2s;
}

.chat-input-container:focus-within {
  border-color: var(--primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg, #ffffff);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
  pointer-events: auto !important;
}

/* Ensure input is NEVER locked - override any lock state */
.chat-input:disabled,
.chat-input[disabled],
.chat-input[readonly] {
  pointer-events: auto !important;
  opacity: 1 !important;
  background: transparent !important;
}

.chat-input::placeholder {
  color: var(--muted, rgba(255, 255, 255, 0.4));
}

.chat-input::-webkit-scrollbar {
  width: 4px;
}

.chat-input::-webkit-scrollbar-thumb {
  background: var(--stroke, rgba(255, 255, 255, 0.2));
  border-radius: 2px;
}

.chat-send-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary, #6366f1);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--primary-hover, #818cf8);
  transform: scale(1.05);
}

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

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

.chat-send-btn svg {
  width: 14px;
  height: 14px;
}

/* Chat Toggle Button - Compact */
/* CHAT ENABLED */
.chat-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 0.75rem; /* rounded-xl to match header buttons */
  background: var(--primary, #6366f1);
  color: #ffffff;
  border: 1px solid var(--stroke, rgba(255, 255, 255, 0.1));
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(1);
  opacity: 1;
}

.chat-toggle-btn:hover {
  background: var(--primary-hover, #818cf8);
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
}

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

.chat-toggle-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-toggle-btn.hidden {
  transform: scale(0) rotate(180deg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-toggle-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--card, rgba(20, 20, 25, 0.95));
}

.chat-toggle-badge:empty {
  display: none;
}

/* Mobile Styles */
@media (max-width: 768px) {
  /* Disable chat completely on mobile */
  .chat-widget,
  .chat-toggle-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* Tablet Styles */
@media (min-width: 769px) and (max-width: 1024px) {
  .chat-widget {
    width: 320px;
    height: 500px;
  }
}

/* Dark mode compatibility */
[data-theme="dark"] .chat-widget {
  background: rgba(20, 20, 25, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .chat-widget {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chat-message-assistant .chat-message-content {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: #000000;
}

[data-theme="light"] .chat-input {
  color: #000000;
}

[data-theme="light"] .chat-title {
  color: #000000;
}

