/* ═══════════════════════════════════════
   components.css — all UI components
   ═══════════════════════════════════════ */

/* ── LOGO ── */
.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 22px;
  letter-spacing: -0.5px;
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #FFFFFF;
}
.logo-dot { color: var(--primary); }
.logo-badge {
  font-family: 'DM Mono', monospace;
  font-size: 9px; font-weight: 400;
  background: rgba(255,94,26,0.12);
  color: var(--glow);
  border: 1px solid rgba(255,94,26,0.25);
  padding: 3px 9px; border-radius: 20px;
  letter-spacing: 1.5px; text-transform: uppercase;
}

/* ── HEADER RIGHT ── */
.header-right { display: flex; align-items: center; gap: 14px; }

/* ── AUTH BUTTON ── */
#auth-btn {
  font-family: 'DM Mono', monospace; font-size: 12px;
  background: transparent; color: #FFFFFF;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 9px 20px; border-radius: 8px;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 8px;
}
#auth-btn:hover { border-color: var(--primary); color: var(--primary); }
#auth-btn svg { width: 14px; height: 14px; }

/* ── USER INFO ── */
#user-info {
  display: none; align-items: center;
  gap: 10px; font-size: 12px; color: #888;
}
#user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--primary); object-fit: cover;
}
#signout-btn {
  font-size: 11px; color: #666; background: none;
  border: none; cursor: pointer; text-decoration: underline;
  font-family: 'DM Mono', monospace; transition: color 0.2s;
}
#signout-btn:hover { color: var(--primary); }

/* ── COMMUNITY COUNTER ── */
.community-counter {
  margin-bottom: 20px;
  transition: opacity 0.4s, max-height 0.4s, margin 0.4s;
  max-height: 40px; overflow: hidden;
}
main.split .community-counter { opacity: 0; max-height: 0; margin-bottom: 0; }

.counter-text {
  font-size: 14px; color: #999;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; width: 100%;
  transition: color 0.2s;
  justify-content: center;
}
main.split .counter-text { justify-content: flex-start; }
.counter-text:hover { color: #FFFFFF; }
.counter-heart { color: var(--primary); font-size: 16px; }
.counter-num {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 16px; color: var(--spark);
  transition: color 0.2s;
}

/* ── USE-CASE PILLS ── */
.pill-btn {
  font-family: 'DM Mono', monospace; font-size: 13px;
  padding: 10px 20px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05); color: #DDDDDD;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 8px;
}
.pill-btn:hover {
  border-color: var(--primary);
  background: rgba(255,94,26,0.1);
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255,94,26,0.15);
}

/* ── USE-CASE PILLS CONTAINER ── */
.usecase-pills {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin-bottom: 24px;
  transition: opacity 0.4s, max-height 0.4s, margin 0.4s;
  max-height: 60px; overflow: hidden;
}
main.split .usecase-pills {
  justify-content: flex-start;
  opacity: 0; max-height: 0; margin-bottom: 0;
}

/* ── TRUST LINE ── */
.trust-item {
  font-size: 12px; color: #666;
  display: flex; align-items: center; gap: 6px;
  letter-spacing: 0.3px;
}
.trust-dot {
  width: 3px; height: 3px; border-radius: 50%;
  background: #555;
}

/* ── SEARCH BOX ── */
.search-wrap {
  position: relative; width: 100%; margin-bottom: 16px;
}
.search-wrap::before {
  content: ''; position: absolute; inset: -1px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--spark));
  opacity: 0; transition: opacity 0.3s; z-index: 0;
}
.search-wrap:focus-within::before { opacity: 1; }

#search-input {
  width: 100%; padding: 20px 64px 20px 24px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #FFFFFF;
  font-family: 'DM Mono', monospace; font-size: 15px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
  position: relative; z-index: 1;
}
#search-input::placeholder { color: #555; }
#search-input:focus {
  border-color: var(--primary);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 3px rgba(255,94,26,0.12),
              0 0 40px rgba(255,94,26,0.08);
}

#search-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  z-index: 2; width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--glow));
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 24px rgba(255,94,26,0.4);
}
#search-btn:hover {
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 0 36px rgba(255,94,26,0.6);
}
#search-btn svg { width: 18px; height: 18px; color: white; }

/* ── TIME FILTERS ── */
.filter-label {
  font-size: 11px; color: #666;
  letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 10px;
  text-align: center; width: 100%;
}
.time-filters {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 24px;
  justify-content: center; width: 100%;
}
main.split .time-filters { justify-content: flex-start; }
main.split .filter-label { text-align: left; }

