/* ==========================================
   🎨 DESIGN SYSTEM MINIMALISTA
   ========================================== */
:root {
  /* TIPOGRAFIA */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
}

/* Ícones FontAwesome */
i[class^="fa-"] {
  width: 20px;
  height: 20px;
  font-style: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Spinner animation para ícones Lucide */
i.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* TEMA DARK (padrão) */
:root,
.dark-theme {
  /* CORES - DARK MINIMALISTA */
  --bg-color: #09090b;
  --sidebar-bg: #0c0c0e;
  --card-bg: #121214;
  --input-bg: #1a1a1e;
  --border: #27272a;
  --border-hover: #3f3f46;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --user-msg-bg: #27272a;
  --code-bg: #1e1e20;
}

/* TEMA LIGHT */
.light-theme {
  /* CORES - LIGHT MINIMALISTA */
  --bg-color: #fafafa;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --input-bg: #f3f4f6;
  --border: #e5e7eb;
  --border-hover: #d1d5db;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --user-msg-bg: #dbeafe;
  --code-bg: #f3f4f6;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ==========================================
   🗄️ SIDEBAR
   ========================================== */
.sidebar {
  width: 280px;
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  transition: width 0.3s ease;
}

/* Sidebar minimizada - estilo Gemini */
.sidebar.collapsed {
  width: 72px;
}

/* Header da sidebar com botão de toggle */
.sidebar-header {
  display: flex;
  justify-content: center;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar.collapsed .sidebar-header {
  padding: 12px 4px;
}

.sidebar-toggle-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

/* Ações principais da sidebar (nova conversa, nível) */
.sidebar-main-actions {
  padding: 12px;
}

.sidebar.collapsed .sidebar-main-actions {
  padding: 12px 4px;
}

.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.new-chat-btn:hover {
  background: var(--input-bg);
}

.sidebar.collapsed .new-chat-btn {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .btn-text {
  display: none;
}

/* Seletor de nível na sidebar */
.sidebar-level-selector {
  padding: 0 12px 12px;
}

.sidebar.collapsed .sidebar-level-selector {
  padding: 0 4px 12px;
}

.level-sidebar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.level-sidebar-btn:hover {
  background: var(--input-bg);
}

.sidebar.collapsed .level-sidebar-btn {
  justify-content: center;
  padding: 12px;
}

/* Container do histórico - esconde quando colapsado */
.history-list-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .history-list-container {
  display: none;
}

.history-list-header {
  padding: 8px 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}

/* Elementos que colapsam quando a sidebar está minimizada */
.sidebar.collapsed .collapse-content,
.sidebar.collapsed .btn-text {
  display: none;
}

/* ==========================================
   📱 MAIN HEADER (Topo estilo Gemini)
   ========================================== */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-color);
  border-bottom: 1px solid transparent;
}

.header-model-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-badge {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-action-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-action-btn:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

.header-action-btn i {
  font-size: 18px;
}

/* ==========================================
   🎤 MICROFONE BUTTON
   ========================================== */
.mic-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mic-btn:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

.mic-btn.recording {
  color: #ef4444;
  animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* ==========================================
   🎓 MODAL DE NÍVEL
   ========================================== */
.level-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.level-modal.show {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.level-modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 450px;
  max-height: 80vh;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

.level-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.level-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.close-modal-btn:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

.level-modal-body {
  padding: 12px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.level-option-modal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.level-option-modal:hover {
  background: var(--input-bg);
  border-color: var(--border);
}

.level-option-modal.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.level-option-modal .level-icon {
  width: 24px;
  height: 24px;
  font-size: 20px;
}

.level-option-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level-option-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.level-option-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.level-option-modal .check-icon {
  width: 20px;
  height: 20px;
  color: var(--success);
}

/* Sidebar colapsada - esconde histórico */
.sidebar.collapsed .history-list-container {
  display: none;
}

/* Histórico de conversas */
.history-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.history-item {
  padding: 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
}

.history-item:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

/* Conversa ativa - mais destacada */
.history-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), transparent);
  color: var(--text-primary);
  border-left: 4px solid var(--accent);
  font-weight: 600;
  padding-left: 11px;
}

/* Conversa fixada com pin */
.history-item.pinned {
  background: rgba(139, 92, 246, 0.05);
}

.history-item.pinned .history-title {
  font-weight: 500;
}

/* Ícone de pin dentro do item */
.pin-icon {
  width: 14px;
  height: 14px;
  color: #8b5cf6;
  margin-right: 6px;
  flex-shrink: 0;
}

.history-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: none;
  transition: all 0.15s ease;
}

.delete-btn {
  font-size: 16px;
}

.history-item:hover .delete-btn {
  display: block;
}

.delete-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ==========================================
   📋 LEVEL SELECTOR (Dropdown antigo - removendo)
   ========================================== */
.insight-icon {
  width: 16px;
  height: 16px;
}

.path-icon {
  width: 16px;
  height: 16px;
}

.ai-icon {
  width: 16px;
  height: 16px;
}

.loading-icon {
  width: 32px;
  height: 32px;
}

.action-icon {
  width: 16px;
  height: 16px;
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

.theme-toggle-btn i {
  width: 20px;
  height: 20px;
}

/* Ícones Lucide específicos */
.icon-plus {
  width: 20px;
  height: 20px;
}

.icon-profile {
  width: 20px;
  height: 20px;
}

.icon-menu {
  width: 20px;
  height: 20px;
}

.icon-theme {
  width: 18px;
  height: 18px;
}

.icon-logout {
  width: 18px;
  height: 18px;
}

.send-icon {
  width: 18px;
  height: 18px;
}

.level-option-icon {
  width: 22px;
  height: 22px;
}

.check-icon {
  color: var(--success);
}

.level-icon-header {
  width: 48px;
  height: 48px;
}

.insight-icon {
  width: 16px;
  height: 16px;
}

.path-icon {
  width: 16px;
  height: 16px;
}

.ai-icon {
  width: 16px;
  height: 16px;
}

.loading-icon {
  width: 32px;
  height: 32px;
}

.action-icon {
  width: 16px;
  height: 16px;
}

/* ==========================================
   💬 ÁREA PRINCIPAL
   ========================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

/* MOBILE HEADER */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
}

.mobile-header h1 {
  font-size: 1rem;
  font-weight: 600;
}

.menu-toggle,
.logout-btn-mobile {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.menu-toggle:hover,
.logout-btn-mobile:hover {
  color: var(--text-primary);
  background: var(--input-bg);
}

.menu-toggle i,
.logout-btn-mobile i {
  width: 24px;
  height: 24px;
}

/* CHAT CONTAINER */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-behavior: smooth;
}

/* WELCOME MESSAGE */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px 20px;
  max-width: 800px;
  width: 100%;
}

/* Seção de greeting estilo Gemini */
.greeting-section {
  margin-bottom: 40px;
}

.greeting-section h1 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.greeting-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* Level Header na Welcome Message */
.level-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.level-icon-header {
  font-size: 56px;
  margin-bottom: 16px;
}

.level-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.level-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 400px;
}

