* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #0a0f1a 0%, #1a2332 100%);
  min-height: 100vh;
  color: #e2e8f0;
}

/* CSS Variables for chatbot theme */
:root {
  --chatbot-primary: #00a6de;
  --chatbot-secondary: #003448;
  --chatbot-background: #0a0f1a;
  --chatbot-surface: #1a2332;
  --chatbot-surface-hover: #243142;
  --chatbot-text: #e2e8f0;
  --chatbot-text-muted: #94a3b8;
  --chatbot-border: #334155;
  --chatbot-error: #ef4444;
}

/* Chatbot container */
.chatbot-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 384px;
  height: 600px;
  z-index: 1000;
}

.chatbot-minimized {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1000;
}

.chatbot-toggle-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--chatbot-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 166, 222, 0.3);
  transition: all 0.3s ease;
}

.chatbot-toggle-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(0, 166, 222, 0.4);
}

.chatbot-card {
  height: 100%;
  background: var(--chatbot-background);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 166, 222, 0.1);
  border: 1px solid var(--chatbot-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--chatbot-surface);
  border-bottom: 1px solid var(--chatbot-border);
}

.header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar-ai {
  width: 32px;
  height: 32px;
  background: var(--chatbot-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bot-icon {
  width: 16px;
  height: 16px;
  color: white;
}

.header-text h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--chatbot-text);
  margin-bottom: 2px;
}

.header-text p {
  font-size: 12px;
  color: var(--chatbot-text-muted);
}

.header-controls {
  display: flex;
  gap: 4px;
}

.control-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.control-btn svg {
  width: 16px;
  height: 16px;
  color: var(--chatbot-text-muted);
}

/* Messages area */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background-image: linear-gradient(rgba(0, 166, 222, 0.03) 1px, transparent 1px),
  linear-gradient(90deg, rgba(0, 166, 222, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  gap: 0.75rem;
  animation: fadeInUp 0.3s ease-out;
}

.message.user-message {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 280px;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow: hidden;
}

.ai-bubble {
  background: var(--chatbot-surface);
  color: var(--chatbot-text);
  border-bottom-left-radius: 6px;
}

.user-bubble {
  background: var(--chatbot-primary);
  color: white;
  border-bottom-right-radius: 6px;
}

.error-bubble {
  background: var(--chatbot-surface);
  color: var(--chatbot-error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.avatar-user {
  width: 32px;
  height: 32px;
  background: var(--chatbot-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 4px;
}

.user-icon {
  width: 16px;
  height: 16px;
  color: white;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.75rem 1rem;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--chatbot-text-muted);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Input area */
.input-container {
  padding: 1rem;
  background: var(--chatbot-surface);
  border-top: 1px solid var(--chatbot-border);
}

.input-wrapper {
  display: flex;
  gap: 0.5rem;
}

#message-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--chatbot-background);
  border: 1px solid var(--chatbot-border);
  border-radius: 12px;
  color: var(--chatbot-text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  padding-right: 40px;
}

#message-input:focus {
  border-color: var(--chatbot-primary);
}

#message-input::placeholder {
  color: var(--chatbot-text-muted);
}

.send-btn {
  padding: 0.75rem;
  background: var(--chatbot-primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.send-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-btn svg {
  width: 16px;
  height: 16px;
  color: white;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Responsive design */
@media (max-width: 480px) {
  .chatbot-container {
    width: calc(100vw - 2rem);
    height: calc(100vh - 2rem);
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }
}

/* Scrollbar styling */
.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
  background: var(--chatbot-border);
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: var(--chatbot-text-muted);
}

.ai-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 13px;
    color: #e2e8f0;
}
.ai-bubble .table-scroll {
    overflow-x: scroll;
}
.ai-bubble .table-scroll::-webkit-scrollbar {
    width: 6px;  
    height: 6px;
}

.ai-bubble .table-scroll::-webkit-scrollbar-track {
  background: #1a2332; 
  border: 1px solid #949ca6; 
  border-radius: 10px;
}

.ai-bubble .table-scroll::-webkit-scrollbar-thumb {
  background: #00a6de;
  border-radius: 10px;
}

.ai-bubble th, .ai-bubble td {
    padding: 6px 8px;
    text-align: center;
    border: 1px solid #334155;
}

.ai-bubble th {
    background-color: rgba(0,166,222,0.1);
    color: #ffffff !important;
}
.main-message-input {
    display: flex;
    width: 100%;
    position: relative;
}
#mic-button {
    background: transparent;
    border: none;
    position: absolute;
    right: 8px;
    cursor: pointer;
    padding: 7px 5px 3px 5px;
    margin: 2% auto;
    border-radius: 10px;
}

#mic-button:where(:not(:disabled,:active)):hover {
    background-color: #75829552;
    padding: 7px 5px 3px 5px;
}
#mic-button.active {
  background: rgb(125 139 157 / 17%);
  animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 #0d6488;
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 15px #0d648800;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
  }
}