.tf {
  font-family: 'DM Mono', monospace; font-size: 12px;
  padding: 8px 16px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent; color: #888;
  cursor: pointer; transition: all 0.2s; letter-spacing: 0.5px;
}
.tf:hover { border-color: var(--glow); color: var(--glow); }
.tf.active {
  background: rgba(255,94,26,0.12);
  border-color: var(--primary); color: var(--primary);
}

/* ── STATS ROW ── */
.stats-row {
  display: flex; gap: 24px; flex-wrap: wrap;
  opacity: 0; transition: opacity 0.4s 0.3s;
}
main.split .stats-row { opacity: 1; }
.stat { font-size: 12px; color: #777; }
.stat strong {
  color: var(--spark); font-size: 20px; display: block;
  font-family: 'Syne', sans-serif;
}

/* ── DIVIDER ── */
.divider {
  width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  margin: 20px 0; opacity: 0; transition: opacity 0.4s;
}
main.split .divider { opacity: 1; }

/* ── SOURCE TAGS ── */
.source-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; padding: 3px 9px; border-radius: 20px;
  letter-spacing: 0.5px;
}
.source-mapped {
  background: rgba(46,204,113,0.1); color: var(--green);
  border: 1px solid rgba(46,204,113,0.2);
}
.source-global {
  background: rgba(255,140,66,0.1); color: var(--glow);
  border: 1px solid rgba(255,140,66,0.2);
}

/* ── RESULT CARD ── */
.result-card {
  background: #161616;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px; padding: 16px 18px;
  display: grid; grid-template-rows: auto auto auto;
  gap: 8px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  animation: cardIn 0.35s ease both;
  cursor: default;
}
.result-card:hover {
  border-color: rgba(255,94,26,0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.card-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 600;
  line-height: 1.4; color: #FFFFFF; flex: 1;
}
.card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.icon-btn {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.1); background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s; color: #666;
  text-decoration: none;
}
.icon-btn:hover {
  border-color: var(--primary); color: var(--primary);
  background: rgba(255,94,26,0.08);
}
.icon-btn svg { width: 13px; height: 13px; }
.icon-btn.copied {
  border-color: var(--green); color: var(--green);
  background: rgba(46,204,113,0.08);
}

.card-body {
  font-size: 12px; color: #AAAAAA; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.meta-pill {
  font-size: 11px; padding: 3px 9px;
  border-radius: 20px; letter-spacing: 0.3px;
}
.meta-sub {
  background: rgba(255,140,66,0.08);
  color: var(--glow); border: 1px solid rgba(255,140,66,0.2);
}
.meta-author {
  background: rgba(255,255,255,0.04);
  color: #777; border: 1px solid rgba(255,255,255,0.08);
}
.meta-time { color: #555; font-size: 11px; margin-left: auto; }
.meta-comments {
  background: rgba(255,255,255,0.03);
  color: #777; border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 4px;
}

/* ── EXPORT BUTTONS ── */
.export-wrap { display: flex; gap: 8px; }
.export-btn {
  font-family: 'DM Mono', monospace; font-size: 11px;
  background: rgba(255,94,26,0.1); color: var(--primary);
  border: 1px solid rgba(255,94,26,0.3);
  padding: 8px 14px; border-radius: 8px;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.export-btn:hover {
  background: rgba(255,94,26,0.2);
  box-shadow: 0 0 16px rgba(255,94,26,0.2);
}
.export-btn svg { width: 13px; height: 13px; }

/* ── CLOSE BUTTON ── */
#close-btn {
  font-family: 'DM Mono', monospace; font-size: 11px;
  background: transparent; color: #666;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 14px; border-radius: 8px;
  cursor: pointer; transition: all 0.2s;
  display: none; align-items: center; gap: 6px;
  white-space: nowrap;
}
#close-btn:hover { border-color: rgba(255,255,255,0.2); color: #999; }
main.split #close-btn { display: flex; }

/* ── SCRAPING LOG ── */
#scrape-log {
  display: none; flex-direction: column; gap: 12px;
  padding: 32px 28px;
}
#scrape-log.show { display: flex; }

