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

/* ── CSS Reset & Tokens ──────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-purple: #7c3aed;
  --accent-purple-glow: rgba(124, 58, 237, 0.3);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.2);
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --gradient-hero: linear-gradient(135deg, #7c3aed 0%, #3b82f6 50%, #06b6d4 100%);
  --gradient-card: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated Background ─────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(ellipse 800px 600px at 50% 0%, rgba(124, 58, 237, 0.08), transparent 70%),
    radial-gradient(ellipse 600px 400px at 80% 50%, rgba(59, 130, 246, 0.05), transparent 60%),
    radial-gradient(ellipse 600px 400px at 20% 80%, rgba(6, 182, 212, 0.04), transparent 60%);
  pointer-events: none;
}

.bg-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

/* ── Layout ──────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header / Hero ──────────────────────────── */
.hero {
  text-align: center;
  padding: 80px 0 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.hero-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  animation: pulse-dot 2s ease-in-out infinite;
}

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

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

/* ── Search Box ──────────────────────────────── */
.search-section {
  padding: 20px 0 40px;
}

.search-box {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

.search-box .glass-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.search-box .glass-card:focus-within {
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-glow);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 20px;
}

#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  padding: 12px 0;
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--gradient-hero);
  color: white;
  border: none;
  border-radius: calc(var(--radius-xl) - 4px);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

#search-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: var(--transition);
}

#search-btn:hover::before {
  opacity: 1;
}

#search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.35);
}

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

.search-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.suggestion-chip {
  padding: 6px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.suggestion-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

/* ── Status / Logs ───────────────────────────── */
.status-section {
  max-width: 700px;
  margin: 0 auto 32px;
  display: none;
}

.status-section.active {
  display: block;
}

.status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(20px);
}

.status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.status-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.status-logs {
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.status-log-entry {
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--text-muted);
  padding: 3px 0;
  display: flex;
  gap: 8px;
}

.status-log-entry .timestamp {
  color: var(--accent-purple);
  flex-shrink: 0;
}

/* ── Results ─────────────────────────────────── */
.results-section {
  display: none;
  padding-bottom: 80px;
}

.results-section.active {
  display: block;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.results-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.results-header .count {
  color: var(--accent-purple);
}

.results-actions {
  display: flex;
  gap: 10px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--accent-emerald);
  border-radius: var(--radius-md);
  color: var(--accent-emerald);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-download:hover {
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2);
}

.btn-clear {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

/* ── Parsed Info ─────────────────────────────── */
.parsed-info {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.parsed-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-secondary);
}

.parsed-tag .label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-amber);
}

/* ── Profile Cards ───────────────────────────── */
.results-grid {
  display: grid;
  gap: 12px;
}

.profile-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
  animation: fadeInUp 0.4s ease-out both;
}

.profile-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

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

.profile-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.profile-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-handle {
  font-size: 0.85rem;
  color: var(--accent-purple);
  font-weight: 500;
}

.profile-handle a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

.profile-handle a:hover {
  text-decoration: underline;
}

.profile-followers {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-emerald);
  white-space: nowrap;
  flex-shrink: 0;
}

.profile-bio {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.profile-email {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent-amber);
  font-weight: 500;
}

.profile-source {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Empty State ─────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ── Footer ──────────────────────────────────── */
.footer {
  text-align: center;
  padding: 32px 0;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--accent-purple);
  text-decoration: none;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 640px) {
  .hero {
    padding: 48px 0 24px;
  }

  .search-box .glass-card {
    flex-direction: column;
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  #search-btn {
    width: 100%;
    justify-content: center;
    border-radius: var(--radius-md);
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-top {
    flex-direction: column;
  }
}

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

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

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

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

/* ── Skeleton Loading ────────────────────────── */
.skeleton {
  display: none;
}

.skeleton.active {
  display: grid;
  gap: 12px;
}

.skeleton-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s ease-in-out infinite;
  margin-bottom: 10px;
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-line.short {
  width: 45%;
}

.skeleton-line.medium {
  width: 70%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
