:root {
  --bg-color: #ffffff;
  --text-color: #000000;
  --sidebar-bg: #f7f7f7;
  --user-message-bg: #f5f5f5;
  --input-bg: #f0f0f0;
  --ai-message-color: #000000;
  --border-color: #e0e0e0;
  --code-bg: #f6f6f6;
  --code-text: #333333;
  --input-border: #e0e0e0;
  --button-bg: #f0f0f0;
  --button-hover: #e0e0e0;
  --scrollbar-thumb: #c1c1c1;
  --scrollbar-track: #f1f1f1;
  --footer-bg: #f7f7f7;
  --link-color: #0066cc;
}

.dark {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --sidebar-bg: #252525;
  --user-message-bg: #2d2d2d;
  --ai-message-color: #e0e0e0;
  --border-color: #3d3d3d;
  --code-bg: #2d2d2d;
  --code-text: #e0e0e0;
  --input-bg: #252525;
  --input-border: #3d3d3d;
  --button-bg: #3d3d3d;
  --button-hover: #4d4d4d;
  --scrollbar-thumb: #555555;
  --scrollbar-track: #252525;
  --footer-bg: #252525;
  --link-color: #4d9eff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: system-ui, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
}

button, 
input[type="button"], 
input[type="submit"], 
input[type="reset"], 
a {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  outline: none !important;
}

button:focus, 
button:active,
input:focus,
input:active,
a:focus,
a:active {
  outline: none !important;
  box-shadow: none !important;
}

.app-container {
  display: flex;
  height: 100%;
  position: relative;
}

.intro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.intro-overlay.fade-out {
  opacity: 0;
}
    
.intro-gif {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
 }
    
.intro-gif::selection {
  background: transparent;
 }

.blur-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10;
  display: none;
}

.search-animation {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 0;
  padding: 20px;
  background: rgba(54, 54, 54, 0.05);
  border: 1px solid rgba(71, 71, 71, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.search-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.search-icon {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #929292, #333333);
  color: white;
  animation: searchPulse 2s ease-in-out infinite;
}

.search-icon i {
  font-size: 18px;
  animation: searchRotate 3s linear infinite;
}

.search-text {
  font-size: 14px;
  font-weight: 500;
  color: #363636;
  text-align: center;
  margin: 0;
}

.search-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.search-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2b2b2b;
  animation: searchDots 1.5s ease-in-out infinite;
}

.search-dots span:nth-child(1) {
  animation-delay: 0s;
}

.search-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.search-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes searchPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(22, 22, 22, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(36, 36, 36, 0);
  }
}

@keyframes searchRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes searchDots {
  0%, 20%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.dark-theme .search-animation {
  background: rgba(44, 44, 44, 0.08);
  border-color: rgba(68, 68, 68, 0.15);
}

.dark-theme .search-text {
  color: #aaaaaa;
}

.dark-theme .search-dots span {
  background: #636363;
}

@media (max-width: 768px) {
  .search-animation {
    margin: 10px 0;
    padding: 15px;
  }
  
  .search-container {
    gap: 12px;
  }
  
  .search-icon {
    width: 35px;
    height: 35px;
  }
  
  .search-icon i {
    font-size: 16px;
  }
  
  .search-text {
    font-size: 13px;
  }
  
  .search-dots span {
    width: 5px;
    height: 5px;
  }
}

.blur-overlay.active {
  display: block;
}

.sidebar {
  width: 250px;
  height: 100%;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  z-index: 20;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}


.sidebar.active {
  transform: translateX(0);
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

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

.logo img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.logo h1 {
  font-size: 16px;
  font-weight: 600;
}

.powered-by {
  font-size: 12px;
  color: var(--text-color);
  opacity: 0.6;
}

.sidebar-menu {
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--text-color);
  gap: 12px;
}

.menu-item.active {
  background-color: var(--button-bg);
}

.menu-item .icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-item .text h3 {
  font-size: 14px;
  font-weight: 500;
}

.menu-item .text p {
  font-size: 12px;
  opacity: 0.7;
}

.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-section {
  flex: 1;
  overflow: hidden;
}

.history-list-container {
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none; 
}

.history-list-container::-webkit-scrollbar {
  display: none;
}

.history-list-container::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 3px;
}

