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

:root {
  /* Light Mode Palette */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-accent: #eff6ff;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.1);
  
  --border: #e2e8f0;
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-accent: #1e1b4b;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-soft: rgba(59, 130, 246, 0.2);
    
    --border: #334155;
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
  }
}

* {
  box-sizing: border-box;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Hero Section */
.hero {
  position: relative;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-accent));
  border: 1px solid var(--border);
  border-radius: 2rem;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: var(--accent);
  filter: blur(120px);
  opacity: 0.1;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(to right, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Search Box */
.search-container {
  margin-top: 2.5rem;
  display: flex;
  gap: 0.75rem;
}

.input-wrapper {
  position: relative;
  flex: 1;
}

input[type="search"] {
  width: 100%;
  padding: 1.25rem 1.5rem;
  padding-left: 3.5rem;
  font-size: 1.1rem;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: 1.25rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

button.btn-clear {
  padding: 0 2rem;
  min-height: 3.75rem;
  border-radius: 1.25rem;
  border: none;
  background-color: var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

button.btn-clear:hover {
  background-color: var(--text-muted);
  color: var(--bg-primary);
}

/* Meta / Status */
.meta-info {
  margin-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

#status {
  font-weight: 600;
  color: var(--accent);
}

.status-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  background-color: var(--bg-accent);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.ai-badge.ready {
  background-color: #dcfce7;
  color: #166534;
}

@media (prefers-color-scheme: dark) {
  .ai-badge.ready {
    background-color: #064e3b;
    color: #4ade80;
  }
}

.ai-badge.loading {
  background-color: var(--accent-soft);
  color: var(--accent);
  animation: pulse 2s infinite;
}

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

.progress-container {
  margin-top: 1rem;
  background-color: var(--border);
  border-radius: 1rem;
  height: 1.5rem;
  position: relative;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(to right, var(--accent), #8b5cf6);
  width: 0%;
  transition: width 0.3s ease;
}

#ai-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  pointer-events: none;
  mix-blend-mode: difference;
}

.hidden {
  display: none;
}

/* Results Grid */
.results-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.result-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
  border-color: var(--accent);
}

.result-card:active {
  transform: translateY(0);
}

.result-info {
  flex: 1;
}

.result-code-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: var(--accent-soft);
  color: var(--accent);
  border-radius: 2rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.result-term {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.result-reason {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.result-score-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--bg-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--text-secondary);
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  background-color: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: 2rem;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Notification (Copy Toast) */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 1rem 2rem;
  border-radius: 3rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Footer */
footer {
  margin-top: 5rem;
  text-align: center;
  padding-bottom: 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-divider {
  width: 60px;
  height: 3px;
  background-color: var(--accent-soft);
  margin: 0 auto 1.5rem;
  border-radius: 2px;
}

.footer-copyright {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin: 0;
}

.footer-copyright strong {
  color: var(--accent);
}

.footer-author {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.footer-author span {
  font-weight: 600;
  color: var(--text-primary);
}

.footer-tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

@media (max-width: 640px) {
  .hero {
    padding: 2rem 1.5rem;
  }
  .hero h1 {
    font-size: 1.8rem;
  }
  .search-container {
    flex-direction: column;
  }
  button.btn-clear {
    min-height: 3.75rem;
  }
  .result-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .result-score-circle {
    align-self: flex-end;
  }
}
