body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  position: relative;
}
body::before, body::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
}
body::before {
  width: 300px;
  height: 300px;
  background: #4f46e5;
  top: -50px;
  left: -50px;
  opacity: 0.5;
}
body::after {
  width: 250px;
  height: 250px;
  background: #ec4899;
  bottom: -50px;
  right: -50px;
  opacity: 0.5;
}
.chat-container {
  width: 90%;
  max-width: 400px;
  height: 540px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}
.api-key-container {
  display: flex;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}
.api-key-container input {
  flex: 1;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  outline: none;
  font-size: 13px;
  transition: border 0.2s;
}
.api-key-container input::placeholder {
  color: #94a3b8;
}
.api-key-container input:focus {
  border: 1px solid rgba(255, 255, 255, 0.3);
}
header {
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.clear-btn {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.2s;
}
.clear-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.chat-box {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: transparent;
  scroll-behavior: smooth;
}
.chat-box::-webkit-scrollbar {
  width: 6px;
}
.chat-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}
.message {
  padding: 10px 14px;
  margin: 6px 0;
  border-radius: 12px;
  max-width: 78%;
  line-height: 1.4;
  white-space: normal;
  animation: fadeInMsg 0.3s ease-out forwards;
  opacity: 0;
  transform: translateY(10px);
}

.message p {
  margin: 0 0 8px 0;
}
.message p:last-child {
  margin-bottom: 0;
}

.message ul, .message ol {
  margin: 4px 0 8px 20px;
  padding: 0;
}

.message code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

.code-block-wrapper {
  position: relative;
  margin: 8px 0;
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  z-index: 10;
  transition: background-color 0.2s;
}
.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.message pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0;
}

.message pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 0.85em;
}
@keyframes fadeInMsg {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.user {
  background: rgba(79, 70, 229, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}
.bot {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}
.error-msg {
  background: rgba(239, 68, 68, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  align-self: center;
  font-size: 13px;
  padding: 8px 12px;
}
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.1);
}
.suggestion-chips::-webkit-scrollbar {
  display: none;
}
.chip {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.input-area {
  display: flex;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}
.input-area input {
  flex: 1;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
  transition: border 0.2s;
}
.input-area input::placeholder {
  color: #94a3b8;
}
.input-area input:focus {
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.input-area button {
  background: rgba(79, 70, 229, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  margin-left: 6px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s;
}
.input-area button:hover {
    background: rgba(79, 70, 229, 1);
}
.mic-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.mic-btn:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}
.mic-btn.listening {
  background: rgba(239, 68, 68, 0.6) !important;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Connect Button */
.connect-btn {
  background: rgba(79, 70, 229, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 14px;
  margin-left: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background-color 0.2s;
}
.connect-btn:hover {
  background: rgba(79, 70, 229, 1);
}
.connect-btn:disabled {
  background: rgba(100, 116, 139, 0.5);
  cursor: not-allowed;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  display: flex;
  align-items: center;
  animation: slideInRight 0.3s ease-out forwards;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast.exiting {
  animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}


/* Mobile Responsiveness */
@media (max-width: 768px) {
  .chat-container {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border: none;
    margin: 0;
  }

  .api-key-container {
    padding: 8px;
  }

  .chat-box {
    padding: 8px;
  }

  .input-area {
    padding: 8px;
  }

  #userInput, .api-key-container input {
    padding: 12px;
    font-size: 16px;
    min-height: 44px;
    box-sizing: border-box;
  }

  #sendBtn, .connect-btn {
    padding: 12px 16px;
    font-size: 16px;
    min-height: 44px;
    box-sizing: border-box;
  }
}
