/*
# Copyright 2025 Andreas Feldt

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

#     http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/

@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap");

/* Cyber-terminal palette: violet/magenta on near-black */
:root {
  --bg-color: #0b0812;
  --surface: #140f21;
  --surface-alt: #1b1530;
  --border-color: rgba(124, 92, 255, 0.18);
  --border-soft: rgba(255, 255, 255, 0.07);
  --accent-primary: #7c5cff;
  --accent-primary-dim: #5b3fd6;
  --accent-secondary: #ff3ec8;
  --status-ok: #3ddc84;
  --danger: #ff3e3e;
  --text-color: #f3f1f9;
  --text-muted: rgba(213, 206, 230, 0.55);
  --radius: 6px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

::selection {
  background: rgba(124, 92, 255, 0.4);
  color: #0c081a;
}

html, body {
  width: 100%;
  min-height: 100%;
  font-family: "JetBrains Mono", "Courier New", monospace;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(124, 92, 255, 0.1), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 15%, rgba(255, 62, 200, 0.07), transparent 55%),
    linear-gradient(rgba(124, 92, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 92, 255, 0.035) 1px, transparent 1px);
  background-repeat: no-repeat, no-repeat, repeat, repeat;
  background-size: auto, auto, 42px 42px, 42px 42px;
  background-attachment: fixed;
  color: var(--text-color);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 255, 0.3);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 92, 255, 0.5);
}

.display-font,
.logo,
.tool-title,
.hero-title,
.hero-kicker,
.stat-value,
.widget-header h2,
.provider-name,
.site-footer {
  font-family: "Chakra Petch", "JetBrains Mono", sans-serif;
}

.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main {
  flex: 1;
  padding-bottom: 3rem;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 1.75rem;
  background: linear-gradient(180deg, rgba(20, 15, 33, 0.95), rgba(10, 8, 16, 0.9));
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  text-shadow: 0 0 8px rgba(124, 92, 255, 0.55), 0 0 20px rgba(124, 92, 255, 0.25);
  text-decoration: none;
  flex-shrink: 0;
}

.logo::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background: transparent;
  border: 2px solid var(--accent-primary);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  filter: drop-shadow(0 0 5px rgba(124, 92, 255, 0.7));
}

.logo-cursor {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  background: var(--accent-secondary);
  box-shadow: 0 0 6px rgba(255, 62, 200, 0.7);
  animation: cursor-blink 1.1s steps(1) infinite;
  vertical-align: -0.15em;
}

@keyframes cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.topbar-search {
  flex: 1;
  display: flex;
  align-items: center;
}

.topbar-search input[type="text"] {
  flex: 1;
  min-width: 0;
}

@media (max-width: 56rem) {
  .topbar {
    flex-wrap: wrap;
  }
}

/* ---------- Topbar account ---------- */
.topbar-account {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.topbar-account-link {
  color: var(--text-color);
  text-decoration: none;
  font-family: "Chakra Petch", sans-serif;
  font-weight: 500;
  transition: color 0.15s ease;
}

.topbar-account-link:hover {
  color: var(--accent-primary);
}

.topbar-logout-form {
  display: inline-flex;
}

.topbar-logout-btn {
  background: none;
  border: none;
  clip-path: none;
  filter: none;
  padding: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.topbar-logout-btn:hover {
  transform: none;
  color: var(--accent-secondary);
  text-decoration-color: var(--accent-secondary);
}

/* ---------- Flag pill ---------- */
.flag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: "Chakra Petch", sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.flag-pill svg {
  flex-shrink: 0;
}

.flag-pill--clean {
  color: var(--status-ok);
  background: rgba(61, 220, 132, 0.1);
  border: 1px solid rgba(61, 220, 132, 0.35);
}

.flag-pill--flag {
  color: var(--danger);
  background: rgba(255, 62, 62, 0.12);
  border: 1px solid rgba(255, 62, 62, 0.4);
  animation: status-pulse 2.4s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- Search bar (shared look) ---------- */
.topbar-search,
.hero-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-search,
.hero-search {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.topbar-search {
  padding: 0.3rem 0.3rem 0.3rem 1rem;
}

.hero-search {
  padding: 0.5rem 0.5rem 0.5rem 1.4rem;
  width: 100%;
  max-width: 34rem;
}

.topbar-search:focus-within,
.hero-search:focus-within {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12), 0 0 18px rgba(124, 92, 255, 0.2);
}

.hero-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.topbar-search button,
.hero-search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-search button {
  padding: 0.55rem;
}

input[type="text"] {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-color);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  width: 100%;
  min-width: 0;
}

.hero-search input[type="text"] {
  font-size: 1.05rem;
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

button {
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  font-family: "Chakra Petch", sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: none;
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-dim));
  color: #0d0a18;
  cursor: pointer;
  filter: drop-shadow(0 0 10px rgba(124, 92, 255, 0.45));
  transition: transform 0.1s ease-in-out, filter 0.15s ease;
}

button:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 16px rgba(124, 92, 255, 0.7));
}

