/* ===== CANVAS GRILLE ANIMÉE (copié depuis index.html) ===== */
#gridPulseCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===== BARRE DE RECHERCHE - STYLE ÉPURÉ ===== */

.search-box {
  position: fixed;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: max-content;
  z-index: 100;
  transition:
    opacity 0.6s ease,
    filter 0.6s ease,
    transform 0.6s ease;
}



/* État quand les résultats sont affichés - disparaît avec flou */
.search-box.has-results {
  opacity: 0;
  filter: blur(20px);
  transform: translate(-50%, -50%) scale(0.9);
  pointer-events: none;
}

/* Animation pour la navbar */
.search-box.has-results .search-navbar {
  opacity: 0;
  filter: blur(20px);
  transform: scale(0.9);
  pointer-events: none;
}

/* Bouton de retour en haut à droite - discret */
.search-back-btn {
  position: fixed;
  top: 25px;
  right: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
  transition:
    opacity 0.3s ease 0.6s,
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s;
}

/* Afficher le bouton quand has-results */
body.search-active .search-back-btn {
  opacity: 0.7;
  transform: scale(1);
  pointer-events: all;
}

.search-back-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.search-back-btn:active {
  transform: scale(0.95);
}

.search-back-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.search-back-btn:hover svg {
  transform: translateX(-2px);
}

/* ===== BARRE DE RECHERCHE STYLE TOP-NAVBAR (design identique) ===== */
.search-navbar {
  position: relative;
  max-width: max-content;
  width: auto;
  margin: 0 auto;
  padding: 8px 8px 8px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50px;
  transition: all 0.3s ease;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-navbar:hover {
  transform: scale(1.01);
}

/* Logo à gauche (icône de recherche) */
.search-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  flex-shrink: 0;
}

/* Form de recherche */
.search-form-navbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

/* Boutons de type dans la navbar */
.search-bar-navbar .type-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  flex-shrink: 0;
}

.search-bar-navbar .type-btn:hover:not(:disabled) {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.search-bar-navbar .type-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.search-bar-navbar .type-btn:active:not(:disabled) {
  transform: scale(0.95);
}

/* Bouton verrouillé (Premium) */
.search-bar-navbar .type-btn-locked {
  cursor: not-allowed;
  opacity: 0.6;
}

.search-bar-navbar .type-btn-locked .icon-main {
  opacity: 0.5;
}

.search-bar-navbar .type-btn-locked .lock-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ef4444;
  opacity: 0.9;
  pointer-events: none;
}

/* Séparateur */
.search-separator {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

/* Champ de recherche */
.search-field-navbar {
  flex: 1;
  min-width: 650px;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 15px;
  font-weight: 400;
  padding: 6px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.search-field-navbar::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-field-navbar:focus {
  outline: none;
}

/* Bouton submit (flèche) */
.search-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.search-submit-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #3b82f6;
  transform: scale(1.05);
}

.search-submit-btn:active {
  transform: scale(0.95);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== CATÉGORIES ===== */
.search-categories-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  min-height: 48px;
}

/* Bouton toggle (style noir comme la barre de recherche) */
.category-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  flex-shrink: 0;
}

.category-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
  color: #3b82f6;
  transform: scale(1.05);
}

.category-toggle-btn svg {
  transition: transform 0.3s ease;
}

/* Rotation de l'icône quand ouvert */
.category-toggle-btn.active svg {
  transform: rotate(90deg);
}

/* Container des catégories */
.category-pills {
  display: inline-flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 6px;
  opacity: 1;
  transform: scale(1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 800px;
  position: relative;
}

/* État caché */
.category-pills.hidden {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  max-width: 0;
  padding: 0;
  border: none;
}

/* Indicateur de sélection animé (bulle bleue qui glisse) */
.category-pills::before {
  content: '';
  position: absolute;
  top: 6px;
  left: var(--indicator-left, 6px);
  width: var(--indicator-width, 0px);
  height: calc(100% - 12px);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.25));
  border-radius: 50px;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
  z-index: 0;
}

