:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #0f0f1a;
  --bg-tertiary: #151522;
  --card: #1a1a2e;
  --card-hover: #23233d;
  --accent-blue: #2563eb;
  --accent-blue-light: #3b82f6;
  --accent-blue-dark: #1e40af;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-glow: rgba(37, 99, 235, 0.4);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #2d3748;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(37, 99, 235, 0.3);
  --border-radius: 20px;
  --transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Vazirmatn', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.bg-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: 
    radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
    linear-gradient(135deg, #0a0a12 0%, #0f0f1a 50%, #151522 100%);
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
  opacity: 0;
  animation: float 25s infinite linear;
}

.particle:nth-child(2n) {
  background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
}

.particle:nth-child(3n) {
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
}

@keyframes float {
  0% {
    opacity: 0;
    transform: translateY(100vh) translateX(0) rotate(0deg);
  }
  10% {
    opacity: 0.7;
  }
  90% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
    transform: translateY(-100px) translateX(100px) rotate(360deg);
  }
}

.grid-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(37, 99, 235, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
  z-index: -1;
}

@keyframes gridMove {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(50px, 50px);
  }
}

.header {
  background: rgba(15, 15, 26, 0.9);
  backdrop-filter: blur(20px);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
  animation: headerSlide 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes headerSlide {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  box-shadow: 0 0 30px var(--accent-glow);
  animation: pulse 3s infinite, rotate 10s infinite linear;
  position: relative;
  overflow: hidden;
}

.logo-icon::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 20px var(--accent-glow);
  }
  50% {
    box-shadow: 0 0 40px var(--accent-glow), 0 0 60px rgba(37, 99, 235, 0.2);
  }
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.logo-text {
  font-weight: 700;
  font-size: 24px;
  background: linear-gradient(to right, var(--accent-blue-light), var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(37, 99, 235, 0.3);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 14px;
  color: var(--text-secondary);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 2px solid var(--accent-blue);
  box-shadow: 0 0 15px var(--accent-glow);
  transition: var(--transition);
}

.user-avatar:hover {
  transform: scale(1.1) rotate(5deg);
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#chat {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-blue) transparent;
}

#chat::-webkit-scrollbar {
  width: 10px;
}

#chat::-webkit-scrollbar-track {
  background: transparent;
}

#chat::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, var(--accent-blue), var(--accent-purple));
  border-radius: 10px;
  border: 2px solid var(--bg-primary);
}

.message-container {
  display: flex;
  margin: 25px 0;
  animation: messageAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes messageAppear {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message-container.user {
  flex-direction: row-reverse;
}

.avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin: 0 15px;
  flex-shrink: 0;
  background: var(--card);
  border: 2px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.avatar:hover {
  transform: scale(1.05);
}

.solo-avatar {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-color: transparent;
  position: relative;
}

.solo-avatar::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple), var(--accent-cyan));
  border-radius: 50%;
  z-index: -1;
  animation: rotate 3s linear infinite;
}

.solo-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-avatar {
  background: var(--bg-tertiary);
  border-color: var(--accent-blue);
}

.message-content {
  max-width: 70%;
  display: flex;
  flex-direction: column;
}

.message-container.user .message-content {
  align-items: flex-end;
}

.message-bubble {
  padding: 20px 25px;
  border-radius: var(--border-radius);
  line-height: 1.7;
  word-wrap: break-word;
  box-shadow: var(--shadow);
  position: relative;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.message-bubble:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-glow);
}

.solo-bubble {
  background: rgba(26, 26, 46, 0.8);
  border-top-right-radius: 5px;
  color: var(--text-primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.user-bubble {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-dark));
  border-top-left-radius: 5px;
  color: white;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.message-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  opacity: 0.8;
  text-align: left;
}

.code-block {
  background: #1e1e2e;
  border-radius: 12px;
  margin: 15px 0;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid #2a2a3a;
  direction: ltr;
  text-align: left;
}

.code-header {
  background: #2a2a3a;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #3a3a4a;
  direction: rtl;
}

.code-language {
  color: var(--accent-cyan);
  font-size: 14px;
  font-weight: 600;
}

.code-copy {
  background: transparent;
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue-light);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
  font-family: 'Vazirmatn', sans-serif;
}

.code-copy:hover {
  background: var(--accent-blue);
  color: white;
}

.code-content {
  padding: 20px;
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  direction: ltr;
  text-align: left;
  white-space: pre;
}