/* .welcome-message i[class^="fa-"] {
  width: 64px;
  height: 64px;
  font-size: 64px;
  color: var(--accent);
  margin-bottom: 20px;
} */

.welcome-message h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.welcome-message p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* MESSAGES */
.message-wrapper {
  width: 100%;
  max-width: 768px;
  display: flex;
  margin-bottom: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-wrapper.user {
  justify-content: flex-end;
}

.message-wrapper.assistant {
  justify-content: flex-start;
}

.message-content {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  line-height: 1.6;
  font-size: 0.95rem;
  max-width: 85%;
}

.message-wrapper.user .message-content {
  background: var(--user-msg-bg);
  border-bottom-right-radius: 4px;
}

.message-wrapper.assistant .message-content {
  background: transparent;
  padding: 0;
  max-width: 100%;
}

.message-content code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.9em;
}

.message-content strong {
  font-weight: 600;
}

/* TYPING INDICATOR */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  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.8);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ==========================================
   ⌨️ ÁREA DE INPUT
   ========================================== */
.input-area {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, transparent, var(--bg-color) 30%);
  gap: 8px;
}

.input-container {
  width: 100%;
  max-width: 768px;
  background: var(--input-bg);
  border-radius: var(--radius-lg);
  padding: 8px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.input-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.2);
}

textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  resize: none;
  height: 28px;
  min-height: 28px;
  max-height: 200px;
  line-height: 1.5;
  font-family: var(--font-family);
  font-size: 0.95rem;
  padding: 4px 0;
  outline: none;
}

textarea::placeholder {
  color: var(--text-muted);
}

#send-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

#send-btn:not(:disabled) {
  color: var(--text-primary);
}

#send-btn:not(:disabled):hover {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

#send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#send-btn .send-icon {
  font-size: 18px;
}

/* Input Footer com Hint */
.input-footer {
  width: 100%;
  max-width: 768px;
  display: flex;
  justify-content: center;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.7;
}

/* ==========================================
   📱 RESPONSIVO
   ========================================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: left 0.3s ease;
    width: 280px;
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-header {
    display: flex;
  }

  .chat-container {
    padding: 20px 16px;
  }

  .input-area {
    padding: 16px;
  }

  .message-content {
    max-width: 90%;
  }

  .welcome-message {
    padding: 40px 20px;
  }

  .welcome-message i[data-lucide] {
    width: 48px;
    height: 48px;
  }

  .welcome-message h2 {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .input-area {
    padding: 12px;
  }

  .message-wrapper {
    margin-bottom: 16px;
  }

  .message-content {
    font-size: 0.9rem;
    padding: 10px 14px;
  }
}

/* ==========================================
   📝 HISTÓRICO - AÇÕES
   ========================================== */
