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

:root {
  --bg-color: #0b0f19;
  --surface-color: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #e2e8f0; /* Será substituído via JS dependendo do metal */
  
  --rhodium: #e2e8f0;
  --platinum: #e5e4e2;
  --gold: #ffd700;
  --ruthenium: #a3a6a8;
  --iridium: #f1f2f3;
  --osmium: #b5c2c9;
  --palladium: #ced0d4;
  --rhenium: #8f9699;
  --silver: #c0c0c0;
  --indium: #d3d3d3;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
}

/* Glassmorphism utils */
.glass {
  background: var(--surface-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
}

/* Sidebar */
.sidebar {
  width: 280px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-border);
  padding: 1.5rem;
  z-index: 10;
  background: rgba(11, 15, 25, 0.8);
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--gold), var(--platinum));
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.models-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.models-list::-webkit-scrollbar {
  width: 4px;
}
.models-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.model-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  text-align: left;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.3s ease;
}

.model-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.model-btn.active {
  background: var(--surface-color);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.symbol {
  font-size: 0.75rem;
  font-weight: 700;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--bg-color);
  opacity: 0.8;
  transition: all 0.3s;
}

.model-btn.active .symbol {
  opacity: 1;
  box-shadow: 0 0 10px currentColor;
}

.settings-btn {
  margin-top: 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}

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

/* Chat Area */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.03) 0%, transparent 50%);
}

.chat-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.current-model-info h2 {
  font-size: 1.25rem;
  font-weight: 600;
  transition: color 0.3s;
}

.current-model-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.message {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: fadeIn 0.3s ease;
}

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

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

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

.message-content {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 0.95rem;
}

.message.user .message-content {
  background: var(--surface-color);
  border: 1px solid var(--glass-border);
  border-bottom-right-radius: 4px;
}

.message.bot .message-content {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
}

/* Markdown styling in messages */
.message-content p {
  margin-bottom: 0.75rem;
}
.message-content p:last-child {
  margin-bottom: 0;
}
.message-content pre {
  background: rgba(0,0,0,0.5);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0.75rem 0;
  border: 1px solid var(--glass-border);
}
.message-content code {
  font-family: monospace;
  background: rgba(0,0,0,0.3);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}
.message-content pre code {
  background: transparent;
  padding: 0;
}

.input-area {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--glass-border);
}

.input-form {
  display: flex;
  gap: 1rem;
  background: var(--surface-color);
  border: 1px solid var(--glass-border);
  padding: 0.5rem;
  border-radius: 12px;
  transition: border-color 0.3s;
}

.input-form:focus-within {
  border-color: var(--accent-color);
}

.input-form input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.input-form input::placeholder {
  color: rgba(255,255,255,0.3);
}

.input-form button {
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  padding: 0 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.input-form button:hover {
  opacity: 0.9;
}

.input-form button:active {
  transform: scale(0.98);
}

.input-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  padding: 2rem;
  border-radius: 16px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-content h3 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.modal-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.modal-content input {
  width: 100%;
  background: var(--surface-color);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
}

.modal-content input:focus {
  border-color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.modal-actions button {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.btn-cancel {
  background: transparent;
  color: var(--text-secondary);
}

.btn-cancel:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.btn-save {
  background: var(--text-primary);
  color: var(--bg-color);
}

.btn-save:hover {
  background: #fff;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.5rem 1rem;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.markdown-body {
  font-size: 0.95rem;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.markdown-body ul, .markdown-body ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}

/* Responsividade Mobile */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    padding: 1rem;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }
  
  .brand {
    margin-bottom: 1rem;
    font-size: 1.1rem;
  }
  
  .models-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.5rem;
  }
  
  .model-btn {
    flex-shrink: 0;
    flex-direction: column;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }
  
  .model-btn span {
    font-size: 0.8rem;
  }
  
  .chat-header {
    padding: 1rem;
  }
  
  .current-model-info h2 {
    font-size: 1.1rem;
  }
  
  .current-model-info p {
    font-size: 0.8rem;
  }
  
  .messages {
    padding: 1rem;
    gap: 1rem;
  }
  
  .message {
    max-width: 95%;
  }
  
  .input-area {
    padding: 1rem;
    padding-bottom: 2rem; /* Espaço extra para os botões do Android / iOS */
  }
  
  .input-form {
    padding: 0.25rem;
  }
  
  .input-form input {
    padding: 0.75rem 0.5rem;
    font-size: 0.95rem;
  }
  
  .input-form button {
    padding: 0 1rem;
  }
}