:root {
  --bg-primary: #121212;
  --bg-secondary: #1f1f1f;
  --bg-tertiary: #2a2a2a;
  --text-primary: #ffffff;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  --accent: #60a5fa;
  --accent-light: #06b6d4;
  --accent-hover: #3b82f6;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --border: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(96, 165, 250, 0.2);
  --input-bg: rgba(96, 165, 250, 0.05);
  --font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  --glass: rgba(18, 18, 18, 0.8);
  --glass-border: rgba(96, 165, 250, 0.2);
}

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

html {
  height: 100%;
}

body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  min-height: 0;
  max-height: 100vh;
  background: linear-gradient(135deg, #121212 0%, #1f1f1f 50%, #2a2a2a 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-family);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 50%, rgba(96, 165, 250, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
  opacity: 0.6;
}

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

/* Header */
.header {
  height: 70px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(20px);
  z-index: 10;
  flex-shrink: 0;
  position: relative;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand h1 {
  display: none;
}

.brand-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-text {
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.license-days {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-dropdown-wrapper {
  position: relative;
}

.history-list-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.history-list-btn:hover {
  color: var(--text-primary);
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.3);
}

.history-list-btn:active {
  transform: scale(0.96);
}

.history-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  max-width: 280px;
  max-height: 240px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(20px);
  z-index: 100;
}

.history-dropdown-header {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.history-dropdown-list {
  overflow-y: auto;
  padding: 6px 0;
}

.history-dropdown-item {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.history-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.history-dropdown-empty {
  padding: 16px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

/* Overlay quando a aba ativa não é Lovable */
.lovable-required-overlay {
  position: absolute;
  top: 70px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}

.lovable-required-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.lovable-required-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.clear-history-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.clear-history-btn:hover {
  color: var(--text-primary);
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.clear-history-btn:active {
  transform: scale(0.96);
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.logout-btn:hover {
  color: var(--text-primary);
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

.logout-btn:active {
  transform: scale(0.96);
}

.status-badge {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
  backdrop-filter: blur(10px);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 8px var(--success);
  }
  50% {
    opacity: 0.5;
    box-shadow: 0 0 4px var(--success);
  }
}

/* Chat Area - scroll interno; input fica fixo embaixo */
.chat-container {
  flex: 1;
  min-height: 0; /* permite o flex item encolher e mostrar scroll interno */
  padding: 20px 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  position: relative;
  z-index: 1;
  -webkit-overflow-scrolling: touch;
}

.message {
  display: flex;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.6;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
}

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

.message-content {
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 90%;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

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

.message.user .message-content {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(96, 165, 250, 0.3);
}

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

.message.assistant .message-content {
  background: rgba(31, 31, 31, 0.9);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 15px rgba(96, 165, 250, 0.1);
}

.message.system {
  justify-content: center;
}

.message.system .message-content {
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
}

/* Botão de copiar nas mensagens do usuário */
.message.user {
  position: relative;
}

.message-copy-btn {
  position: absolute;
  bottom: -6px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(31, 31, 31, 0.95);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.message.user:hover .message-copy-btn {
  opacity: 1;
}

.message-copy-btn:hover {
  background: rgba(96, 165, 250, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}

.message-copy-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
  opacity: 1;
}

/* Toggle: Ocultar marca d'água do preview + botão permanente no código */
.watermark-toggle-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 10px 20px;
  background: rgba(31, 31, 31, 0.5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.watermark-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}
.watermark-toggle-label:hover {
  color: var(--text-primary);
}
.watermark-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.watermark-toggle-text {
  flex: 1;
}
.watermark-code-btn {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(96, 165, 250, 0.15);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.watermark-code-btn:hover:not(:disabled) {
  background: rgba(96, 165, 250, 0.25);
  color: var(--accent-light);
}
.watermark-code-btn.applied,
.watermark-code-btn:disabled {
  opacity: 0.8;
  cursor: default;
  border-color: var(--border);
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* Input Area - fixo no rodapé; só o chat rola */
.input-container {
  padding: 16px 20px 24px;
  background: linear-gradient(to top, var(--bg-secondary) 0%, transparent 100%);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.advanced-input-wrapper {
  display: flex;
  flex-direction: column;
  background: rgba(31, 31, 31, 0.8);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 8px 32px rgba(96, 165, 250, 0.1);
  transition: all 0.3s ease;
  pointer-events: auto;
  backdrop-filter: blur(20px);
}

.advanced-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(96, 165, 250, 0.2);
  background: rgba(31, 31, 31, 0.95);
}

/* File Previews */
.file-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  max-height: 140px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.file-preview-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(96, 165, 250, 0.1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-primary);
  max-width: calc(50% - 3px);
  min-width: 0;
}

/* Chip com miniatura de imagem/vídeo */
.file-preview-chip.has-thumbnail {
  padding: 4px 8px 4px 4px;
}

.file-thumbnail {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
}

.file-thumbnail.video-icon-wrap {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(6, 182, 212, 0.2));
  color: var(--accent);
}

.file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--accent);
}

.file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 1px;
}

.file-name {
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-size: 11px;
  line-height: 1.3;
}

.file-size {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.remove-file-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 3px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.remove-file-btn:hover {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.file-counter {
  display: flex;
  align-items: center;
  font-size: 10px;
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(96, 165, 250, 0.06);
  white-space: nowrap;
}

/* Text Input */
.input-main-area {
  position: relative;
  display: flex;
  width: 100%;
  align-items: flex-end;
}

#message-input {
  width: 100%;
  min-height: 40px;
  background: transparent;
  border: none;
  resize: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 8px 0;
}

#message-input::placeholder {
  color: var(--text-secondary);
}

/* Estado "melhorando prompt": input bloqueado (readOnly no JS), sem pointer-events para o valor atualizar na tela */
#message-input.improving {
  opacity: 0.9;
  cursor: wait;
}

/* Feedback visual ao arrastar arquivos sobre a área de mensagem */
#message-input.drag-over {
  outline: 2px dashed rgba(16, 185, 129, 0.5);
  outline-offset: 2px;
}

/* Botão Melhorar prompt: mostrar ícone ou spinner */
.improve-prompt-spinner {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.action-btn.loading .improve-prompt-icon {
  display: none;
}

.action-btn.loading .improve-prompt-spinner {
  display: flex !important;
}

.spinner-svg {
  animation: improve-spin 0.9s linear infinite;
}

@keyframes improve-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Voice Button States */
.voice-recording-icon,
.voice-processing-icon {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

/* Estado: gravando */
.action-btn.voice-recording {
  color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.15) !important;
  animation: voice-pulse 1.2s ease-in-out infinite;
}

.action-btn.voice-recording .voice-icon {
  display: none;
}

.action-btn.voice-recording .voice-recording-icon {
  display: flex !important;
}

/* Estado: processando (transcrevendo) */
.action-btn.voice-processing {
  opacity: 0.7;
  cursor: wait;
}

.action-btn.voice-processing .voice-icon {
  display: none;
}

.action-btn.voice-processing .voice-processing-icon {
  display: flex !important;
}

@keyframes voice-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

/* Timer de gravação */
.voice-timer {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: none;
  animation: fadeIn 0.2s ease;
}

/* Actions Row */
.input-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.left-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.right-actions {
  display: flex;
  align-items: center;
}

.action-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
}

.action-btn:hover {
  color: var(--accent);
  background: rgba(96, 165, 250, 0.1);
}

.action-btn.active {
  color: var(--accent);
  background: rgba(96, 165, 250, 0.15);
}

.action-btn.loading {
  opacity: 0.6;
  cursor: wait;
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.send-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: scale(0.9);
  box-shadow: none;
}

.send-btn:not(:disabled):hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
}

.send-btn:not(:disabled):active {
  transform: scale(0.95);
}

/* Settings Overlay */
.settings-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  z-index: 20;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-overlay.open {
  transform: translateY(0);
}

.settings-content {
  padding: 30px 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.auth-container .form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

/* Auth Container */
.auth-container {
  width: 100%;
  max-width: 340px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.auth-logo {
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.auth-logo-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  display: block;
}

.auth-logo-text {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  letter-spacing: -0.5px;
}

.auth-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}

.auth-button {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.auth-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(96, 165, 250, 0.4);
}

.auth-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0.5;
}

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

.key-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(96, 165, 250, 0.05);
  border: 1px solid var(--border);
  color: #fff;
  padding: 12px 44px 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.key-input::placeholder {
  letter-spacing: 2px;
}

.key-input:focus {
  background: rgba(96, 165, 250, 0.1);
  border-color: var(--accent);
}

.key-input-wrapper {
  position: relative;
  width: 100%;
}

.toggle-visibility {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.toggle-visibility:hover {
  color: var(--text-primary);
  background: rgba(96, 165, 250, 0.15);
}

.save-btn {
  margin-top: auto;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(96, 165, 250, 0.4);
}

/* Loading Spinner */
.loading-spinner {
  display: none;
  border: 2px solid rgba(96, 165, 250, 0.2);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  width: 18px;
  height: 18px;
}

.loading-spinner[style*="display: block"] {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulseOpacity {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.loading-pulse {
  animation: pulseOpacity 1.5s ease-in-out infinite;
  color: var(--accent) !important;
  font-style: italic;
  border-color: rgba(96, 165, 250, 0.3) !important;
  background: rgba(96, 165, 250, 0.04) !important;
  pointer-events: none;
}

/* Error and Success Messages */
.error-message,
.success-message {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  animation: slideDown 0.3s ease;
}

.error-message.show,
.success-message.show {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.success-message {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #86efac;
}

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

/* Download Overlay — bloqueia interação durante download */
.download-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 18, 18, 0.7);
  backdrop-filter: blur(6px);
  cursor: wait;
  animation: fadeIn 0.2s ease;
}

.download-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.download-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(96, 165, 250, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.download-overlay-text {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

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

/* ============================================
   NEW PREMIUM VISUAL CARDS GRID (Lovable Booster v6.0.0)
   ============================================ */

.main-visual-container {
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  z-index: 1;
  overflow-y: auto;
  flex: 1;
}

.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-files-panel {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(10, 12, 16, 0.96);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.project-files-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.project-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.project-files-header h4 {
  font-size: 12px;
  color: var(--text-primary);
}

.project-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: none;
  padding-right: 4px;
}

.project-file-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.project-file-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(96, 165, 250, 0.15);
}

.project-file-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

/* Tipos de arquivos customizados */
.project-file-icon-wrap.js {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.15);
}
.project-file-icon-wrap.ts {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.15);
}
.project-file-icon-wrap.html {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.15);
}
.project-file-icon-wrap.css {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.15);
}
.project-file-icon-wrap.json {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.15);
}
.project-file-icon-wrap.doc {
  color: #9ca3af;
  background: rgba(156, 163, 175, 0.1);
  border: 1px solid rgba(156, 163, 175, 0.15);
}
.project-file-icon-wrap.image {
  color: #ec4899;
  background: rgba(236, 72, 153, 0.1);
  border: 1px solid rgba(236, 72, 153, 0.15);
}
.project-file-icon-wrap.zip {
  color: #d97706;
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.15);
}
.project-file-icon-wrap.generic {
  color: #d1d5db;
  background: rgba(209, 213, 219, 0.08);
  border: 1px solid rgba(209, 213, 219, 0.1);
}

