/* ── Cyberpunk theme tokens ── */
:root {
  --bg-deep: #06080f;
  --bg-panel: rgba(12, 18, 32, 0.55);
  --neon-green: #00ff9d;
  --neon-blue: #00d4ff;
  --neon-purple: #b14cff;
  --text-primary: #e8f0ff;
  --text-muted: #8b9cb8;
  --glass-border: rgba(0, 212, 255, 0.12);
}

/* ── Ambient background ── */
body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: "Noto Sans SC", system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-grid {
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

.bg-glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}

.orb-green {
  width: 420px;
  height: 420px;
  background: rgba(0, 255, 157, 0.14);
  top: -120px;
  left: -80px;
  animation: float 12s ease-in-out infinite;
}

.orb-blue {
  width: 520px;
  height: 520px;
  background: rgba(0, 212, 255, 0.12);
  top: 20%;
  right: -160px;
  animation: float 15s ease-in-out infinite reverse;
}

.orb-purple {
  width: 360px;
  height: 360px;
  background: rgba(177, 76, 255, 0.1);
  bottom: -80px;
  left: 30%;
  animation: float 18s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, -18px) scale(1.05); }
}

/* ── Hero header ── */
.hero-title {
  font-family: "Orbitron", "Noto Sans SC", sans-serif;
  background: linear-gradient(135deg, #ffffff 0%, var(--neon-blue) 45%, var(--neon-green) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.06em;
  text-shadow: 0 0 40px rgba(0, 212, 255, 0.25);
}

.hero-glass {
  background: linear-gradient(
    135deg,
    rgba(0, 212, 255, 0.08) 0%,
    rgba(0, 255, 157, 0.05) 50%,
    rgba(177, 76, 255, 0.06) 100%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 212, 255, 0.18);
  box-shadow:
    0 0 60px rgba(0, 212, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.scanline::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 212, 255, 0.015) 2px,
    rgba(0, 212, 255, 0.015) 4px
  );
  pointer-events: none;
  border-radius: inherit;
}

/* ── News cards ── */
.news-card {
  position: relative;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 1.25rem;
  padding: 1.75rem 2rem;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  overflow: hidden;
}

.news-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    transparent 30%,
    rgba(0, 212, 255, 0) 50%,
    rgba(0, 255, 157, 0) 70%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.news-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 255, 157, 0.35);
  box-shadow:
    0 0 0 1px rgba(0, 212, 255, 0.15),
    0 0 30px rgba(0, 212, 255, 0.12),
    0 0 60px rgba(0, 255, 157, 0.08),
    0 20px 40px rgba(0, 0, 0, 0.35);
}

.news-card:hover::before {
  opacity: 1;
  background: linear-gradient(
    135deg,
    rgba(0, 212, 255, 0.6),
    rgba(0, 255, 157, 0.4),
    rgba(177, 76, 255, 0.5)
  );
}

.card-accent {
  position: absolute;
  top: 0;
  left: 2rem;
  right: 2rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-blue), var(--neon-green), transparent);
  opacity: 0.5;
  transition: opacity 0.35s ease;
}

.news-card:hover .card-accent {
  opacity: 1;
}

/* ── Source badges ── */
.badge-cls {
  background: rgba(0, 212, 255, 0.12);
  color: var(--neon-blue);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.badge-em {
  background: rgba(0, 255, 157, 0.1);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 157, 0.28);
}

.badge-xq {
  background: rgba(177, 76, 255, 0.12);
  color: #d08bff;
  border: 1px solid rgba(177, 76, 255, 0.3);
}

/* ── Keyword pills ── */
.keyword-pill {
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: var(--neon-blue);
  font-size: 0.7rem;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  letter-spacing: 0.04em;
}

/* ── CTA button ── */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #06080f;
  background: linear-gradient(135deg, var(--neon-green), var(--neon-blue));
  box-shadow: 0 0 20px rgba(0, 255, 157, 0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.25), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.btn-primary:hover {
  transform: scale(1.03);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.45), 0 0 50px rgba(0, 255, 157, 0.2);
}

.btn-primary:hover::after {
  opacity: 1;
}

/* ── Stat chips in hero ── */
.stat-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

/* ── Fade-in animation for cards ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-animate {
  animation: fadeUp 0.6s ease forwards;
  opacity: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 157, 0.35);
}

/* ── Filter bar ── */
.filter-bar {
  background: rgba(12, 18, 32, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 1.25rem;
  padding: 1.5rem 1.75rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.filter-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.65rem;
  padding: 0.6rem 0.85rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  outline: none;
  width: 100%;
}

.filter-input:focus {
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08);
}

.filter-input option {
  background: #0c1220;
}

.filter-chip {
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.25s ease;
  cursor: pointer;
}

.filter-chip:hover {
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--neon-blue);
}

.filter-chip.active {
  background: rgba(0, 255, 157, 0.1);
  border-color: rgba(0, 255, 157, 0.35);
  color: var(--neon-green);
  box-shadow: 0 0 16px rgba(0, 255, 157, 0.12);
}

.keyword-add-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 360px;
}

.keyword-add-input {
  flex: 1;
  min-width: 0;
}

.btn-add-keyword {
  white-space: nowrap;
  border-color: rgba(0, 255, 157, 0.3);
  color: var(--neon-green);
}

.keyword-chip-wrap {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  transition: all 0.25s ease;
}

.keyword-chip-wrap.active {
  border-color: rgba(0, 255, 157, 0.35);
  background: rgba(0, 255, 157, 0.08);
  box-shadow: 0 0 16px rgba(0, 255, 157, 0.12);
}

.keyword-chip-wrap .chip-label {
  border: none;
  background: transparent;
  border-radius: 0;
  padding-right: 0.35rem;
}

.keyword-chip-wrap .chip-label.active {
  background: transparent;
  box-shadow: none;
}

.chip-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  color: rgba(139, 156, 184, 0.7);
  transition: all 0.2s ease;
  cursor: pointer;
}

.chip-delete:hover {
  color: #ff6b8a;
  background: rgba(255, 107, 138, 0.15);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.65rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 212, 255, 0.2);
  transition: all 0.25s ease;
  cursor: pointer;
}

.btn-secondary:hover:not(:disabled) {
  border-color: rgba(0, 255, 157, 0.4);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-refresh.loading .refresh-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Loading & empty states ── */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  margin-bottom: 2rem;
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(0, 212, 255, 0.15);
  border-top-color: var(--neon-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: rgba(12, 18, 32, 0.35);
  border: 1px dashed rgba(0, 212, 255, 0.15);
  border-radius: 1.25rem;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

@media (max-width: 640px) {
  .filter-bar {
    padding: 1.1rem 1rem;
  }

  .news-card {
    padding: 1.25rem 1.15rem;
  }

  .hero-glass {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .keyword-add-form {
    max-width: none;
  }
}
