/* ======================== */
/*       BASE CSS           */
/* ======================== */

* {
  box-sizing: border-box;
}

:root {
  --bg-gradient-start: #222;
  --bg-gradient-mid: #111;
  --bg-gradient-end: #050505;

  --accent: #4f9cff;
  --accent-soft: rgba(79, 156, 255, 0.12);
  --accent-strong: rgba(79, 156, 255, 0.45);

  --border-subtle: #333;

  --text-main: #f5f5f5;
  --text-muted: #a5a5a5;

  --card-bg: rgba(0, 0, 0, 0.75);
  --card-bg-soft: rgba(0, 0, 0, 0.55);

  --shadow-strong: 0 18px 45px rgba(0, 0, 0, 0.8);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.65);

  --privacy-high-color: #3dd68c;
  --privacy-med-color: #f5c451;
  --privacy-low-color: #ff5a5f;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, var(--bg-gradient-start) 0, var(--bg-gradient-mid) 40%, var(--bg-gradient-end) 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* ======================== */
/*     PAGE LAYOUT          */
/* ======================== */

.page.start-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page.start-centered .search-panel {
  margin-top: 15vh;
}

.page.search-active {
  display: flex;
  flex-direction: column;
  align-items: center;   /* centre proprement */
  width: 100%;
  gap: 22px;             /* espace propre entre bloc recherche et résultats */
  padding-top: 20px;
}

@media (max-width: 900px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    max-width: 650px;
  }
}

/* ======================== */
/*      SEARCH PANEL        */
/* ======================== */

.search-panel {
  width: 100%;
  max-width: 720px;        /* 🔥 largeur fixe → plus de déformation */
  margin: 0 auto;
}

/* Logo */

.logo-wrapper {
  text-align: center;
  margin-bottom: 4px;
}

.logo {
  width: 180px;
  height: auto;
  border-radius: 6px;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.65));
}

.subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ======================== */
/*  MOTORS BUTTONS & PILLS  */
/* ======================== */

.engine-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.engine-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.engine-btn {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 7px 14px;
  font-size: 12.5px;
  cursor: pointer;
  background: rgba(25, 25, 25, 0.85);
  color: #ddd;
  opacity: 0.9;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.engine-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(79,156,255,0.45);
}

.engine-btn:hover {
  border-color: var(--accent);
  opacity: 1;
  transform: translateY(-1px);
}

.engine-label {
  font-weight: 500;
}

.privacy-pill {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.9;
}

.engine-btn[data-privacy="high"] .privacy-pill {
  background: rgba(61, 223, 156, 0.15);
  color: #3DDF9C;
  border: 1px solid rgba(61, 223, 156, 0.45);
}

.engine-btn[data-privacy="medium"] .privacy-pill {
  background: rgba(113, 225, 210, 0.15);
  color: #71E1D2;
  border: 1px solid rgba(113, 225, 210, 0.45);
}

.engine-btn[data-engine="qwant"] .privacy-pill {
  background: rgba(232, 165, 92, 0.16);
  color: #E8A55C;
  border: 1px solid rgba(232, 165, 92, 0.45);
}

.engine-btn[data-privacy="low"] .privacy-pill {
  background: rgba(255, 84, 111, 0.16);
  color: #FF546F;
  border: 1px solid rgba(255, 84, 111, 0.45);
}

.engine-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* ======================== */
/*      SEARCH BAR          */
/* ======================== */

.search-form {
  margin-top: 4px;
}

.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.search-input {
  flex: 1;
  padding: 14px 16px;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  font-size: 16px;
  outline: none;
  transition: all 0.12s ease;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79,156,255,0.35);
  background: rgba(7, 7, 7, 0.95);
}

