/* ============================================================
   Lead Intelligence Application — style.css
   Blue deep-tech aesthetic with geometric neural-net motifs
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Exo+2:wght@300;400;500;600&family=Share+Tech+Mono&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg-deep:       #102040;
  --bg-mid:        #172d5a;
  --bg-card:       rgba(22, 50, 110, 0.78);
  --bg-card-hover: rgba(28, 65, 130, 0.92);
  --accent:        #38d9ff;
  --accent2:       #3388ff;
  --accent3:       #2effa0;
  --accent-warn:   #ff8c55;
  --accent-ok:     #2effa0;
  --accent-err:    #ff5580;
  --text-primary:  #eef6ff;
  --text-secondary:#99c8e8;
  --text-muted:    #6698bb;
  --text-dim:      #4a7899;
  --border:        rgba(56, 217, 255, 0.22);
  --border-bright: rgba(56, 217, 255, 0.55);
  --glow:          0 0 22px rgba(56, 217, 255, 0.35);
  --glow-strong:   0 0 44px rgba(56, 217, 255, 0.55);
  --radius:        10px;
  --radius-lg:     18px;
  --transition:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Exo 2', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ---- Animated background grid ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 200, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 200, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 15% 20%, rgba(0, 102, 255, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 80%, rgba(0, 200, 255, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Header ---- */
.site-header {
  position: relative;
  z-index: 10;
  background: linear-gradient(180deg, rgba(10, 25, 55, 0.98) 0%, rgba(15, 35, 75, 0.95) 100%);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.logo-wrap {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow);
  overflow: hidden;
  position: relative;
}

.logo-wrap::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-lg) + 2px);
  background: conic-gradient(from 0deg, var(--accent), var(--accent2), var(--accent), transparent 60%);
  animation: spin 4s linear infinite;
  z-index: -1;
}

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

.logo-wrap img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.header-text { flex: 1; }

.header-text h1 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffffff 0%, var(--accent) 50%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.header-text .subtitle {
  font-family: 'Exo 2', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 4px;
  opacity: 0.85;
}

.header-text .payoff {
  font-family: 'Exo 2', sans-serif;
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-secondary);
  margin-top: 6px;
  font-style: italic;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ---- Nav Bar ---- */
.site-nav {
  background: rgba(20, 100, 220, 0.10);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0;
  padding: 0 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.nav-btn {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 12px 22px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  position: relative;
}

.nav-btn.active, .nav-btn:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Main Layout ---- */
.main-container {
  position: relative;
  z-index: 5;
  max-width: 1400px;
  margin: 0 auto;
  padding: 36px 40px 60px;
}

/* ---- Tabs / Pages ---- */
.page-tab { display: none; }
.page-tab.active { display: block; }

/* ---- Section Titles ---- */
.section-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 22px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 2px;
}

/* ---- Search Form ---- */
.search-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  align-items: start;
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
  position: sticky;
  top: 20px;
}

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

.form-group:last-of-type { margin-bottom: 0; }

label {
  display: block;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 7px;
}

label .label-hint {
  font-weight: 400;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-family: 'Exo 2', sans-serif;
  font-size: 0.72rem;
  margin-left: 6px;
}

input[type="text"],
input[type="url"],
textarea,
select {
  width: 100%;
  background: rgba(10, 45, 100, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Exo 2', sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: var(--transition);
  appearance: none;
}

input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.12);
  background: rgba(0, 40, 90, 0.7);
}

input::placeholder, textarea::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

textarea {
  resize: vertical;
  min-height: 70px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2300c8ff' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

select option {
  background: #172d5a;
  color: var(--text-primary);
}

optgroup {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

/* ---- Tags Input ---- */
.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(10, 45, 100, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 44px;
  cursor: text;
  transition: var(--transition);
}

.tags-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.12);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 200, 255, 0.15);
  border: 1px solid rgba(0, 200, 255, 0.35);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-family: 'Share Tech Mono', monospace;
  color: var(--accent);
  white-space: nowrap;
}

.tag.exclude {
  background: rgba(255, 51, 102, 0.12);
  border-color: rgba(255, 51, 102, 0.35);
  color: var(--accent-err);
}

.tag-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.9rem;
  line-height: 1;
  transition: var(--transition);
}
.tag-remove:hover { opacity: 1; }