.history-list-container::-webkit-scrollbar-track {
  background-color: var(--scrollbar-track);
}

.history-list {
  padding: 8px;
}

.history-item {
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
}

.history-item:hover {
  background-color: var(--button-bg);
}

.history-item.active {
  background-color: var(--button-hover);
}

.history-item-title {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-time {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 4px;
}

.history-empty, .history-error {
  padding: 16px;
  text-align: center;
  font-size: 14px;
  opacity: 0.7;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background-color: var(--footer-bg);
}

.user-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--button-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.user-info {
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 12px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer-actions-inline {
  position: relative;
}

.footer-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background-color: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
}

.footer-btn:hover {
  background-color: var(--button-bg);
}

.footer-menu {
  position: absolute;
  bottom: 40px;
  right: 0;
  background-color: var(--sidebar-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px 0;
  min-width: 180px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
  z-index: 30;
}

.footer-menu.active {
  display: block;
}

.footer-menu-item {
  width: 100%;
  padding: 8px 16px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-menu-item:hover {
  background-color: var(--button-bg);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-header {
  height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bg-color);
  position: sticky;
  top: 0;
  background-color: var(--bg-color);
  z-index: 5;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-button {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background-color: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
}

.menu-button:hover {
  background-color: var(--button-bg);
}

.chat-title {
  font-size: 16px;
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: none;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.chat-messages::-webkit-scrollbar {
  display: none;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-track {
  background-color: var(--scrollbar-track);
}

.welcome-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 0;
  text-align: center;
}

.welcome-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
}

.welcome-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 16px;
}

.welcome-subtitle {
  font-size: 16px;
  opacity: 0.8;
  max-width: 600px;
  margin: 0 auto;
}

@keyframes typing-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.message {
  margin-bottom: 24px;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  opacity: 0;
}

.message.ai {
  align-self: flex-start;
  margin-left: 0;
  margin-right: auto;
  overflow: hidden;
  opacity: 1;
}

.message.ai.typing .ai-message-text {
  position: relative;
}

.typing-cursor {
  display: none;
  width: 2px;
  height: 1.2em;
  background-color: var(--text-color);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: typing-cursor 0.2 infinite;
}

.message-time {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 8px;
  transition: opacity 0.3s ease;
}

.message-time.hidden {
  opacity: 0;
}

.code-block-typing {
  overflow: hidden;
}

[dir="rtl"] .message.ai {
  align-self: flex-end;
  margin-left: auto;
  margin-right: 0;
}

.message.user {
  align-self: flex-end;
  margin-inline-start: auto;
  margin-inline-end: 0;
  width: fit-content;
  min-width: 0;
  padding: 12px 16px;
  background-color: var(--user-message-bg);
  border-radius: 16px;
  text-align: start;
  position: relative;
  unicode-bidi: plaintext;
  opacity: 1;
}

[dir="rtl"] .message.user {
  border-start-end-radius: 0;
}

.message.user .message-image-preview {
  max-width: 300px;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
  margin-bottom: 8px;
}

.message.user .message-image-preview img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
}

.image-generation-container {
  width: 100%;
  max-width: 512px;
  margin: 16px auto;
  position: relative;
}

.image-generation-animation {
  width: 100%;
  aspect-ratio: 1/1;
  background: #f5f5f5;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.image-generation-svg {
  width: 30%;
  height: 30%;
  animation: pulse 2s infinite ease-in-out;
  color: #c0c0c0;
}

.image-generation-gradient {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
              rgba(255,255,255,0) 0%, 
              rgba(255,255,255,0.8) 50%, 
              rgba(255,255,255,0) 100%);
  animation: sweep 2.5s infinite ease-in-out;
}

.image-generation-text-container {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.image-generation-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-color);
  position: relative;
  z-index: 1;
}

.image-generation-text-gradient {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg, 
    rgba(255,255,255,0) 0%, 
    rgba(255,255,255,0.8) 50%, 
    rgba(255,255,255,0) 100%
  );
  animation: sweep 2.5s infinite ease-in-out;
  z-index: 2;
}

@keyframes sweep {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes sweep {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes pulse {
  0%, 100% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1); opacity: 1; }
}

.image-generation-text {
  text-align: center;
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-color);
  opacity: 0.8;
}

