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

:root {
  --bg-dark: #07090e;
  --panel-bg: rgba(13, 17, 28, 0.7);
  --panel-border: rgba(255, 255, 255, 0.08);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.25);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.25);
  --accent-purple: #8b5cf6;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --input-bg: rgba(7, 9, 14, 0.6);
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 40px;
  overflow-x: hidden;
  position: relative;
}

/* Fundo Iluminado (Glow) */
.bg-glow-1 {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, rgba(59, 130, 246, 0.04) 50%, transparent 100%);
  top: -150px;
  right: -100px;
  z-index: -1;
  filter: blur(100px);
}

.bg-glow-2 {
  position: absolute;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.03) 50%, transparent 100%);
  bottom: -200px;
  left: -200px;
  z-index: -1;
  filter: blur(120px);
}

.app-container {
  width: 100%;
  max-width: 1000px;
  padding: 0 24px 60px 24px;
  z-index: 1;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 32px;
}

h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 20%, #10b981 70%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  letter-spacing: -0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

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

/* Menu de Abas (Tabs Navigation) */
.tabs-nav {
  display: flex;
  background: rgba(13, 17, 28, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 6px;
  margin-bottom: 24px;
  gap: 6px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 12px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

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

.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.1);
}

/* Estrutura das Abas */
.tab-pane {
  display: none;
  animation: tabFadeIn 0.3s ease-out forwards;
}

.tab-pane.active {
  display: block;
}

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

/* Painel de Conteúdo */
.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

/* Status Conexão */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(7, 9, 14, 0.8);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  transition: var(--transition-smooth);
}

.status-dot.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

/* Formulário e Grid do Gerador */
.generator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .generator-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.select-wrapper {
  position: relative;
}

select, input[type="text"] {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
  appearance: none;
}

select:focus, input[type="text"]:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

.select-wrapper::after {
  content: '▼';
  font-size: 0.65rem;
  color: var(--text-secondary);
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Botão Gerar */
.btn-generate {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 14px;
  padding: 16px 24px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
  transition: var(--transition-smooth);
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}

.btn-generate:active {
  transform: translateY(0);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Resultado */
.result-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 380px;
  background: rgba(7, 9, 14, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 24px;
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.empty-state svg {
  color: rgba(255, 255, 255, 0.05);
  width: 70px;
  height: 70px;
}

.result-content {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

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

.success-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.credentials-container {
  background: rgba(7, 9, 14, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.credential-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.credential-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.credential-item:first-child {
  padding-top: 0;
}

.credential-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.credential-value {
  font-family: monospace;
  font-size: 1.05rem;
  color: var(--text-primary);
  font-weight: 700;
}

/* Links */
.links-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(7, 9, 14, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.85rem;
}

.link-box span {
  font-weight: 700;
  color: var(--accent-blue);
  min-width: 40px;
}

.link-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  outline: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-copy:hover {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.btn-copy.copied {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

/* Histórico de Testes (Tabela) */
.table-container {
  overflow-x: auto;
  margin-top: 16px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th, td {
  padding: 16px 20px;
}

th {
  background: rgba(7, 9, 14, 0.8);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

tr {
  border-bottom: 1px solid var(--panel-border);
  background: rgba(13, 17, 28, 0.3);
  transition: var(--transition-smooth);
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

td .action-btns {
  display: flex;
  gap: 8px;
}

/* Seção de Integração n8n & API */
.integration-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.info-card {
  background: rgba(59, 130, 246, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 16px;
  padding: 20px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.info-card strong {
  color: var(--text-primary);
}

.code-container {
  background: #05070a;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
  position: relative;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

pre {
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #34d399;
  line-height: 1.5;
}

/* Spinner e Toasts */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

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

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent-green);
  color: white;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: #ef4444;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}