.tags-input {
  border: none !important;
  outline: none !important;
  background: none !important;
  padding: 0 !important;
  flex: 1;
  min-width: 80px;
  font-size: 0.88rem;
  color: var(--text-primary);
  box-shadow: none !important;
}

/* ---- Benchmark Sites ---- */
.benchmark-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.benchmark-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.benchmark-item input { flex: 1; }

.btn-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--accent);
  font-size: 1.1rem;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-icon:hover { background: rgba(0, 200, 255, 0.18); border-color: var(--border-bright); }
.btn-icon.danger { color: var(--accent-err); }
.btn-icon.danger:hover { background: rgba(255, 51, 102, 0.1); border-color: rgba(255, 51, 102, 0.4); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent2) 0%, var(--accent) 100%);
  color: #fff;
  padding: 13px 28px;
  box-shadow: 0 4px 20px rgba(0, 102, 255, 0.4);
  width: 100%;
  margin-top: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(0, 200, 255, 0.5);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(0, 200, 255, 0.1);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 8px 18px;
}

.btn-secondary:hover {
  background: rgba(0, 200, 255, 0.18);
  border-color: var(--border-bright);
}

.btn-sm { font-size: 0.78rem; padding: 6px 14px; }

/* ---- Right Panel (Results area) ---- */
.results-panel { position: relative; }

/* ---- Status Bar ---- */
.status-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(12px);
}

.status-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.status-icon.idle { background: rgba(61, 96, 128, 0.3); color: var(--text-dim); }
.status-icon.running { background: rgba(0, 200, 255, 0.15); color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.status-icon.done { background: rgba(0, 255, 153, 0.15); color: var(--accent3); }
.status-icon.error { background: rgba(255, 51, 102, 0.15); color: var(--accent-err); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 200, 255, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(0, 200, 255, 0); }
}

.status-text { flex: 1; }
.status-text .status-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.status-text .status-detail {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- Progress Pipeline ---- */
.pipeline {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 22px;
  backdrop-filter: blur(12px);
}

.pipeline-step {
  flex: 1;
  padding: 12px 10px;
  text-align: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-right: 1px solid var(--border);
  position: relative;
  transition: var(--transition);
}

.pipeline-step:last-child { border-right: none; }

.pipeline-step .step-icon { font-size: 1.1rem; display: block; margin-bottom: 4px; }

.pipeline-step.active {
  background: rgba(0, 200, 255, 0.08);
  color: var(--accent);
}

.pipeline-step.done {
  background: rgba(0, 255, 153, 0.06);
  color: var(--accent3);
}

.pipeline-step.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% { transform: scaleX(0); transform-origin: left; }
  50% { transform: scaleX(1); transform-origin: left; }
  51% { transform: scaleX(1); transform-origin: right; }
  100% { transform: scaleX(0); transform-origin: right; }
}

/* ---- Results Stats ---- */
.results-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  flex: 1;
  text-align: center;
  backdrop-filter: blur(8px);
}

.stat-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 500;
}

/* ---- Result Cards ---- */
.results-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: var(--transition);
  position: relative;
}

.result-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 3px 0 0 3px;
}

.result-card:hover {
  border-color: var(--border-bright);
  background: var(--bg-card-hover);
  transform: translateX(3px);
  box-shadow: var(--glow);
}

.result-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 14px 22px;
  border-bottom: 1px solid var(--border);
}

.company-rank {
  width: 36px;
  height: 36px;
  background: rgba(0, 200, 255, 0.12);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  color: var(--accent);
  flex-shrink: 0;
  font-weight: 700;
}

.company-info { flex: 1; }

.company-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.company-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 2px 9px;
  border-radius: 20px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-badge.country {
  background: rgba(0, 102, 255, 0.15);
  border: 1px solid rgba(0, 102, 255, 0.35);
  color: #60a0ff;
}

.meta-badge.channel {
  background: rgba(0, 255, 153, 0.1);
  border: 1px solid rgba(0, 255, 153, 0.3);
  color: var(--accent3);
}

.company-website {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  flex-shrink: 0;
}