.search-button {
  padding: 0 26px;
  height: 46px;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  cursor: pointer;
  background: linear-gradient(135deg, #4f9cff, #70b5ff);
  color: #060606;
  font-weight: 600;
  transition: 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(79,156,255,0.35);
}

.search-button:hover {
  background: linear-gradient(135deg, #6bafff, #90c6ff);
  transform: translateY(-1px);
}

/* ======================== */
/*         TABS             */
/* ======================== */

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.tab {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.12s ease;
}

.tab.disabled {
  opacity: 0.45;
  cursor: default;
}

.tab:not(.disabled):hover {
  color: #fff;
  border-color: var(--border-subtle);
  background: rgba(20, 20, 20, 0.9);
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #fff;
}

/* ======================== */
/*     RESULTS PANEL        */
/* ======================== */


.results-panel {
  width: 100%;
  max-width: 900px;        /* 🔥 largeur élégante pour les résultats */
  margin: 0 auto;
}

.results-panel.hidden {
  display: none;
}

/* Header */

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 10px;
}

.results-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.results-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* ======================== */
/*      RESULTS LIST        */
/* ======================== */

.results-list {
  margin-top: 4px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding-right: 4px;
}

.result-card {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  background: rgba(10,10,10,0.85);
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.08s ease;
}

.result-card:hover {
  background: rgba(20,20,20,0.9);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.55);
}

.result-title {
  margin: 0 0 4px;
  font-size: 15px;
}

.result-title a {
  color: #a9c9ff;
  text-decoration: none;
}

.result-title a:hover {
  text-decoration: underline;
}

.result-url {
  font-size: 11px;
  color: #77b36a;
  margin-bottom: 4px;
  word-break: break-all;
}

.result-snippet {
  font-size: 13px;
  color: #dddddd;
  margin-bottom: 4px;
}

.result-footer {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

/* ======================== */
/*     IMAGE RESULTS        */
/* ======================== */

.result-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.result-image-card {
  border-radius: 14px;
  overflow: hidden;
  background: rgba(15, 15, 15, 0.90);
  border: 1px solid rgba(255,255,255,0.06);

  display: flex;
  flex-direction: column;

  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
  cursor: pointer;
}

.result-image-card:hover {
  transform: translateY(-3px);
  border-color: rgba(79,156,255,0.35);
  box-shadow:
    0 6px 18px rgba(0,0,0,0.55),
    0 0 12px rgba(79,156,255,0.12);
}

.result-image-card img {
  width: 100%;

  /* Hauteur harmonisée */
  height: 155px;
  max-height: 155px;

  /* Rendu premium */
  object-fit: cover;
  object-position: center;

  display: block;
  border-bottom: 1px solid rgba(255,255,255,0.05);

  transition: transform 0.25s ease;
}

.result-image-card:hover img {
  transform: scale(1.04);
}

.result-image-caption {
  padding: 10px 10px 12px;
  font-size: 11.5px;
  line-height: 1.35;
  color: #e6e6e6;

  opacity: 0.88;

  max-height: 58px;
  overflow: hidden;

  backdrop-filter: blur(4px);
}

/* ======================== */
/*      VARIOUS STATES      */
/* ======================== */

.placeholder {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 40px;
}

.loading {
  text-align: center;
  margin-top: 25px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

.error-message {
  margin-top: 25px;
  font-size: 13px;
  color: #ff8f8f;
  text-align: center;
}

/* ======================== */
/*         FOOTER           */
/* ======================== */

.footer {
  margin-top: 10px;
  text-align: center;
  font-size: 11px;
  opacity: 0.7;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ======================== */
/*        RESPONSIVE        */
/* ======================== */

@media (max-width: 768px) {
  .search-panel {
    padding: 20px;
  }

  .results-panel {
    padding: 16px;
  }

  .search-row {
    flex-direction: column;
  }

  .search-button {
    width: 100%;
    padding: 10px 16px;
  }
}

/* ======================== */
/*        ANIMATIONS        */
/* ======================== */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================= */
/*   BOUTON SCROLL TO TOP    */
/* ========================= */

.scroll-top-btn {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 42px;
  height: 42px;

  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);

  color: #e8e8e8;
  font-size: 22px;
  line-height: 42px;
  text-align: center;
  cursor: pointer;

  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .2s ease, border-color .2s ease;
  z-index: 99999;
}

.scroll-top-btn:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  color: var(--accent);
}

/* visible */
.scroll-top-btn.show {
  opacity: 1;
  pointer-events: all;
}

.neon-arrow:hover svg {
  filter: drop-shadow(0 0 6px var(--accent));
}