.scrape-step {
  display: flex; align-items: flex-start; gap: 14px;
  animation: stepIn 0.4s ease both;
  font-size: 14px; color: #555; line-height: 1.5;
}
.scrape-step.active { color: #FFFFFF; }
.scrape-step.done   { color: #444; }

.step-orb {
  width: 8px; height: 8px; border-radius: 50%;
  background: #333; flex-shrink: 0; margin-top: 5px;
  transition: background 0.3s;
}
.scrape-step.active .step-orb {
  background: var(--primary);
  animation: pulseOrb 1s ease infinite;
}
.scrape-step.done .step-orb { background: var(--green); animation: none; }

.step-text { flex: 1; }
.step-detail {
  font-size: 11px; color: #444; margin-top: 3px;
  font-style: italic;
}

/* ── LOADING STATE ── */
#loading {
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  height: 200px; gap: 16px;
}
#loading.show { display: flex; }
.loader-ring {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #222; border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
.loader-text { font-size: 12px; color: #666; }

/* ── LOAD MORE ── */
#load-more-wrap {
  display: none; justify-content: center;
  padding: 16px 0 12px;
}
#load-more-wrap.show { display: flex; }
#load-more-btn {
  font-family: 'DM Mono', monospace; font-size: 12px;
  background: rgba(255,255,255,0.04); color: #888;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 12px 28px; border-radius: 10px;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 8px;
}
#load-more-btn:hover {
  border-color: var(--primary); color: var(--primary);
  background: rgba(255,94,26,0.06);
}
#load-more-btn.loading { pointer-events: none; opacity: 0.6; }
.load-more-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #333; border-top-color: var(--primary);
  animation: spin 0.7s linear infinite; display: none;
}
#load-more-btn.loading .load-more-spinner { display: block; }
#load-more-btn.loading .load-more-icon { display: none; }

/* ── EMPTY STATE ── */
#empty-state {
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  height: 300px; gap: 14px; text-align: center; padding: 40px;
}
#empty-state.show { display: flex; }
.empty-icon { font-size: 38px; opacity: 0.25; }
.empty-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 700; color: #555;
}
.empty-sub { font-size: 13px; color: #444; line-height: 1.7; }

/* ── SIGNIN NUDGE ── */
#signin-nudge {
  display: none; margin: 4px 0 8px;
  background: rgba(255,94,26,0.05);
  border: 1px solid rgba(255,94,26,0.15);
  border-radius: 12px; padding: 16px 20px;
  gap: 12px; align-items: center;
}
#signin-nudge.show { display: flex; }
.nudge-text { font-size: 13px; color: #888; line-height: 1.5; flex: 1; }
.nudge-text strong { color: #FFFFFF; }
.nudge-btn {
  font-family: 'DM Mono', monospace; font-size: 11px;
  background: rgba(255,94,26,0.15); color: var(--primary);
  border: 1px solid rgba(255,94,26,0.35);
  padding: 9px 16px; border-radius: 8px;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.nudge-btn:hover { background: rgba(255,94,26,0.25); }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 36px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1A1A1A; border: 1px solid #333;
  border-radius: 8px; padding: 11px 22px;
  font-size: 13px; color: #FFFFFF;
  display: flex; align-items: center; gap: 9px;
  opacity: 0; transition: all 0.3s;
  z-index: 1000; pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
}

/* ── WELCOME MODAL ── */
#welcome-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(20px);
  z-index: 500; display: flex;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
#welcome-modal.show { opacity: 1; pointer-events: all; }

.modal-box {
  background: #161616;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px; padding: 52px 44px;
  max-width: 480px; width: 90%;
  text-align: center;
  box-shadow: 0 0 120px rgba(255,94,26,0.08);
  animation: fadeUp 0.4s ease both;
}
.modal-icon { font-size: 44px; margin-bottom: 24px; }
.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 32px; font-weight: 800;
  line-height: 1.15; margin-bottom: 20px;
  letter-spacing: -1px; color: #FFFFFF;
}
.modal-title .highlight {
  color: var(--primary);
  -webkit-text-fill-color: var(--primary);
  background: none;
}
.modal-body {
  font-size: 15px; color: #AAAAAA;
  line-height: 1.8; margin-bottom: 16px;
}
.modal-signature {
  font-size: 13px; color: #555;
  margin-bottom: 32px; font-style: italic;
}
.modal-close {
  font-family: 'DM Mono', monospace; font-size: 14px;
  background: var(--primary);
  color: white; border: none;
  padding: 16px 32px; border-radius: 12px;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 0 32px rgba(255,94,26,0.3); width: 100%;
  letter-spacing: 0.3px;
}
.modal-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 48px rgba(255,94,26,0.5);
  background: var(--glow);
}

/* ── MOBILE BACK BUTTON ── */
#mobile-back-btn {
  display: none;
  font-family: 'DM Mono', monospace; font-size: 12px;
  background: transparent; color: #888;
  border: none; cursor: pointer; padding: 0;
}
@media (max-width: 768px) {
  #mobile-back-btn { display: flex; align-items: center; gap: 6px; }
  main:not(.split) #mobile-back-btn { display: none; }
}