button.btn-danger {
  padding: 0.4rem 0.9rem;
  font-size: 0.7rem;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  background: rgba(255, 62, 62, 0.1);
  border: 1px solid rgba(255, 62, 62, 0.4);
  color: var(--danger);
  filter: none;
}

button.btn-danger:hover {
  background: rgba(255, 62, 62, 0.2);
  filter: none;
}

/* ---------- Hero (empty state) ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 4.5rem 1.5rem 3rem;
  text-align: center;
}

.hero-kicker {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-secondary);
  text-shadow: 0 0 8px rgba(255, 62, 200, 0.5);
}

.hero-title {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.accent-letter {
  color: var(--accent-primary);
  text-shadow: 0 0 10px rgba(124, 92, 255, 0.6);
}

/* ---------- Stat row ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (max-width: 56rem) {
  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 30rem) {
  .stat-row {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: linear-gradient(160deg, var(--surface) 0%, #0b0912 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 92, 255, 0.45);
}

.stat-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  background: rgba(124, 92, 255, 0.1);
  border: 1px solid rgba(124, 92, 255, 0.3);
}

.stat-icon--secondary {
  color: var(--accent-secondary);
  background: rgba(255, 62, 200, 0.1);
  border-color: rgba(255, 62, 200, 0.35);
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.15;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.1rem;
}

/* ---------- Widget row ---------- */
.widget-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
  max-width: 68rem;
  margin: 1.25rem auto 0;
  padding: 0 1.5rem;
  text-align: left;
}

@media (max-width: 72rem) {
  .widget-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 56rem) {
  .widget-row {
    grid-template-columns: 1fr;
  }
}

.widget-card {
  background: linear-gradient(160deg, var(--surface) 0%, #0b0912 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem 1.3rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.widget-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.widget-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.widget-header h2::before {
  content: "> ";
  color: var(--accent-primary);
}

.widget-count {
  font-size: 0.78rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--accent-primary);
  background: rgba(124, 92, 255, 0.1);
  border: 1px solid rgba(124, 92, 255, 0.3);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  padding: 0.1rem 0.6rem;
}

.provider-list {
  list-style: none;
  max-height: 16rem;
  overflow-y: auto;
}

.provider-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0.1rem;
  font-size: 0.85rem;
}

.provider-row + .provider-row {
  border-top: 1px solid var(--border-soft);
}

.provider-name {
  font-weight: 500;
  white-space: nowrap;
}

.provider-types {
  color: var(--text-muted);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  font-family: "Chakra Petch", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent-secondary);
  background: rgba(255, 62, 200, 0.1);
  border: 1px solid rgba(255, 62, 200, 0.3);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  padding: 0.3rem 0.85rem;
}

.widget-hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ---------- Results ---------- */
.verdict-query {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 28rem;
  overflow-wrap: anywhere;
}

.verdict-query strong {
  color: var(--accent-primary);
  font-weight: 500;
}

.results {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Deep Research ---------- */
.deep-research {
  width: 100%;
  max-width: 90rem;
  margin: 1.75rem auto 0;
}

/* Shared by both "> Results" and "> Deep Research" section titles, so they
   can never visually drift apart from each other. */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  max-width: 90rem;
  margin: 0 auto 0.75rem;
  padding: 0 1.5rem;
}

.section-header h2 {
  font-family: "Chakra Petch", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
}

.section-header h2::before {
  content: "> ";
  color: var(--accent-primary);
}

.deep-research-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0 1.5rem;
}

.research-card {
  width: 100%;
  max-width: 22rem;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.research-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  padding: 0.8rem 1rem;
  background: none;
  border: none;
  clip-path: none;
  filter: none;
  border-radius: 0;
  text-transform: none;
  letter-spacing: normal;
  font-family: "Chakra Petch", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.15s ease;
}

.research-toggle:hover {
  background: var(--surface-alt);
  transform: none;
  filter: none;
}

.research-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.research-card[data-expanded="true"] .research-chevron {
  transform: rotate(180deg);
}

.research-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.85rem;
}