.project-file-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-file-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.3;
}

.project-file-meta-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
  width: fit-content;
  border: 1px solid var(--border);
}

.project-file-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.project-file-actions .mini-btn {
  font-size: 10px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  text-align: center;
}

.project-file-actions .mini-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-light);
  box-shadow: 0 2px 8px var(--border-accent);
}

.project-file-actions .mini-btn:active {
  transform: scale(0.95);
}

/* Barra de Busca e Filtros */
.project-files-search-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  transition: color 0.2s ease;
}

.search-input-wrapper input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 14px 10px 36px;
  border-radius: 10px;
  font-size: 12px;
  outline: none;
  font-family: var(--font-family);
  transition: all 0.2s;
}

.search-input-wrapper input:focus {
  background: rgba(96, 165, 250, 0.05);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.1);
}

.search-input-wrapper input:focus + .search-icon {
  color: var(--accent);
}

.filter-buttons-wrapper {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none; /* Firefox */
}

.filter-buttons-wrapper::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.filter-btn {
  font-size: 10px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  font-family: var(--font-family);
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.filter-btn.active {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.25), rgba(6, 182, 212, 0.2));
  border-color: rgba(96, 165, 250, 0.5);
  color: #e6f2ff;
  box-shadow: 0 2px 8px rgba(96, 165, 250, 0.15);
}

