/* Reset et base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 20px 30px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content h1 {
  color: #4a5568;
  font-size: 2rem;
  margin-bottom: 5px;
}

.header-content h1 i {
  color: #667eea;
  margin-right: 10px;
}

.header-content p {
  color: #718096;
  font-size: 1rem;
}

.status-indicators {
  display: flex;
  gap: 15px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  background: #f7fafc;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}

.status-item i {
  font-size: 1rem;
}

.status-item.connected {
  background: #c6f6d5;
  color: #22543d;
}

.status-item.disconnected {
  background: #fed7d7;
  color: #742a2a;
}

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  flex: 1;
}

/* Chat Container */
.chat-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
}

.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.assistant-message {
  align-self: flex-start;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.user-message .message-avatar {
  background: #667eea;
  color: white;
}

.assistant-message .message-avatar {
  background: #48bb78;
  color: white;
}

.message-content {
  background: #f7fafc;
  padding: 15px 20px;
  border-radius: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
  background: #667eea;
  color: white;
}

.message-content p {
  margin-bottom: 10px;
  line-height: 1.6;
}

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

.message-content ul {
  margin-left: 20px;
  margin-bottom: 10px;
}

.message-content li {
  margin-bottom: 5px;
}

/* Chat Input */
.chat-input-container {
  padding: 20px;
  border-top: 1px solid #e2e8f0;
  background: #f7fafc;
  border-radius: 0 0 15px 15px;
}

.chat-input-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

#message-input {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 25px;
  font-size: 1rem;
  resize: none;
  outline: none;
  transition: border-color 0.3s ease;
  font-family: inherit;
}

#message-input:focus {
  border-color: #667eea;
}

.send-button {
  width: 50px;
  height: 50px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background-color 0.3s ease;
}

.send-button:hover {
  background: #5a67d8;
}

.send-button:disabled {
  background: #a0aec0;
  cursor: not-allowed;
}

.input-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.action-button {
  padding: 8px 16px;
  background: #e2e8f0;
  color: #4a5568;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.action-button:hover {
  background: #cbd5e0;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.sidebar-section h3 {
  color: #4a5568;
  margin-bottom: 15px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.info-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.tips-list {
  list-style: none;
}

.tips-list li {
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.9rem;
  color: #718096;
}

.tips-list li:last-child {
  border-bottom: none;
}

.history-list {
  max-height: 200px;
  overflow-y: auto;
}

.no-history {
  color: #a0aec0;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 15px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
  color: #4a5568;
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #a0aec0;
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  transition: color 0.3s ease;
}

.close-button:hover {
  color: #4a5568;
}

.modal-body {
  padding: 30px;
  max-height: 60vh;
  overflow-y: auto;
}

.tools-list {
  display: grid;
  gap: 15px;
}

.tool-item {
  padding: 15px;
  background: #f7fafc;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.tool-name {
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 5px;
}

.tool-description {
  color: #718096;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: #a0aec0;
}

.loading i {
  font-size: 2rem;
  margin-bottom: 10px;
}

.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.loading-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
}

.loading-content i {
  font-size: 3rem;
  margin-bottom: 20px;
}

.loading-content p {
  font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: -1;
  }

  .header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .status-indicators {
    justify-content: center;
  }

  .message {
    max-width: 95%;
  }

  .modal-content {
    width: 95%;
    margin: 20px;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message {
  animation: fadeIn 0.3s ease;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar,
.history-list::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