.company-website:hover { color: #fff; text-shadow: 0 0 10px var(--accent); }

.result-card-body { padding: 16px 20px 18px 22px; }

.result-section {
  margin-bottom: 14px;
}

.result-section:last-child { margin-bottom: 0; }

.result-section-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.result-section-title::before {
  content: '▸';
  color: var(--accent);
  font-size: 0.65rem;
}

.result-description {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.match-params {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.match-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: 'Exo 2', sans-serif;
  line-height: 1.3;
}

.match-tag.similar-web {
  background: rgba(0, 200, 255, 0.1);
  border: 1px solid rgba(0, 200, 255, 0.25);
  color: var(--accent);
}

.match-tag.similar-product {
  background: rgba(0, 255, 153, 0.08);
  border: 1px solid rgba(0, 255, 153, 0.25);
  color: var(--accent3);
}

.match-tag.similar-app {
  background: rgba(255, 107, 53, 0.1);
  border: 1px solid rgba(255, 107, 53, 0.25);
  color: var(--accent-warn);
}

/* ---- Score Bar ---- */
.score-bar-wrap {
  margin-top: 10px;
}

.score-bar-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.score-bar {
  height: 4px;
  background: rgba(0, 200, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Empty / Loading states ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

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

.empty-state h3 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.06em;
}

.empty-state p { font-size: 0.85rem; max-width: 380px; margin: 0 auto; line-height: 1.6; }

/* ---- Log Console ---- */
.log-console {
  background: rgba(0, 5, 15, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 16px;
  display: none;
}

.log-console.visible { display: block; }

.log-line { margin-bottom: 4px; line-height: 1.5; }
.log-line.info { color: var(--accent); }
.log-line.success { color: var(--accent3); }
.log-line.warn { color: var(--accent-warn); }
.log-line.error { color: var(--accent-err); }

/* ---- API Test Page ---- */
.api-test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 10px;
}

.api-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.api-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.api-card.status-ok::before { background: var(--accent3); }
.api-card.status-error::before { background: var(--accent-err); }
.api-card.status-testing::before { background: var(--accent); animation: loading2 1s linear infinite; }
.api-card.status-pending::before { background: var(--text-dim); }

@keyframes loading2 {
  0% { transform: scaleX(0) translateX(-100%); }
  100% { transform: scaleX(1) translateX(0%); }
}

.api-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.api-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-ok .api-status-dot { background: var(--accent3); box-shadow: 0 0 8px var(--accent3); }
.status-error .api-status-dot { background: var(--accent-err); box-shadow: 0 0 8px var(--accent-err); }
.status-testing .api-status-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 1s infinite; }
.status-pending .api-status-dot { background: var(--text-dim); }

.api-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}

.api-model {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: 'Share Tech Mono', monospace;
  margin-top: 2px;
}

.api-response {
  background: rgba(0, 5, 15, 0.7);
  border: 1px solid rgba(0, 200, 255, 0.1);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-secondary);
  min-height: 50px;
  word-break: break-word;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}

.api-time {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 8px;
  font-family: 'Share Tech Mono', monospace;
  text-align: right;
}

/* ---- Alert boxes ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
  border-left: 3px solid;
}

.alert-info {
  background: rgba(0, 200, 255, 0.08);
  border-color: var(--accent);
  color: var(--text-secondary);
}

.alert-error {
  background: rgba(255, 51, 102, 0.08);
  border-color: var(--accent-err);
  color: #ff8099;
}

.alert-success {
  background: rgba(0, 255, 153, 0.08);
  border-color: var(--accent3);
  color: #80ffcc;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 200, 255, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 200, 255, 0.45); }

/* ---- Tooltip ---- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 28, 60, 0.95);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 100;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ---- Footer ---- */
.site-footer {
  position: relative;
  z-index: 5;
  border-top: 1px solid var(--border);
  padding: 18px 40px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'Share Tech Mono', monospace;
}

/* ================================================================
   RESPONSIVE — mobile-first full coverage
   ================================================================ */