.history-content {
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.history-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.history-item:hover .history-actions {
  opacity: 1;
}

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

.action-btn:hover {
  color: var(--text-primary);
  background: var(--input-bg);
}

.action-btn.delete-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ==========================================
   💡 INSIGHTS & SUGESTÕES
   ========================================== */
.insights {
  width: 100%;
  max-width: 600px;
  margin-top: 32px;
}

.insights-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-align: left;
  width: 100%;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

.insight-chip {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.insight-chip:hover {
  background: var(--border);
  color: var(--text-primary);
  border-color: var(--accent);
}

.learning-paths {
  margin-top: 24px;
  width: 100%;
}

.path-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.path-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.1));
  border-color: var(--accent);
}

.path-btn i {
  color: var(--accent);
}

/* ==========================================
   📋 TABELAS
   ========================================== */
.formatted-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.85rem;
}

.formatted-text thead {
  background: var(--input-bg);
}

.formatted-text th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.formatted-text td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.formatted-text tr:last-child td {
  border-bottom: none;
}

.formatted-text tbody tr:hover {
  background: var(--input-bg);
}

/* ==========================================
   💻 CÓDIGO
   ========================================== */
.formatted-text pre {
  background: #1a1b26;
  border-radius: var(--radius-md);
  margin: 16px 0;
  overflow: hidden;
  position: relative;
}

.formatted-text pre code {
  display: block;
  padding: 16px;
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #a9b7c6;
  overflow-x: auto;
}

/* Syntax highlighting */
.formatted-text code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
}

.formatted-text .inline-code {
  background: rgba(244, 114, 182, 0.15);
  color: #f472b6;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  transition: all 0.2s ease;
}

.formatted-text .inline-code:hover {
  background: rgba(244, 114, 182, 0.25);
}

.formatted-text .inline-code.copied {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

/* Linguagem badges */
.formatted-text pre code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 2px 6px;
  background: var(--input-bg);
  border-radius: 4px;
}

/* Botão de copiar */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  color: var(--text-primary);
  background: var(--border);
}

.copy-btn.copied {
  color: #22c55e;
  border-color: #22c55e;
}

.copy-btn i {
  width: 16px;
  height: 16px;
}

/* ==========================================
   📝 FORMATAÇÃO DE TEXTO
   ========================================== */
.formatted-text h1,
.formatted-text h2,
.formatted-text h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.formatted-text h1 {
  font-size: 1.5rem;
}

.formatted-text h2 {
  font-size: 1.25rem;
}

.formatted-text h3 {
  font-size: 1.1rem;
}

.formatted-text p {
  margin-bottom: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.formatted-text ul,
.formatted-text ol {
  margin: 16px 0;
  padding-left: 24px;
}

.formatted-text li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.formatted-text li.numbered {
  list-style: decimal;
}

.formatted-text li.bulleted {
  list-style: disc;
}

.formatted-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.formatted-text em {
  color: var(--text-primary);
  font-style: italic;
}

/* ==========================================
   👤 BOTÃO DE PERFIL
   ========================================== */
.profile-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.profile-btn:hover {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

.profile-btn i {
  width: 20px;
  height: 20px;
}

/* Ícones Lucide específicos */
.icon-plus {
  width: 20px;
  height: 20px;
}

.icon-profile {
  width: 20px;
  height: 20px;
}

.icon-menu {
  width: 20px;
  height: 20px;
}

.icon-theme {
  width: 18px;
  height: 18px;
}

.icon-logout {
  width: 18px;
  height: 18px;
}

.send-icon {
  width: 18px;
  height: 18px;
}

.level-option-icon {
  width: 22px;
  height: 22px;
}

.check-icon {
  color: var(--success);
}

.level-icon-header {
  width: 48px;
  height: 48px;
}

.insight-icon {
  width: 16px;
  height: 16px;
}

.path-icon {
  width: 16px;
  height: 16px;
}

.ai-icon {
  width: 16px;
  height: 16px;
}

.loading-icon {
  width: 32px;
  height: 32px;
}

.action-icon {
  width: 16px;
  height: 16px;
}

.profile-btn-mobile {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

/* ==========================================
   🎨 SCROLLBAR
   ========================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ==========================================
   🌙 OVERLAY (sidebar mobile)
   ========================================== */
@media (max-width: 768px) {
  .profile-btn-mobile {
    display: block;
  }

  body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
  }

  body.sidebar-open::after {
    opacity: 1;
    visibility: visible;
  }

  .insights-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   🎓 SELETOR DE NÍVEL NA SIDEBAR
   ========================================== */
.level-selector {
  margin: 0 12px 12px;
  position: relative;
}

.level-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.level-btn:hover {
  background: var(--border);
  border-color: var(--border-hover);
}

.level-icon {
  font-size: 20px;
  color: var(--accent);
}

.level-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  align-items: flex-start;
}

.level-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.level-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.expand-icon {
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.level-btn[aria-expanded="true"] .expand-icon,
.level-dropdown.show+.level-btn .expand-icon {
  transform: rotate(180deg);
}

/* Dropdown de níveis */
.level-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.level-dropdown.show {
  display: block;
  animation: fadeInDropdown 0.2s ease;
}

@keyframes fadeInDropdown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.level-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid var(--border);
}

.level-option:last-child {
  border-bottom: none;
}

.level-option:hover {
  background: var(--input-bg);
}

.level-option.active {
  background: rgba(59, 130, 246, 0.1);
}

.level-option-icon {
  font-size: 20px;
}

.level-option-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.level-option-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.level-option-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.level-option .check-icon {
  font-size: 18px;
  color: var(--accent);
}

/* ==========================================
   💡 INSIGHTS ATUALIZADOS
   ========================================== */
.insights-header {
  width: 100%;
}

.insights-grid .insight-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}

.insights-grid .insight-chip i {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.no-insights {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 16px;
  text-align: center;
}

/* Path buttons atualizados */
.path-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
  width: 100%;
}

.path-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.1));
  border-color: var(--accent);
}

