@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --bg-color: #0F172A;
  --sidebar-bg: rgba(30, 41, 59, 0.7);
  --chat-bg: #0B1120;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --user-msg: #4F46E5;
  --bot-msg: #1E293B;
  --border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  overflow: hidden;
  background-image: radial-gradient(circle at top right, rgba(79, 70, 229, 0.15), transparent 40%),
                    radial-gradient(circle at bottom left, rgba(79, 70, 229, 0.1), transparent 40%);
}

/* Sidebar Wrapper */
.sidebar {
  width: 320px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 15px;
  background: linear-gradient(90deg, #818CF8, #C084FC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* Bot List */
.bot-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.bot-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 5px;
}

.bot-item:hover, .bot-item.active {
  background: rgba(255, 255, 255, 0.1);
}

.bot-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  flex-shrink: 0;
  overflow: hidden;
}
.bot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bot-info {
  flex: 1;
  overflow: hidden;
}

.bot-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.bot-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Chat Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  position: relative;
}

.chat-header {
  padding: 20px;
  background: rgba(11, 17, 32, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 15px;
}

.chat-header .bot-avatar {
  width: 40px;
  height: 40px;
}

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

/* Message Bubbles */
.message {
  max-width: 70%;
  padding: 12px 18px;
  border-radius: 18px;
  line-height: 1.5;
  animation: fadeIn 0.3s ease-out;
  position: relative;
  word-wrap: break-word;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.bot {
  align-self: flex-start;
  background: var(--bot-msg);
  border-bottom-left-radius: 4px;
}

.message.user {
  align-self: flex-end;
  background: var(--user-msg);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Input Area */
.chat-input-container {
  padding: 20px;
  background: var(--bg-color);
  border-top: 1px solid var(--border);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bot-msg);
  border-radius: 15px;
  padding: 10px 15px;
  border: 1px solid rgba(255,255,255,0.05);
}

.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  padding: 5px 0;
  font-size: 1rem;
}

.action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--primary);
}

.send-btn {
  background: var(--primary);
  color: white;
}

.send-btn:hover {
  background: var(--primary-hover);
  color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
}

/* Modal de Autenticação Automática */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(11, 17, 32, 0.9);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.hidden {
  display: none !important;
}

.auth-modal {
  background: var(--sidebar-bg);
  padding: 40px;
  border-radius: 16px;
  border: 1px solid var(--border);
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--glass-shadow);
  animation: fadeIn 0.4s ease-out;
}

.auth-modal h2 {
  margin-bottom: 10px;
  background: linear-gradient(90deg, #818CF8, #C084FC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-modal p {
  color: var(--text-muted);
  margin-bottom: 25px;
  font-size: 0.9rem;
}

.auth-group {
  margin-bottom: 15px;
  text-align: left;
}

.auth-group input {
  width: 100%;
  padding: 12px 15px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  color: white;
  outline: none;
  font-size: 1rem;
}

.auth-group input:focus {
  border-color: var(--primary);
}

.auth-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}

.auth-btn:hover {
  background: var(--primary-hover);
}

#fileInput {
  display: none;
}