.dark .image-generation-animation {
  background: #2d2d2d;
}

.dark .image-generation-gradient {
  background: linear-gradient(90deg, 
              rgba(0,0,0,0) 0%, 
              rgba(0,0,0,0.8) 50%, 
              rgba(0,0,0,0) 100%);
}

.message-content {
  position: relative;
  width: 100%;
}

.message-text {
  unicode-bidi: plaintext;
  text-align: start;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.ai-message-text {
  background-color: transparent;
  border-radius: 8px;
  word-wrap: break-word;
  unicode-bidi: plaintext;
  text-align: start;
}

.ai-message-text.streaming-mixed {
  direction: ltr !important;
  text-align: left !important;
}

.ai-message-text .text-segment {
  display: inline;
  unicode-bidi: isolate;
}

.ai-message-text .text-segment.rtl {
  direction: rtl;
  text-align: right;
}

.ai-message-text .text-segment.ltr {
  direction: ltr;
  text-align: left;
}

.ai-message-text h1,
.ai-message-text h2,
.ai-message-text h3,
.ai-message-text h4,
.ai-message-text h5,
.ai-message-text h6 {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: isolate;
}

.ai-message-text pre,
.ai-message-text code {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: isolate;
}

.ai-message-text ul,
.ai-message-text ol {
  unicode-bidi: plaintext;
  text-align: start;
}

.ai-message-text li {
  unicode-bidi: isolate;
  text-align: start;
}

.message-time {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 8px;
}

.typing-indicator {
  display: flex;
  gap: 8px;
  padding: 16px;
  max-width: 800px;
  margin: 0 auto 24px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-color);
  opacity: 0.6;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

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

.code-block-container {
  position: relative;
  margin: 16px 0;
}

.code-block-container pre {
  margin: 0;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background-color: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.2s ease;
  z-index: 10;
  color: var(--text-color);
}

.dark .copy-code-btn {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.copy-code-btn:hover {
  background-color: rgba(0, 0, 0, 0.2);
  opacity: 1 !important;
}

.dark .copy-code-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Hide copy button during streaming */
.code-block-streaming .copy-code-btn {
  opacity: 0;
  pointer-events: none;
}

/* Show copy button after streaming is complete */
.code-block-container:not(.code-block-streaming) .copy-code-btn {
  opacity: 0.7;
  pointer-events: all;
}

.code-block-container:hover .copy-code-btn {
  opacity: 1;
}

.copy-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.copy-code-btn.copied {
  background-color: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.copy-code-btn.copied:hover {
  background-color: rgba(34, 197, 94, 0.3);
}

.copy-code-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--sidebar-bg);
  color: var(--text-color);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  border: 1px solid var(--border-color);
  z-index: 20;
}

.copy-code-btn:hover::after {
  opacity: 1;
}

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 0.8; }
}

.chat-input {
  padding: 16px;
  border-top: 1px solid var(--input-bg);
  background-color: transparent;
  position: sticky;
  bottom: 0;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.image-preview-container {
  position: relative;
  margin-bottom: 12px;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-loading {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-success {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background-color: rgba(46, 204, 113, 0.9);
  color: white;
  font-size: 12px;
  padding: 4px;
  border-radius: 4px;
  text-align: center;
  animation: fadeInUp 0.3s ease-out;
}

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

.generated-image-container {
  width: 100%;
  max-width: 512px;
  margin: 0 auto;
}

.generated-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.image-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
  gap: 8px;
}

.image-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background-color: var(--button-bg);
  border: none;
  border-radius: 4px;
  color: var(--text-color);
  cursor: pointer;
  font-size: 14px;
}

.image-action-btn:hover {
  background-color: var(--button-hover);
}

.remove-image-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.6);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.input-container {
  position: relative;
  border-radius: 24px;
  background-color: var(--input-bg);
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.input-field-container {
  padding: 12px 16px;
  flex: 1;
}

textarea {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  color: var(--text-color);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  max-height: 200px;
  min-height: 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

textarea::-webkit-scrollbar {
  width: 6px;
}

textarea::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 3px;
}

textarea::-webkit-scrollbar-track {
  background-color: var(--scrollbar-track);
}

.input-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--input-bg);
}