.path-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
}

.path-title {
  font-weight: 500;
}

.path-hours {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================
   🎓 NÍVEL SECTION NO PERFIL (profile.css)
   ========================================== */
/* Esses estilos vão no profile.css, mas adicionei aqui para referência */

.level-section {
  margin-top: 24px;
  padding: 16px;
  background: var(--input-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.level-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.level-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.level-badge {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid #22c55e;
  border-radius: var(--radius-md);
}

.level-badge-icon {
  font-size: 24px;
  color: #22c55e;
}

.level-details h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.level-details p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* XP Progress */
.xp-progress {
  margin-bottom: 12px;
}

.xp-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.xp-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.change-level-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.change-level-btn:hover {
  background: var(--input-bg);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Modal de seleção de nível */
.level-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.level-modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow: hidden;
  animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.level-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.level-modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.close-modal-btn:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

.level-modal-body {
  padding: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.level-select-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.level-select-option:hover {
  background: var(--input-bg);
}

.level-select-option.active {
  background: rgba(59, 130, 246, 0.1);
}

.level-select-option i:first-child {
  width: 24px;
  height: 24px;
}

.level-select-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.level-select-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.level-select-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.level-select-option .check {
  font-size: 20px;
  color: var(--accent);
}

/* Responsivo para modal */
@media (max-width: 480px) {
  .level-modal-content {
    max-width: 100%;
  }

  .level-modal {
    padding: 16px;
  }
}

/* ==========================================
   🤖 INSIGHTS COM IA
   ========================================== */
.ai-insights-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  color: #c084fc;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-insights-btn:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.2));
  border-color: rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

.ai-insights-btn i {
  width: 16px;
  height: 16px;
}

.ai-insights-btn-small {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-insights-btn-small:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

.ai-insights-container {
  width: 100%;
  max-width: 700px;
}

/* Container para ações de insights (botões) */
.insights-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Botões de ação de insights (Gerar novos, Voltar) - MESMO ESTILO DO BOTÃO ORIGINAL */
.insights-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.insight-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  color: #c084fc;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.insight-action-btn:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.2));
  border-color: rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

.insight-chip.ai-generated {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.1));
  border-color: rgba(139, 92, 246, 0.3);
}

.insight-chip.ai-generated:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(236, 72, 153, 0.15));
  border-color: rgba(139, 92, 246, 0.5);
}

/* AI Loading */
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.ai-loading i {
  width: 40px;
  height: 40px;
  color: #c084fc;
}

.ai-loading i.spinning {
  animation: spin 1s linear infinite;
}

.ai-loading p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ==========================================
   📊 PA (PONTOS DE APRENDIZADO) - SUBSTITUINDO XP
   ========================================== */

/* Input de PA */
.pa-input-group {
  margin-bottom: 16px;
}

.pa-input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.pa-input-wrapper {
  display: flex;
  gap: 8px;
}

.pa-input-wrapper input {
  flex: 1;
  padding: 10px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.pa-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
}

.pa-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pa-save-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.pa-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pa-save-btn.loading {
  animation: pulse 1s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* Barra de PA */
.pa-progress {
  margin-bottom: 12px;
}

.pa-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.pa-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.pa-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}