.research-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.research-pending {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.research-pending .skeleton-spinner svg {
  animation: skeleton-spin 1s linear infinite;
}

.research-error {
  font-size: 0.82rem;
  color: var(--danger);
  background: rgba(255, 62, 62, 0.1);
  border: 1px solid rgba(255, 62, 62, 0.35);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  width: 100%;
}

.research-screenshot {
  width: 100%;
  max-height: 16rem;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--surface-alt);
  cursor: zoom-in;
  transition: border-color 0.15s ease;
}

.research-screenshot:hover {
  border-color: var(--accent-primary);
}

.research-report-link {
  font-size: 0.8rem;
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.research-report-link:hover {
  text-decoration: underline;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  z-index: 1000;
  cursor: zoom-out;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.75rem;
  background: none;
  border: none;
  clip-path: none;
  filter: none;
  padding: 0;
  width: 2.2rem;
  height: 2.2rem;
  line-height: 1;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.lightbox-close:hover {
  color: var(--text-color);
  transform: none;
  filter: none;
}

/* ---------- Verdict bar ---------- */
.verdict-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  width: 100%;
  max-width: 90rem;
  margin: 1.5rem auto 0;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(160deg, var(--surface) 0%, #0b0912 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: border-color 0.25s ease;
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding-left: 1.1rem;
  border-left: 1px solid var(--border-soft);
  font-family: "Chakra Petch", sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
}

.verdict-icon {
  display: inline-flex;
  color: var(--text-muted);
}

.verdict-icon svg {
  width: 18px;
  height: 18px;
}

.verdict-bar--flagged .verdict-icon svg {
  animation: status-pulse 2.4s ease-in-out infinite;
}

.verdict-bar--clean {
  border-color: rgba(61, 220, 132, 0.4);
}

.verdict-bar--clean .verdict-icon {
  color: var(--status-ok);
}

.verdict-bar--flagged {
  border-color: rgba(255, 62, 62, 0.45);
}

.verdict-bar--flagged .verdict-icon {
  color: var(--danger);
}

.verdict-meta {
  flex: 1;
  min-width: 12rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.results-toolbar {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-left: auto;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.filter-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 2rem;
  height: 1.1rem;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.filter-toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

.filter-toggle input[type="checkbox"]:checked {
  background: rgba(124, 92, 255, 0.25);
  border-color: var(--accent-primary);
}

.filter-toggle input[type="checkbox"]:checked::before {
  transform: translateX(0.9rem);
  background: var(--accent-primary);
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.sort-control select {
  background: var(--surface-alt);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.76rem;
  cursor: pointer;
}

@media (max-width: 30rem) {
  .verdict-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .verdict-query {
    max-width: 100%;
  }

  .verdict-badge {
    padding-left: 0;
    border-left: none;
  }

  .results-toolbar {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
}

/* ---------- Empty state ---------- */
.empty-state {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  color: var(--accent-primary);
  opacity: 0.55;
}

.empty-state-title {
  font-family: "Chakra Petch", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-color);
}

.empty-state-hint {
  font-size: 0.82rem;
  line-height: 1.5;
  max-width: 28rem;
}

.results-grid {
  columns: 3;
  column-gap: 1.25rem;
  width: 100%;
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 1.5rem 1.5rem;
}

@media (max-width: 64rem) {
  .results-grid {
    columns: 2;
  }
}

@media (max-width: 40rem) {
  .results-grid {
    columns: 1;
  }
}

/* ---------- Result cards ---------- */
.tool-card {
  position: relative;
  background: linear-gradient(160deg, var(--surface) 0%, #0b0912 100%);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.3rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  overflow: hidden;
  break-inside: avoid;
  margin-bottom: 1.25rem;
  text-align: left;
  animation: card-in 0.6s ease-out both;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  opacity: 0.85;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 92, 255, 0.5);
  box-shadow: 0 14px 32px rgba(124, 92, 255, 0.12), 0 8px 24px rgba(0, 0, 0, 0.45);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.tool-card-header-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.tool-card-header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.tool-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Chakra Petch", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(255, 62, 200, 0.18));
  border: 1px solid rgba(124, 92, 255, 0.3);
}

.tool-card-header .tool-title {
  margin-bottom: 0;
}

.copy-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0.1rem;
  clip-path: none;
  filter: none;
  box-shadow: none;
  color: var(--text-color);
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s, transform 0.1s ease-in-out;
  line-height: 0;
  vertical-align: middle;
}

.copy-btn:hover {
  opacity: 1;
  color: var(--accent-primary);
  transform: scale(1.15);
}

.copy-btn.copied {
  opacity: 1;
  color: var(--accent-primary);
}

.tool-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tool link styling: magenta underline/glow */
.tool-card a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent-secondary);
  text-underline-offset: 0.15em;
  text-decoration-thickness: 2px;
}

/* No extra glow on tool text; only underline is styled */
.tool-card a .tool-title {
  text-shadow: none;
}

.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.tool-table th,
.tool-table td {
  padding: 0.45rem 0.25rem;
  text-align: left;
  vertical-align: top;
  /* Allow very long values (hashes, URLs, etc.) to wrap */
  word-break: break-word;
  overflow-wrap: anywhere;
}

.tool-table th {
  font-family: "Chakra Petch", sans-serif;
  font-weight: 500;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  padding-right: 0.85rem;
}

.tool-table td {
  font-family: "Chakra Petch", "JetBrains Mono", sans-serif;
  color: #e3ddee;
}

.tool-row + .tool-row th,
.tool-row + .tool-row td {
  border-top: 1px solid var(--border-soft);
}

.red-flag th {
  box-shadow: inset 3px 0 0 var(--danger);
  padding-left: 0.6rem;
}

.red-flag {
  background-color: rgba(255, 62, 62, 0.08);
}

.red-flag th,
.red-flag td {
  color: var(--danger);
}

/* ---------- Skeleton loading cards ---------- */
.tool-card--skeleton {
  cursor: default;
}

.tool-card--skeleton:hover {
  transform: none;
  border-color: var(--border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.tool-card--skeleton .tool-title {
  color: var(--text-muted);
}

.skeleton-spinner {
  display: inline-flex;
  color: var(--text-muted);
}

.skeleton-spinner svg {
  animation: skeleton-spin 1s linear infinite;
}

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

.skeleton-rows {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.skeleton-row {
  height: 0.8rem;
  border-radius: 4px;
}

.skeleton-shimmer {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.08) 25%, rgba(124, 92, 255, 0.2) 37%, rgba(124, 92, 255, 0.08) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

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

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: rgba(124, 92, 255, 0.35);
  pointer-events: none;
  z-index: 100;
}

/* ---------- Auth (login) ---------- */
.auth-section {
  display: flex;
  justify-content: center;
  padding: 4rem 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 22rem;
  text-align: center;
}

.auth-title {
  font-family: "Chakra Petch", sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1.4rem;
}

.auth-title::before {
  content: "> ";
  color: var(--accent-primary);
}

.auth-error {
  background: rgba(255, 62, 62, 0.1);
  border: 1px solid rgba(255, 62, 62, 0.35);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  margin-bottom: 1.1rem;
  text-align: left;
}

.field {
  margin-bottom: 1.1rem;
  text-align: left;
}

.field-label {
  display: block;
  font-family: "Chakra Petch", sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  color: var(--text-color);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}

.auth-card button[type="submit"] {
  width: 100%;
  margin-top: 0.3rem;
}

/* ---------- Account / API keys ---------- */
.account-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2.5rem 1.5rem 3rem;
}

.form-success {
  background: rgba(61, 220, 132, 0.08);
  border: 1px solid rgba(61, 220, 132, 0.35);
  color: var(--status-ok);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  margin-bottom: 1.1rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-field input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.admin-badge {
  display: inline-block;
  font-family: "Chakra Petch", sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-secondary);
  border: 1px solid rgba(255, 62, 200, 0.4);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

button.btn-ghost {
  padding: 0.4rem 0.9rem;
  font-size: 0.7rem;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  filter: none;
}

button.btn-ghost:hover {
  background: var(--surface-alt);
  color: var(--text-color);
  filter: none;
}

/* ---------- Confirm dialog ---------- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 10, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
}

.confirm-dialog {
  width: 100%;
  max-width: 24rem;
  background: var(--surface);
  border: 1px solid rgba(255, 62, 62, 0.4);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  padding: 1.4rem 1.5rem;
}

.confirm-title {
  font-family: "Chakra Petch", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.confirm-title::before {
  content: "> ";
  color: var(--danger);
}

.confirm-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.2rem;
  overflow-wrap: anywhere;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.api-keys-card {
  width: 100%;
  max-width: 40rem;
}

.new-key-banner {
  background: rgba(61, 220, 132, 0.08);
  border: 1px solid rgba(61, 220, 132, 0.35);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.1rem;
}

.new-key-label {
  font-size: 0.78rem;
  color: var(--status-ok);
  margin-bottom: 0.5rem;
}

.new-key-value {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

.new-key-value code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  color: var(--text-color);
}

.create-key-form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.3rem;
}

.create-key-form input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.55rem 0.8rem;
  color: var(--text-color);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.create-key-form input[type="text"]:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}

.api-key-row {
  justify-content: space-between;
  align-items: center;
}

.api-key-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