.tools-left {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tools-right {
  display: flex;
  align-items: center;
}

.tools-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f5f5f5;
  border: 1px solid #666666;
  color: #333333;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}


.tools-btn:hover {
  background: #e8e8e8;
  border-color: #555555;
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 36px;
  background-color: var(--text-color);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-color);
}

.send-btn:hover {
  opacity: 0.8;
}

.tooltip {
  position: relative;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: var(--sidebar-bg);
  color: var(--text-color);
  text-align: center;
  border-radius: 4px;
  padding: 4px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
  border: 1px solid var(--border-color);
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

.markdown-content {
  line-height: 1.6;
}

.markdown-content p {
  margin-bottom: 16px;
}

.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
  margin: 24px 0 16px;
  font-weight: 600;
}

.markdown-content h1 {
  font-size: 24px;
}

.markdown-content h2 {
  font-size: 20px;
}

.markdown-content h3 {
  font-size: 18px;
}

.markdown-content h4 {
  font-size: 16px;
}

.markdown-content h5 {
  font-size: 14px;
}

.markdown-content h6 {
  font-size: 12px;
}

.markdown-content blockquote {
  border-left: 3px solid var(--border-color);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-color);
  opacity: 0.8;
}

.markdown-content pre {
  background-color: var(--code-bg);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}

pre {
  direction: ltr !important;
  text-align: left !important;
}

pre code {
  display: block;
  overflow-x: auto;
  padding: 1em;
}

.code-line {
  opacity: 0;
  animation: fadeIn 0.1s ease forwards;
  font-family: monospace;
  white-space: pre;
}

.markdown-content code {
  font-family: monospace;
  background-color: var(--code-bg);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 14px;
}

.markdown-content pre code {
  padding: 0;
  background: transparent;
}

.code-block-typing {
  overflow: hidden;
}

.code-line-typing {
  opacity: 0;
  animation: fadeInLine 0.1s ease forwards;
  white-space: pre;
  display: block;
}

@keyframes fadeInLine {
  from { opacity: 0; }
  to { opacity: 1; }
}

.typing-cursor {
  display: none;
  width: 2px;
  height: 1.2em;
  background-color: var(--text-color);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: typing-cursor 1s infinite;
}

.message.ai.typing .typing-cursor {
  display: none;
}

.markdown-content ul, 
.markdown-content ol {
  margin: 16px 0;
  padding-left: 24px;
  unicode-bidi: plaintext;
  text-align: start;
  direction: ltr;
}

.markdown-content li {
  margin-bottom: 8px;
  unicode-bidi: plaintext;
  text-align: start;
  position: relative;
}

.markdown-content ul ul,
.markdown-content ul ol,
.markdown-content ol ul,
.markdown-content ol ol {
  margin: 8px 0;
}

.markdown-content ul {
  list-style-type: disc;
}

.markdown-content ul ul {
  list-style-type: circle;
}

.markdown-content ul ul ul {
  list-style-type: square;
}

.markdown-content ol {
  list-style-type: decimal;
}

.markdown-content ol ol {
  list-style-type: lower-alpha;
}

.markdown-content ol ol ol {
  list-style-type: lower-roman;
}