/* ── Tablet (≤900px) ──────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Layout */
  .search-layout { grid-template-columns: 1fr; }
  .form-card { position: static; }
  .main-container { padding: 20px 16px 48px; }

  /* Header */
  .header-top { padding: 14px 16px; gap: 12px; flex-wrap: wrap; }
  .header-text h1 { font-size: 1.4rem; }
  .header-text .subtitle { font-size: 0.72rem; }
  .header-text .payoff { display: none; }
  .header-actions { gap: 8px; flex-wrap: wrap; }

  /* Nav */
  .site-nav { padding: 0 16px; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .nav-btn { font-size: 0.78rem; padding: 9px 14px; white-space: nowrap; flex-shrink: 0; }

  /* Result cards */
  .result-card-header { flex-wrap: wrap; gap: 10px; padding: 14px 14px 10px; }
  .company-website { margin-left: 0; order: 3; width: 100%; font-size: 0.72rem; }
  .company-rank { width: 30px; height: 30px; font-size: 0.78rem; }
  .company-name { font-size: 1.1rem; }
  .result-card-body { padding: 12px 14px 14px; }

  /* Feedback row */
  .feedback-row { flex-wrap: wrap; gap: 8px; }
  .feedback-btn { font-size: 0.72rem; padding: 6px 12px; }

  /* Cache table */
  .cache-table { font-size: 0.75rem; }
  .cache-table th, .cache-table td { padding: 7px 8px; }

  /* Stats row */
  .results-stats { flex-wrap: wrap; gap: 8px; }

  /* Progress */
  .progress-steps { gap: 8px; }
  .step-item { font-size: 0.7rem; gap: 5px; }

  /* Score bar */
  .score-bar-label { font-size: 0.74rem; flex-wrap: wrap; gap: 4px; }

  /* Login */
  .login-card { padding: 28px 24px; max-width: 340px; }

  /* Admin modal */
  .admin-modal-box { width: 95vw; padding: 24px 18px; }

  /* AI popup */
  .ai-update-popup-box { width: 94vw; padding: 28px 18px; }

  /* Learning banner */
  .learning-banner { gap: 12px; padding: 12px 14px; }
  .learning-stat .ls-val { font-size: 1.1rem; }
}

/* ── Mobile (≤600px) ──────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Header compatto */
  .header-top { padding: 10px 12px; gap: 8px; }
  .header-text h1 { font-size: 1.15rem; letter-spacing: 0.06em; }
  .header-text .subtitle { font-size: 0.68rem; display: none; }
  .logo-wrap { width: 36px; height: 36px; }
  .logo-wrap img { width: 22px; }
  .header-actions .btn { font-size: 0.68rem; padding: 5px 10px; }
  .user-badge { font-size: 0.65rem; padding: 3px 8px; }
  .admin-ai-update-btn { font-size: 0.65rem; padding: 4px 9px; }

  /* Nav scrollabile */
  .nav-btn { font-size: 0.72rem; padding: 8px 11px; }

  /* Form */
  .form-card { padding: 16px 14px 20px; border-radius: 10px; }
  .form-group { margin-bottom: 14px; }
  .form-group label { font-size: 0.72rem; }
  .form-control { font-size: 0.82rem; padding: 9px 12px; }
  .section-title { font-size: 0.8rem; margin-bottom: 14px; }
  .btn { font-size: 0.82rem; padding: 10px 18px; }
  .btn-lg { padding: 12px 20px; font-size: 0.88rem; }

  /* Keyword pills */
  .kw-pill { font-size: 0.68rem; padding: 3px 8px; }

  /* Result cards — mobile full width */
  .result-card { border-radius: 10px; }
  .result-card-header { padding: 12px 12px 8px; gap: 8px; }
  .company-rank { width: 26px; height: 26px; font-size: 0.72rem; }
  .company-name { font-size: 1rem; }
  .company-meta { gap: 6px; margin-top: 4px; }
  .meta-badge { font-size: 0.62rem; padding: 2px 7px; }
  .result-card-body { padding: 10px 12px 12px; }
  .result-section-title { font-size: 0.68rem; margin-bottom: 5px; }
  .result-description, .marketing-potential, .contact-strategy { font-size: 0.8rem; }
  .match-tag { font-size: 0.65rem; padding: 2px 7px; }

  /* Score bar */
  .score-bar-wrap { padding: 10px 12px; margin: 10px 0; }
  .score-bar-label { font-size: 0.7rem; }
  .boost-badge { font-size: 0.6rem; padding: 1px 6px; }

  /* Feedback */
  .feedback-row { padding: 8px 12px; gap: 7px; }
  .feedback-label { font-size: 0.68rem; width: 100%; margin-bottom: 2px; }
  .feedback-btn { flex: 1; min-width: 80px; text-align: center; justify-content: center; font-size: 0.68rem; padding: 7px 8px; }

  /* Export buttons */
  #exportBtns { flex-direction: column; }
  #exportBtns .btn { width: 100%; text-align: center; }

  /* Progress */
  .progress-wrap { padding: 12px 14px; border-radius: 8px; }
  .progress-bar-outer { height: 8px; }
  .progress-steps { flex-direction: column; gap: 6px; align-items: flex-start; }
  .step-item { font-size: 0.68rem; }

  /* Cache table — stack on mobile */
  .cache-table thead { display: none; }
  .cache-table tbody tr {
    display: block;
    background: rgba(30,58,138,0.15);
    border: 1px solid rgba(56,137,255,0.12);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px 12px;
  }
  .cache-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.75rem;
  }
  .cache-table tbody td:last-child { border-bottom: none; justify-content: flex-end; gap: 8px; }
  .cache-table tbody td::before {
    content: attr(data-label);
    color: #4a6a82;
    font-weight: 600;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-right: 8px;
    flex-shrink: 0;
  }

  /* Learning banner — 2 col grid */
  .learning-banner { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
  .learning-banner > div:first-child { grid-column: 1 / -1; }
  .learning-banner > div:last-child { grid-column: 1 / -1; }

  /* Login */
  .login-card { padding: 24px 16px; margin: 20px; }
  .login-logo { width: 54px; height: 54px; }

  /* Stats */
  .results-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-item { padding: 8px 10px; }

  /* Admin modal */
  .admin-modal-box { width: 100vw; border-radius: 14px 14px 0 0; position: fixed; bottom: 0; transform: none !important; top: auto; padding: 24px 16px; }
  .admin-modal { align-items: flex-end; }

  /* AI popup */
  .ai-update-popup-box { width: 98vw; padding: 24px 14px; }
}

