* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 40px 20px;
  text-align: center;
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

header p {
  font-size: 1.1em;
  opacity: 0.9;
}

main {
  padding: 40px;
}

h2 {
  font-family: "Inter", sans-serif;
  font-size: 1.5rem;
  color: #1d1d1f;
  margin-bottom: 25px;
  font-weight: 700;
  text-align: center;
}

.urls-section {
  margin-bottom: 30px;
}

.url-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.url-input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.3s;
}

.url-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-remove {
  background: #ff6b6b;
  color: white;
  border: none;
  width: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.5em;
  transition: background 0.3s;
}

.btn-remove:hover {
  background: #ff5252;
}

.btn-add-url {
  background: #4ecdc4;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
  margin-top: 10px;
}

.btn-add-url:hover {
  background: #45b7aa;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  display: block;
  margin: 30px auto;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading p {
  margin-top: 20px;
  color: #667eea;
  font-weight: 600;
}

.resultados {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 40px; /* Mais espaço entre a nuvem e a lista */
  margin-top: 40px;
  width: 100%;
}

.tag-cloud-container,
.keywords-list {
  flex: 2; /* Ocupa 2 partes do espaço (aprox. 65%) */
  background: #ffffff;
  border-radius: 24px; /* Bordas mais arredondadas estilo iOS */
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid #f0f0f0;
}

/* Área da Nuvem: Centralizada e Orgânica */
.tag-cloud {
  background: #fafafa;
  padding: 10px;
  border-radius: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  justify-content: center;
  min-height: 400px; /* Mais espaço para a nuvem respirar */
  border: 1px dashed #e0e0e0;
}
.tag {
  display: inline-block;
  padding: 2px 4px;
  cursor: default;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Inter", sans-serif;
  font-weight: 700;
  border: none;
  white-space: nowrap;
  color: #1d1d1f;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  border: none; /* Removendo borda para um look mais limpo */
}

.tag:hover {
  transform: scale(1.2);
  z-index: 10;
  filter: brightness(0.8); /* Dá uma leve escurecida ao passar o rato */
}

.keywords-table {
  background: white;
  border-radius: 12px;
}

.keyword-row {
  display: grid;
  grid-template-columns: 50px 1fr 150px 80px; /* Ajuste nas proporções */
  gap: 20px;
  padding: 16px;
  border-bottom: 1px solid #f5f5f7;
  align-items: center;
}

.keyword-row:last-child {
  border-bottom: none;
}

.rank {
  font-weight: 700;
  color: #667eea;
}

.keyword {
  font-weight: 600;
  color: #333;
}

.bar-container {
  background: #e0e0e0;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.bar {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.weight {
  text-align: right;
  font-weight: 600;
  color: #764ba2;
  font-size: 0.9em;
}

footer {
  background: #f8f9fa;
  text-align: center;
  padding: 20px;
  color: #666;
  border-top: 1px solid #e0e0e0;
}

@media (max-width: 768px) {
  header h1 {
    font-size: 1.8em;
  }

  main {
    padding: 20px;
  }

  .resultados {
    width: 100%;
  }

  .keyword-row {
    grid-template-columns: 30px 100px 1fr 40px;
    font-size: 0.9em;
  }

  .tag-cloud {
    width: 100%;
    min-height: 200px;
  }
}