/* Chips individuelles */
.category-chip {
  padding: 8px 18px;
  background: transparent;
  border: none;
  border-radius: 50px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.category-chip:hover {
  color: #ffffff;
}

.category-chip.active {
  color: #3b82f6;
}

/* ===== BARRE DE RECHERCHE INTÉGRÉE ===== */
.search-bar {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 8px 8px 8px 20px;
  transition: all 0.3s ease;
}

.search-bar:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-field {
  flex: 1;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #ffffff;
  font-size: 17px;
  font-weight: 400;
  padding: 12px 20px 12px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  box-shadow: none !important;
}

.search-field:focus,
.search-field:active,
.search-field:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
}

.search-field::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

/* Supprimer les styles de sélection Chrome */
.search-field::-webkit-search-decoration,
.search-field::-webkit-search-cancel-button,
.search-field::-webkit-search-results-button,
.search-field::-webkit-search-results-decoration {
  display: none;
}

/* Supprimer l'autofill background */
.search-field:-webkit-autofill,
.search-field:-webkit-autofill:hover,
.search-field:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px transparent inset !important;
  -webkit-text-fill-color: #ffffff !important;
  background-color: transparent !important;
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
  flex-shrink: 0;
}

.search-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.35);
}

.search-btn:active {
  transform: scale(0.98);
}

/* ===== ANIMATIONS ===== */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* ===== COMPTEUR DE CARACTÈRES ===== */
.search-char-counter {
  text-align: left;
  margin-top: 8px;
  margin-left: 20px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.3s ease;
}

.type-indicator {
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.5);
}

#typeText {
  color: #10b981;
  font-weight: 600;
}

.search-char-counter.success {
  color: #10b981;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.search-char-counter.warning {
  color: #ef4444;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/* ===== ZONE DES RÉSULTATS ===== */
.hero-result {
  position: fixed;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  width: 95%;
  max-width: 1400px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease 0.8s;
  z-index: 50;
}

.hero-result:not(:empty) {
  opacity: 1;
  pointer-events: all;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .search-box {
    width: 95%;
  }

  .search-box.has-results {
    top: 80px;
  }

  .hero-result {
    top: 240px;
    max-height: calc(100vh - 260px);
  }

  .category-pills {
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
  }

  .category-chip {
    padding: 7px 14px;
    font-size: 13px;
  }

  .search-bar {
    padding: 6px 6px 6px 20px;
  }

  .search-field {
    font-size: 16px;
    padding: 10px 12px 10px 0;
  }

  .search-btn {
    width: 44px;
    height: 44px;
  }

  .modern-results-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .modern-card-header {
    padding: 14px 16px;
  }

  .modern-card-body {
    padding: 16px;
  }

  .source-icon {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
}

/* ===== NOUVEAU FORMAT DE RÉSULTATS ===== */
.modern-results-container {
  width: 100%;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header des résultats */
.modern-results-header {
  margin-bottom: 24px;
}

.results-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.results-title svg {
  color: #3b82f6;
}

.results-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 50px;
  color: #3b82f6;
  font-size: 14px;
  font-weight: 600;
}

/* Grille de cartes */
.modern-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
  width: 100%;
}

/* Carte de résultat */
.modern-result-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.modern-result-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Header de la carte */
.modern-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.card-source {
  display: flex;
  align-items: center;
  gap: 12px;
}

.source-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-radius: 10px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.source-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.source-name {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

.source-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.modern-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modern-copy-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}

.modern-copy-btn.copied {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
}

/* Body de la carte */
.modern-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Champ individuel */
.modern-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.4);
}

.field-value {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  word-break: break-all;
  font-family: 'Courier New', monospace;
}

/* ===== ACCESSIBILITÉ ===== */
@media (prefers-reduced-motion: reduce) {
  .search-box {
    animation: none;
  }

  .search-btn:hover {
    transform: none;
  }

  .modern-results-container {
    animation: none;
  }

  .modern-result-card:hover {
    transform: none;
  }
}
