/* ==================== FONTS & RESET ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Dark Theme */
  --bg-primary: #0a0e27;
  --bg-secondary: #141B3B;
  --bg-chat: #1a1f3a;
  --bg-message-user: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-message-bot: #242b4a;
  --text-primary: #ffffff;
  --text-secondary: #a8b2d1;
  --accent: #00d4ff;
  --accent-glow: rgba(0, 212, 255, 0.4);
  --border: rgba(255, 255, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-chat: #f8fafc;
  --bg-message-user: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-message-bot: #e2e8f0;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --accent: #3182ce;
  --accent-glow: rgba(49, 130, 206, 0.3);
  --border: rgba(0, 0, 0, 0.1);
  --shadow: rgba(0, 0, 0, 0.1);
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* ==================== BACKGROUND ANIMATION ==================== */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.cube {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent);
  background: rgba(0, 212, 255, 0.05);
  animation: float 20s infinite ease-in-out;
  opacity: 0.3;
}

.cube:nth-child(1) {
  top: 10%;
  left: 10%;
  animation-delay: 0s;
  animation-duration: 15s;
}

.cube:nth-child(2) {
  top: 70%;
  left: 80%;
  animation-delay: 2s;
  animation-duration: 18s;
}

.cube:nth-child(3) {
  top: 40%;
  left: 60%;
  animation-delay: 4s;
  animation-duration: 22s;
}

.cube:nth-child(4) {
  top: 80%;
  left: 20%;
  animation-delay: 6s;
  animation-duration: 20s;
}

.cube:nth-child(5) {
  top: 20%;
  left: 70%;
  animation-delay: 3s;
  animation-duration: 17s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(50px, -50px) rotate(90deg);
  }
  50% {
    transform: translate(-30px, 30px) rotate(180deg);
  }
  75% {
    transform: translate(-50px, -30px) rotate(270deg);
  }
}

/* ==================== CHAT CONTAINER ==================== */
.chat-container {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 900px;
  height: 90vh;
  background: var(--bg-secondary);
  border-radius: 24px;
  box-shadow: 
    0 20px 60px var(--shadow),
    0 0 40px var(--accent-glow),
    inset 0 0 20px rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

/* ==================== HEADER ==================== */
.chat-header {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-chat));
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px var(--shadow);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.ai-orb {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff, #667eea);
  box-shadow: 
    0 0 30px var(--accent-glow),
    inset 0 0 20px rgba(255, 255, 255, 0.3);
  animation: pulse-glow 3s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 30px var(--accent-glow);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 50px var(--accent-glow);
  }
}

.logo-section h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #00d4ff, #667eea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px var(--accent-glow);
}

.ai-text {
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

.controls {
  display: flex;
  gap: 10px;
}

.control-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-chat);
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px var(--accent-glow);
}

.control-btn.danger:hover {
  background: #ff4757;
  color: white;
  box-shadow: 0 8px 20px rgba(255, 71, 87, 0.4);
}

/* ==================== CHATBOX ==================== */
#chatbox {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
  background: var(--bg-chat);
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-secondary);
}

#chatbox::-webkit-scrollbar {
  width: 8px;
}

#chatbox::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 10px;
}

#chatbox::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Welcome Message */
.welcome-message {
  text-align: center;
  padding: 60px 20px;
  animation: fadeIn 1s ease-in;
}

.welcome-icon {
  font-size: 80px;
  margin-bottom: 20px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.welcome-message h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 32px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--accent), #667eea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-message p {
  color: var(--text-secondary);
  font-size: 18px;
  margin-bottom: 30px;
}

.feature-chips {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.chip {
  padding: 10px 20px;
  background: var(--bg-message-bot);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip i {
  color: var(--accent);
}

/* Messages */
.message {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.user-message .avatar {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.bot-message .avatar {
  background: linear-gradient(135deg, #00d4ff, #0099ff);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.message-content {
  flex: 1;
  max-width: 75%;
}

.user-message .message-content {
  margin-left: auto;
}

.text {
  padding: 15px 20px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.6;
  word-wrap: break-word;
}

.user-message .text {
  background: var(--bg-message-user);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.bot-message .text {
  background: var(--bg-message-bot);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.text strong {
  color: var(--accent);
  font-weight: 700;
}

.text code {
  background: rgba(0, 212, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  color: var(--accent);
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-actions button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s;
}

.message-actions button:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  transform: scale(1.05);
}

/* ==================== INPUT SECTION ==================== */
.input-section {
  padding: 25px 30px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px var(--shadow);
}

.input-wrapper {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 15px;
}

#userInput {
  flex: 1;
  padding: 15px 20px;
  background: var(--bg-chat);
  border: 2px solid var(--border);
  border-radius: 16px;
  color: var(--text-primary);
  font-size: 16px;
  font-family: 'Rajdhani', sans-serif;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#userInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  background: var(--bg-secondary);
}

.feature-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-chat);
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  transform: scale(1.1);
  box-shadow: 0 0 20px var(--accent-glow);
}

.feature-btn.listening {
  background: #ff4757;
  color: white;
  border-color: #ff4757;
  animation: pulse-mic 1.5s infinite;
}

.feature-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
}

@keyframes pulse-mic {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(255, 71, 87, 0);
  }
}

.send-btn {
  padding: 0 30px;
  height: 50px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #667eea);
  color: white;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.send-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--accent-glow);
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .chat-container {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    max-width: 100%;
  }

  .chat-header {
    padding: 15px 20px;
  }

  .logo-section h1 {
    font-size: 22px;
  }

  .ai-orb {
    width: 40px;
    height: 40px;
  }

  .control-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  #chatbox {
    padding: 20px 15px;
  }

  .welcome-icon {
    font-size: 60px;
  }

  .welcome-message h2 {
    font-size: 24px;
  }

  .message-content {
    max-width: 85%;
  }

  .input-section {
    padding: 15px;
  }

  .input-wrapper {
    flex-wrap: wrap;
  }

  #userInput {
    width: 100%;
    order: 1;
  }

  .feature-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }

  .send-btn {
    flex: 1;
    order: 2;
    margin-top: 10px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .logo-section h1 {
    font-size: 18px;
    letter-spacing: 2px;
  }

  .controls {
    gap: 6px;
  }

  .feature-chips {
    flex-direction: column;
  }

  .send-btn span {
    display: none;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