.markdown-content a {
  color: var(--link-color);
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content strong {
  font-weight: 600;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content u {
  text-decoration: underline;
}

.markdown-content del {
  text-decoration: line-through;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 24px 0;
}

.table-container {
  overflow-x: auto;
  margin: 16px 0;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
}

.link-preview {
  max-width: 100%;
  margin: 12px 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.link-preview-content {
  padding: 12px;
}

.link-preview-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-color);
}

.link-preview-description {
  font-size: 14px;
  color: var(--text-color);
  opacity: 0.8;
  margin-bottom: 8px;
  display: -webkit-box;
  display: box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  box-orient: vertical;
  overflow: hidden;
}

.link-preview-url {
  font-size: 12px;
  color: var(--text-color);
  opacity: 0.6;
  display: flex;
  align-items: center;
  gap: 4px;
}

.link-preview-url i {
  font-size: 14px;
}

.link-preview-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.markdown-content th, 
.markdown-content td {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
}

.markdown-content th {
  background-color: var(--button-bg);
  font-weight: 600;
  text-align: left;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--text-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.code-line-streaming {
  opacity: 1 !important;
  animation: none !important;
}

.code-line-streaming.hljs-keyword { color: #c678dd; }
.code-line-streaming.hljs-string { color: #98c379; }
.code-line-streaming.hljs-number { color: #d19a66; }
.code-line-streaming.hljs-comment { color: #5c6370; font-style: italic; }
.code-line-streaming.hljs-function { color: #61afef; }
.code-line-streaming.hljs-variable { color: #e06c75; }
.code-line-streaming.hljs-built_in { color: #e6c07b; }
.code-line-streaming.hljs-operator { color: #56b6c2; }
.code-line-streaming.hljs-punctuation { color: #abb2bf; }

.send-btn.skip-mode {
  background-color: #e74c3c;
}

.send-btn.skip-mode:hover {
  background-color: #c0392b;
}

.input-container.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.input-container.disabled textarea {
  cursor: not-allowed;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none;
}

.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-streaming {
  font-family: 'Courier New', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}

.code-streaming .hljs {
  background: transparent !important;
}

.code-streaming .hljs-keyword { 
  color: #c678dd; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-string { 
  color: #98c379; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-number { 
  color: #d19a66; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-comment { 
  color: #5c6370; 
  font-style: italic;
  transition: color 0.1s ease;
}

.code-streaming .hljs-function { 
  color: #61afef; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-variable { 
  color: #e06c75; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-built_in { 
  color: #e6c07b; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-operator { 
  color: #56b6c2; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-punctuation { 
  color: #abb2bf; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-attr { 
  color: #d19a66; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-tag { 
  color: #e06c75; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-name { 
  color: #e06c75; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-selector-tag { 
  color: #e06c75; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-selector-class { 
  color: #d19a66; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-selector-id { 
  color: #61afef; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-property { 
  color: #56b6c2; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-value { 
  color: #98c379; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-meta { 
  color: #c678dd; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-title { 
  color: #61afef; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-literal { 
  color: #56b6c2; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-regexp { 
  color: #98c379; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-deletion { 
  color: #e06c75; 
  transition: color 0.1s ease;
}

.code-streaming .hljs-addition { 
  color: #98c379; 
  transition: color 0.1s ease;
}

.code-streaming-cursor {
  display: none;
  width: 2px;
  height: 1.2em;
  background-color: var(--text-color);
  animation: code-cursor-blink 1s infinite;
  margin-left: 1px;
  vertical-align: text-bottom;
}

@keyframes code-cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.auth-popup {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.auth-popup.active {
  transform: translateY(0);
}

.auth-popup-content {
  background-color: var(--bg-color);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 24px;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.auth-popup-header {
  text-align: center;
  margin-bottom: 20px;
}

.auth-logo {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  border-radius: 8px;
}

.auth-popup-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-color);
}

.auth-popup-header p {
  font-size: 14px;
  color: var(--text-color);
  opacity: 0.7;
}

.auth-popup-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-popup-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.auth-popup-btn.login {
  background-color: var(--text-color);
  color: var(--bg-color);
  border: none;
}

.auth-popup-btn.login:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.auth-popup-btn.register {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.auth-popup-btn.register:hover {
  background-color: var(--input-bg);
  transform: translateY(-1px);
}

.auth-popup-footer {
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.auth-popup-footer p {
  font-size: 12px;
  color: var(--text-color);
  opacity: 0.6;
  line-height: 1.4;
}

.auth-popup-footer a {
  color: var(--text-color);
  text-decoration: underline;
}

.history-auth-prompt {
  padding: 24px 16px;
  text-align: center;
}

.history-auth-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-color);
  opacity: 0.6;
}

.history-auth-prompt h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-color);
}

.history-auth-prompt p {
  font-size: 14px;
  color: var(--text-color);
  opacity: 0.7;
  margin-bottom: 16px;
}

.history-signin-btn {
  background-color: var(--text-color);
  color: var(--bg-color);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.history-signin-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.auth-prompt {
  display: flex;
  gap: 8px;
}

.auth-prompt-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-prompt-btn.signin {
  background-color: var(--text-color);
  color: var(--bg-color);
  border: none;
}

.auth-prompt-btn.signin:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.auth-prompt-btn.signup {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.auth-prompt-btn.signup:hover {
  background-color: var(--input-bg);
  transform: translateY(-1px);
}

.blur-overlay.active {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}


@media (min-width: 768px) {
  .sidebar {
    position: relative;
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-button {
    display: none;
  }

  .blur-overlay {
    display: none;
  }

  .message.user {
    max-width: 70%;
  }

  .chat-input {
    padding: 16px;
  }
  
  .chat-messages {
    padding: 16px 32px;
  }
}

@media (max-width: 767px) {
  .app-container {
    flex-direction: column;
  }
  .copy-code-btn {
    opacity: 0.7;
  }
  
  .copy-code-btn::after {
    display: none;
  }

  .sidebar {
    width: 80%;
    height: 100%;
    z-index: 100;
  }

  .main-content {
    margin-left: 0;
  }

  .message.user {
    max-width: 80%;
  }
  
  .link-preview {
    flex-direction: row;
  }
  
  .link-preview-image {
    width: 160px;
    height: auto;
  }

  .chat-input {
    padding: 16px;
    border-top: 1px solid var(--input-bg);
    background-color: var(--input-bg);
    border-radius: 30px 30px 0 0;
    position: sticky;
    bottom: 0;
    max-width: none;
    margin: 0;
  }

  .input-container {
    border-radius: 8px;
    margin-bottom: 0;
  }
  
  .chat-messages {
    max-width: none;
    margin: 0;
  }
    
  .auth-popup-content {
    padding: 20px;
    margin: 0;
    border-radius: 16px 16px 0 0;
  }
  
  .auth-popup-header h3 {
    font-size: 16px;
  }
  
  .auth-popup-buttons {
    flex-direction: column;
  }
  
  .history-auth-prompt {
    padding: 16px;
  }
  
  .history-auth-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
  }
  
  .history-auth-prompt h3 {
    font-size: 14px;
  }
  
  .history-auth-prompt p {
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .generated-image-container {
    max-width: 100%;
    padding: 0 16px;
  }
  
  .message.user .message-image-preview {

    max-width: 200px;
     }
  .message.user .message-image-preview img {

    max-height: 200px;

  }
}

.scraped-images {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.scraped-image {
  width: 120px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.scraped-image:hover {
  border-color: #000000;
  transform: scale(1.02);
}

.sources-container {
  margin: 15px 0 10px 0;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #000000;
}

.sources-header {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  max-width: 200px;
}

.source-item:hover {
  background: #f0f7ff;
  border-color: #000000;
  transform: translateY(-1px);
}

.source-icon {
  width: 16px;
  height: 16px;
  background: #474747;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 8px;
  flex-shrink: 0;
}

.source-domain {
  color: #666;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.source-modal-overlay.active {
  display: flex;
}

.source-modal {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.source-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.source-modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
}

.source-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  padding: 5px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.source-modal-close:hover {
  background: #f0f0f0;
}

.source-modal-content {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-source-item {
  display: block;
  padding: 15px;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.modal-source-item:hover {
  border-color: #000000;
  background: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-source-title {
  font-weight: 600;
  color: #000000;
  margin-bottom: 5px;
  font-size: 15px;
  line-height: 1.3;
}

.modal-source-description {
  color: #666;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 5px;
}

.modal-source-url {
  color: #999;
  font-size: 11px;
  word-break: break-all;
}

@media (max-width: 768px) {
  .source-modal {
    margin: 10px;
    max-height: 90vh;
  }
  
  .scraped-image {
    width: 100px;
    height: 66px;
  }
  
  .sources-list {
    flex-direction: column;
  }
  
  .source-item {
    max-width: none;
  }
}


.tools-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  padding: 8px;
  min-width: 200px;
  z-index: 1000;
  display: none;
  margin-bottom: 8px;
  opacity: 1;
}

.tools-dropdown-item {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  color: #374151;
}

.tools-dropdown-item:hover {
  background-color: #f3f4f6;
}

.tools-dropdown-item.active {
  background-color: #f0f9ff;
  color: #027ddb;
  border: 1px solid #027ddb;
}

.tools-dropdown-item i {
  width: 16px;
  text-align: center;
  font-size: 14px;
}

.active-tool-label {
  background: transparent;
  color: #027ddb;
  padding: 6px 12px;
  border: 1px solid #027ddb;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  margin-left: 8px;
}

.tools-left {
  position: relative;
}