.keyword { color: #ff79c6; font-weight: bold; }
.type { color: #8be9fd; font-weight: bold; }
.string { color: #f1fa8c; }
.comment { color: #6272a4; font-style: italic; }
.method { color: #50fa7b; }
.annotation { color: #ffb86c; }
.number { color: #bd93f9; }
.operator { color: #f8f8f2; }

.input-area {
  padding: 10px;
  background: rgba(15, 15, 26, 0.9);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  position: relative;
  z-index: 10;
  animation: inputSlide 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes inputSlide {
  0% {
    transform: translateY(100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.input-container {
  flex: 1;
  position: relative;
}

#input {
  width: 95%;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: rgba(26, 26, 46, 0.6);
  color: var(--text-primary);
  font-size: 16px;
  font-family: 'Vazirmatn', sans-serif;
  transition: var(--transition);
  backdrop-filter: blur(10px);
  direction: rtl;
}


#input {
  resize: none;
  min-height: 30px;
  max-height: 200px;
  overflow-y: auto;
  padding: 18px 25px;
  line-height: 1.6;
}

.code-block {
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  background: #1e1e2e;
}

.code-block code {
  display: block;
  padding: 20px;
  font-size: 14px;
  line-height: 1.6;
  direction: ltr;
  text-align: left;
  white-space: pre;
  background: transparent !important;
}

pre {
  margin: 0 !important;
  background: transparent !important;
}

#input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow);
  background: rgba(26, 26, 46, 0.8);
}

#input::placeholder {
  color: var(--text-muted);
}

#send {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  color: white;
  box-shadow: 0 5px 20px var(--accent-glow);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#send::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
}

#send:hover {
  transform: scale(1.1) rotate(10deg);
  box-shadow: 0 8px 25px var(--accent-glow), 0 0 30px rgba(37, 99, 235, 0.4);
}

#send:hover::before {
  animation: sendShine 0.8s;
}

@keyframes sendShine {
  100% {
    transform: translateX(100%);
  }
}

#send:active {
  transform: scale(0.95);
}

#typing {
  padding: 15px 25px;
  color: var(--accent-blue-light);
  font-size: 14px;
  display: none;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.3s;
  background: rgba(15, 15, 26, 0.5);
  backdrop-filter: blur(10px);
  direction: rtl;
}

.typing-dots {
  display: flex;
  gap: 5px;
}

.typing-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-blue);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.special-effect {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
  opacity: 0;
  animation: bubbleFloat 4s ease-in-out forwards;
}

@keyframes bubbleFloat {
  0% {
    opacity: 0.7;
    transform: translateY(0) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translateY(-100px) scale(1.2);
  }
}

@media (max-width: 768px) {
  .header {
    padding: 15px 20px;
  }

  .logo-text {
    font-size: 20px;
  }

  .logo-icon {
    width: 45px;
    height: 45px;
    font-size: 20px;
  }

  .message-content {
    max-width: 75%;
  }

  #input {
    padding: 18px 22px;
  }

  #send {
    width: 55px;
    height: 55px;
    font-size: 20px;
  }

  .avatar {
    width: 45px;
    height: 45px;
    font-size: 18px;
    margin: 0 12px;
  }
  
  .code-content {
    font-size: 13px;
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 12px 15px;
  }

  .logo-text {
    font-size: 18px;
  }

  #chat {
    padding: 20px;
  }

  .input-area {
    padding: 20px;
  }

  .message-content {
    max-width: 80%;
  }

  .message-bubble {
    padding: 18px 22px;
  }

  .code-content {
    padding: 12px;
    font-size: 12px;
  }
  
  .code-header {
    padding: 10px 15px;
  }
}

.aurora-bg {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #0f0f1a 100%);
  overflow: hidden;
  z-index: -2;
}

.aurora-bg::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(139, 92, 246, 0.15), transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(6, 182, 212, 0.12), transparent 50%),
              radial-gradient(circle at 50% 80%, rgba(37, 99, 235, 0.18), transparent 50%);
  animation: aurora 25s infinite linear;
}

@keyframes aurora {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(10%, 10%) rotate(360deg); }
}

.stars {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1;
}

.star {
  position: absolute;
  width: 2px; height: 2px;
  background: white;
  border-radius: 50%;
  opacity: 0;
  animation: twinkle 6s infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}

.code-block {
  margin: 16px 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
  background: #1e1e2e;
  direction: ltr;
}

.code-header {
  background: #2a2a3c;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.code-lang {
  color: #8be9fd;
  font-weight: 600;
  text-transform: uppercase;
}

.copy-btn {
  background: transparent;
  border: 1px solid #444;
  color: #bbb;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

.copy-btn:hover {
  background: #444;
  color: white;
}

pre {
  margin: 0 !important;
  background: transparent !important;
}

.code-block code {
  padding: 20px !important;
  font-size: 14px;
  line-height: 1.7;
}

#bgAnimation {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.6) 0%, transparent 70%);
  filter: blur(1px);
  animation: float 35s infinite linear;
  opacity: 0;
}

.particle:nth-child(odd) {
  background: radial-gradient(circle, rgba(6,182,212,0.6) 0%, transparent 70%);
}

.particle:nth-child(3n) {
  background: radial-gradient(circle, rgba(37,99,235,0.6) 0%, transparent 70%);
}

@keyframes float {
  0% { transform: translateY(100vh) scale(0.4); opacity: 0; }
  15% { opacity: 0.6; }
  85% { opacity: 0.6; }
  100% { transform: translateY(-100px) scale(1); opacity: 0; }
}

.code-block {
  margin: 16px 0;
  border-radius: 14px;
  overflow: hidden;
  background: #1e1e2e;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
  direction: ltr;
}

.code-header {
  background: #2a2a3c;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.lang {
  color: #8be9fd;
  font-weight: 600;
  letter-spacing: 1px;
}

.copy-btn {
  background: transparent;
  border: none;
  color: #aaa;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.3s;
  font-size: 15px;
}

.copy-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

pre { margin: 0; }
.code-block code {
  display: block;
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
}