/* ── Small mobile (≤380px) ────────────────────────────────────── */
@media (max-width: 380px) {
  .header-text h1 { font-size: 1rem; }
  .nav-btn { font-size: 0.68rem; padding: 7px 9px; }
  .company-name { font-size: 0.92rem; }
  .btn-lg { font-size: 0.82rem; }
  .results-stats { grid-template-columns: 1fr; }
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-card {
  animation: fadeIn 0.35s ease both;
}

.result-card:nth-child(2) { animation-delay: 0.05s; }
.result-card:nth-child(3) { animation-delay: 0.10s; }
.result-card:nth-child(4) { animation-delay: 0.15s; }
.result-card:nth-child(5) { animation-delay: 0.20s; }
.result-card:nth-child(6) { animation-delay: 0.25s; }
.result-card:nth-child(7) { animation-delay: 0.30s; }
.result-card:nth-child(8) { animation-delay: 0.35s; }
.result-card:nth-child(9) { animation-delay: 0.40s; }
.result-card:nth-child(10) { animation-delay: 0.45s; }

/* ---- Channel color variants ---- */
[data-channel="Agente"] .company-name::before { content: ''; }

/* ============================================================
   PROGRESS BAR — animated multi-step
   ============================================================ */

.progress-wrap {
  margin-bottom: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  backdrop-filter: blur(12px);
  display: none;
}

.progress-wrap.visible { display: block; }

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

.progress-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.progress-pct {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 200, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent2) 0%, var(--accent) 60%, var(--accent3) 100%);
  background-size: 200% 100%;
  animation: gradientShift 2s linear infinite;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-width: 0;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 40px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35));
  border-radius: 0 4px 4px 0;
}

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

.progress-step-label {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: 'Exo 2', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.progress-step-label .step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s infinite;
  flex-shrink: 0;
}

.progress-steps-row {
  display: flex;
  gap: 4px;
  margin-top: 12px;
}

.progress-micro-step {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(0, 200, 255, 0.1);
  transition: background 0.4s ease;
  position: relative;
  overflow: hidden;
}

.progress-micro-step.done {
  background: var(--accent3);
}

.progress-micro-step.active {
  background: rgba(0, 200, 255, 0.3);
}

.progress-micro-step.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: shimmer 1s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