/* Empty State na lista de arquivos */
.project-files-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.8;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* Custom DB File Icon */
.project-file-icon-wrap.db {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.15);
}

.code-view-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(8, 10, 14, 0.98);
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.code-view-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.code-view-filename {
  font-size: 12px;
  color: var(--text-primary);
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-view-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#code-view-copy-btn {
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(6, 182, 212, 0.18));
  color: #e6f2ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

#code-view-copy-btn:hover {
  border-color: rgba(96, 165, 250, 0.7);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.35), rgba(6, 182, 212, 0.28));
}

#code-view-copy-btn.copied {
  border-color: rgba(16, 185, 129, 0.7);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(5, 150, 105, 0.25));
  color: #d1fae5;
}

.code-view-content {
  flex: 1;
  margin: 0;
  background: #0f1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: #d7e2f0;
  font-size: 11px;
  line-height: 1.45;
  overflow: auto;
  white-space: pre;
}

.tok-key { color: #8ab4ff; }
.tok-str { color: #8bd5a3; }
.tok-num { color: #f7c873; }
.tok-lit { color: #c79bff; }
.tok-com { color: #7f8ea3; font-style: italic; }

.project-files-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.project-files-close-btn:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.project-files-close-btn:active {
  transform: scale(0.96);
}

.project-files-back-btn,
.code-view-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.project-files-back-btn:hover,
.code-view-back-btn:hover {
  color: var(--accent);
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.1);
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.15);
}

.project-files-back-btn:active,
.code-view-back-btn:active {
  transform: scale(0.96);
}

.project-files-back-btn svg,
.code-view-back-btn svg {
  stroke-width: 2.5px;
  transition: transform 0.2s ease;
}

.project-files-back-btn:hover svg,
.code-view-back-btn:hover svg {
  transform: translateX(-2px);
}

.action-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: all 0.2s ease;
}

.action-card:hover {
  border-color: rgba(96, 165, 250, 0.2);
  background: var(--bg-tertiary);
}

.card-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon-wrap.watermark {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.card-icon-wrap.download {
  background: rgba(96, 165, 250, 0.1);
  color: var(--accent);
  border: 1px solid rgba(96, 165, 250, 0.15);
}

.card-icon-wrap.files {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.card-icon-wrap.database {
  background: rgba(6, 182, 212, 0.1);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.15);
}

.card-icon-wrap.reset-clean {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-content h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.card-content p {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Estilo para os botões originais remapeados nos Cards */
.action-card button.card-action-btn,
.action-card #remove-watermark-btn,
.action-card #download-project-btn,
.action-card #list-project-files-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: var(--font-family);
}

.action-card button.card-action-btn:hover,
.action-card #remove-watermark-btn:hover,
.action-card #download-project-btn:hover,
.action-card #list-project-files-btn:hover {
  background: var(--accent);
  border-color: var(--accent-light);
  box-shadow: 0 4px 12px var(--border-accent);
}

.action-card button.card-action-btn:active,
.action-card #remove-watermark-btn:active,
.action-card #download-project-btn:active,
.action-card #list-project-files-btn:active {
  transform: scale(0.96);
}

/* ============================================
   CUSTOM MODAL STYLE
   ============================================ */

.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 310px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10001;
}

.modal-icon-wrap.danger {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.modal-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.modal-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  border: 1px solid transparent;
}

.modal-btn.cancel {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text-primary);
}

.modal-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

.modal-btn.confirm {
  background: var(--danger);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fff;
}

.modal-btn.confirm:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* Prompt Enhancer Custom Styles */
#prompt-enhancer-panel select {
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#prompt-enhancer-panel select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

#prompt-enhancer-panel textarea {
  transition: border-color 0.2s, box-shadow 0.2s;
}

#prompt-enhancer-panel textarea:focus:not([readonly]) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

#prompt-enhancer-panel textarea[readonly] {
  cursor: default;
}

/* Chat Sem Créditos History Accordion collapsed state */
#chat-only-history-container.collapsed {
  max-height: 0 !important;
  flex: none !important;
  height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top-width: 0 !important;
  border-bottom-width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden !important;
}

#chat-only-history-chevron.collapsed {
  transform: rotate(-90deg) !important;
}

.bonus-badge {
  display: inline-flex;
  align-items: center;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  letter-spacing: 0.5px;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
  animation: pulseGlow 1.5s infinite alternate;
}

@keyframes pulseGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 4px rgba(168, 85, 247, 0.4);
  }
  100% {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.8);
  }
}

