/* ===== NEXTUI V2 STYLE - REPRODUCTION EXACTE ===== */

/* Utilities Tailwind */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-3 { width: 0.75rem; }
.h-3 { height: 0.75rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.my-2 { margin-top: 0.25rem; margin-bottom: 0.25rem; }
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 0.5rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.max-w-xs { max-width: 20rem; }
.text-md { font-size: 1rem; line-height: 1.5rem; }
.text-small { font-size: 0.875rem; line-height: 1.25rem; }
.text-tiny { font-size: 0.75rem; line-height: 1rem; }

:root {
  /* NextUI Dark Theme Colors */
  --nextui-background: #0A0A0A;
  --nextui-foreground: #ffffff;
  --nextui-content1: #18181b;
  --nextui-content2: #27272a;
  --nextui-divider: rgba(255, 255, 255, 0.15);
  --nextui-default: #3f3f46;
  --nextui-default-foreground: #ffffff;
  --nextui-primary: #006FEE;
  --nextui-success: #17c964;
  --nextui-default-100: rgba(63, 63, 70, 0.2);
  --nextui-default-400: rgba(161, 161, 170, 0.4);
  --nextui-default-500: #71717a;

  /* Spacing */
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;

  /* Border Radius */
  --radius-small: 4px;
  --radius-medium: 6px;
  --radius-large: 8px;

  /* Shadows */
  --shadow-small: 0px 0px 5px 0px rgb(0 0 0 / 0.02), 0px 2px 10px 0px rgb(0 0 0 / 0.06), 0px 0px 1px 0px rgb(0 0 0 / 0.3);
  --shadow-medium: 0px 0px 15px 0px rgb(0 0 0 / 0.03), 0px 2px 30px 0px rgb(0 0 0 / 0.08), 0px 0px 1px 0px rgb(0 0 0 / 0.3);
  --shadow-large: 0px 0px 30px 0px rgb(0 0 0 / 0.04), 0px 30px 60px 0px rgb(0 0 0 / 0.12), 0px 0px 1px 0px rgb(0 0 0 / 0.3);
}

* {
  box-sizing: border-box;
}

/* Container */
.modern-results-wrapper {
  width: 100%;
  animation: resultsAppear 0.3s ease forwards;
}

@keyframes resultsAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* VERTICAL LAYOUT - RÉSULTATS CENTRÉS */
.apple-results-container {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: 950px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  gap: 12px !important;
}

.apple-results-container > .result-bubble-draggable {
  display: block !important;
  width: 100% !important;
  max-width: 950px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.results-masonry-container {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: 950px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  gap: 12px !important;
}

.masonry-column {
  display: contents !important;
}

/* Wrapper des bulles - forcer opacité */
.result-bubble-draggable {
  opacity: 1 !important;
  filter: none !important;
}

/* Card - SIMPLE SANS EFFET */
.result-card {
  display: flex;
  flex-direction: column !important;
  background: #121212 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 6px !important;
  padding: 16px !important;
  min-width: 0 !important;
  min-height: auto !important;
  width: 100%;
  cursor: pointer;
  overflow: hidden !important;
  position: relative !important;
}

/* Désactiver l'effet image floutée */
.result-card.has-bg-image {
  background: #121212 !important;
}

.result-card.has-bg-image::before,
.result-card.has-bg-image::after {
  display: none !important;
}

.result-card:hover {
  background: #121212 !important;
  transform: none !important;
  box-shadow: none !important;
}

.result-card {
  box-shadow: none !important;
  outline: none !important;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header - Style DETAILED-MODE */
.card-header {
  display: flex !important;
  align-items: center !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  gap: 14px !important;
  width: 100% !important;
  padding: 0 !important;
  margin-top: -8px !important;
}

/* Partie gauche: icône + infos */
.card-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex: 1 !important;
}

/* Avatar/Icône plateforme - petite à gauche sans cadre */
.card-avatar {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  color: #fff !important;
  flex-shrink: 0 !important;
  overflow: visible !important;
}

.card-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

/* Image profil par défaut - grande à droite */
.card-profile-avatar {
  width: 80px !important;
  height: 80px !important;
  min-width: 80px !important;
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.card-profile-avatar svg {
  width: 40px !important;
  height: 40px !important;
  color: rgba(255, 255, 255, 0.3) !important;
}

/* Platform Info - Style DETAILED-MODE */
.card-platform-info {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 0 !important;
  flex: 1 !important;
}

.card-platform-header {
  display: none !important;
}

.card-platform-name-wrapper {
  display: none !important;
}

.card-platform-logo-wrapper {
  display: none !important;
}

.card-platform-logo {
  display: none !important;
}

/* Nom de la source - Style DETAILED-MODE */
.card-platform-name {
  font-size: 1rem !important;
  line-height: 1.2 !important;
  font-weight: 700 !important;
  color: #fff !important;
  margin: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Nombre de champs - caché */
.card-fields-count {
  display: none !important;
}

.card-platform-url {
  position: relative;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  outline: 2px solid transparent;
  outline-offset: 2px;
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-decoration: none;
  transition: opacity 0.3s;
  color: var(--nextui-default-500);
}

.card-platform-url:hover {
  opacity: 0.8;
}

/* Divider */
/* Divider - caché */
.card-divider {
  display: none !important;
}

.card-divider.my-2 {
  display: none !important;
}

/* Body - Style DETAILED-MODE (affiche les champs) */
.card-body {
  display: block !important;
  width: calc(100% + 32px) !important;
  margin-left: -16px !important;
  margin-right: -16px !important;
  margin-top: 10px !important;
  padding-top: 10px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-bottom: 0 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
  max-height: 160px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* Lignes de données - Style DETAILED-MODE */
.card-data-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 11px !important;
  gap: 8px !important;
  padding: 6px 16px !important;
  border-bottom: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
  position: relative !important;
}

.card-data-row::after {
  content: '' !important;
  position: absolute !important;
  bottom: 0 !important;
  left: 16px !important;
  right: 16px !important;
  height: 1px !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

.card-data-row:last-child::after {
  display: none !important;
}

.card-data-label {
  color: rgba(255, 255, 255, 0.6) !important;
  flex-shrink: 0 !important;
  font-size: 13px !important;
}

.card-data-row:hover {
  background: transparent !important;
}

.card-data-value-wrapper {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 1 !important;
  justify-content: flex-end !important;
  min-width: 0 !important;
}

.card-data-value {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500 !important;
  text-align: right !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.card-copy-btn {
  flex-shrink: 0 !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 2px !important;
  color: rgba(255, 255, 255, 0.4) !important;
  display: flex !important;
  align-items: center !important;
}

.card-copy-btn:hover {
  color: rgba(255, 255, 255, 0.8) !important;
}

/* Scrollbar pour card-body */
.card-body::-webkit-scrollbar {
  width: 4px;
}
.card-body::-webkit-scrollbar-track {
  background: transparent;
}
.card-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

/* Scrollbar stylisée pour le body */
.card-body::-webkit-scrollbar {
  width: 6px;
}

.card-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.card-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.card-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Badge nombre de champs dans le footer */
.card-fields-badge {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 4px;
}

/* View All button */
.card-view-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s ease;
}

.card-view-all:hover {
  color: hsl(212 100% 60%);
}

.card-view-all svg {
  width: 16px;
  height: 16px;
}

/* ===== MODAL POUR AFFICHER LA CARTE EN GRAND ===== */
#card-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#card-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Backdrop flouté */
.card-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

/* Contenu de la modal - centré */
.card-modal-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#card-modal-overlay.active .card-modal-content {
  transform: scale(1) translateY(0);
}

/* Scrollbar dans la modal */
.card-modal-content::-webkit-scrollbar {
  width: 6px;
}

.card-modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.card-modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

.card-modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Bouton fermer */
.card-modal-close {
  position: absolute;
  top: -45px;
  right: 50%;
  transform: translateX(50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.card-modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(50%) scale(1.1);
}

/* Body de la modal */
.card-modal-body {
  width: 100%;
}

/* Carte dans la modal */
.card-modal-body .result-card {
  width: 100%;
  margin: 0;
}

.card-modal-body .card-body {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Cacher le badge et view all dans la modal */
.card-modal-body .card-fields-badge,
.card-modal-body .card-view-all {
  display: none;
}

/* Data Row */
.card-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  padding: 6px 10px;
  min-height: 28px;
  margin: 0 -10px;
  border-radius: 0;
  transition: background 0.15s ease;
  cursor: default;
}

.card-data-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0;
}

.card-data-row.multi-selected {
  background: rgba(255, 255, 255, 0.06) !important;
  border-left: 3px solid #3b82f6 !important;
  padding-left: 14px !important;
  border-radius: 0 !important;
}

.card-data-row.multi-selected .card-data-label {
  color: #ffffff !important;
}

.card-data-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8125rem;
}

.card-data-value-wrapper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.card-data-value {
  color: var(--nextui-foreground);
  font-size: 0.8125rem;
}

/* Buttons */
.card-copy-btn,
.card-action-btn {
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--nextui-foreground);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.card-copy-btn:hover,
.card-action-btn:hover {
  opacity: 0.7;
}

.card-copy-btn svg,
.card-action-btn svg {
  width: 1rem;
  height: 1rem;
  margin-left: 0.5rem;
}

.card-action-btn {
  z-index: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  appearance: none;
  user-select: none;
  white-space: nowrap;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  font-size: 0.75rem;
  gap: 0.5rem;
  border-radius: var(--radius-small);
  padding: 0;
  transition: transform 0.2s, opacity 0.2s;
  background: transparent;
  color: var(--nextui-default-foreground);
  min-width: 24px;
  width: 24px;
  height: 24px;
}

.card-action-btn:hover {
  background: var(--nextui-default-100);
}

.card-action-btn svg {
  width: 0.75rem;
  height: 0.75rem;
  margin: 0;
}

/* Verified Badge */
.card-verified-wrapper {
  display: flex;
  align-items: center;
}

.card-verified-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-small);
}

.card-verified-badge svg {
  width: 0.75rem;
  height: 0.75rem;
  color: var(--nextui-success);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Link wrapper */
.card-link-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-link-favicon-wrapper {
  position: relative;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  border-radius: var(--radius-small);
  max-width: 16px;
}

.card-link-favicon {
  position: relative;
  z-index: 10;
  opacity: 1;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: transform 0.3s, opacity 0.3s;
  border-radius: var(--radius-small);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.card-external-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  outline: 2px solid transparent;
  outline-offset: 2px;
  font-size: 0.875rem;
  color: var(--nextui-foreground);
  text-decoration: none;
  transition: opacity 0.3s;
}

.card-external-link:hover {
  opacity: 0.8;
}

.card-external-link svg {
  height: 1em;
  width: 1em;
  display: flex;
  margin-left: 0.25rem;
  margin-right: 0.25rem;
  align-self: center;
}

/* Chips */
.card-chip {
  position: relative;
  max-width: fit-content;
  min-width: min-content;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  white-space: nowrap;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  height: 24px;
  font-size: 0.75rem;
  border-radius: var(--radius-small);
  color: var(--nextui-default-foreground);
  background: #27272c;
  cursor: help;
}

.card-chip span {
  flex: 1;
  font-weight: 400;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

/* Chip with border */
.card-chip-bordered {
  border: 1.5px solid var(--nextui-default);
  color: var(--nextui-foreground);
  background: transparent;
  border-radius: 9999px;
}

.card-chip-dot {
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.25rem;
  border-radius: 9999px;
  background: var(--nextui-primary);
}

/* Chip more */
.card-chip-more {
  background: var(--nextui-default-400);
  color: #a1a1aa;
  border-radius: 9999px;
}

/* Stats Container */
.card-stats-accordion {
  z-index: 10;
  cursor: pointer;
  border-radius: var(--radius-small);
  transition: all 0.2s;
  -webkit-font-smoothing: antialiased;
}

.card-stats-accordion:hover {
  background: var(--nextui-default-100);
}

.card-stats-container {
  max-width: 400px;
  max-height: 300px;
  overflow: hidden;
}

.card-stats-wrapper {
  display: flex;
  gap: 0.25rem;
}

/* Footer - style TREE-PERSON */
.card-footer {
  display: flex !important;
  margin: 8px -20px 0 -20px !important;
  padding: 11px 20px 7px 20px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* === VIEW ALL - CACHÉ pour style TREE-PERSON === */
.view-all-btn {
  display: none !important;
}

.view-all-btn:hover {
  display: none !important;
}

.view-all-btn svg {
  display: none !important;
}

.card-view-profile {
  position: relative;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  outline: 2px solid transparent;
  outline-offset: 2px;
  font-size: 0.875rem;
  color: var(--nextui-foreground);
  text-decoration: none;
  transition: opacity 0.3s;
}

.card-view-profile:hover {
  opacity: 0.8;
}

.card-view-profile svg {
  height: 1em;
  width: 1em;
  display: flex;
  margin-left: 0.25rem;
  margin-right: 0.25rem;
  align-self: center;
}

.card-expand-btn {
  z-index: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  appearance: none;
  user-select: none;
  white-space: nowrap;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  min-width: 4rem;
  height: 32px;
  font-size: 0.75rem;
  gap: 0.5rem;
  border-radius: var(--radius-small);
  transition: transform 0.2s, opacity 0.2s;
  background: var(--nextui-default-400);
  color: #a1a1aa;
  border: none;
}

.card-expand-btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.card-expand-btn:not(:disabled):hover {
  opacity: 0.8;
}

/* Responsive - MASONRY COLUMNS */
@media (max-width: 1400px) {
  .apple-results-container,
  .results-masonry-container {
    column-count: 3 !important;
  }
}

@media (max-width: 1024px) {
  .apple-results-container,
  .results-masonry-container {
    column-count: 2 !important;
    column-gap: 12px !important;
  }
}

@media (max-width: 768px) {
  .apple-results-container,
  .results-masonry-container {
    column-count: 1 !important;
  }

  .card-data-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .card-data-value-wrapper {
    width: 100%;
    justify-content: space-between;
  }

  .card-footer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .card-view-profile,
  .card-expand-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .result-card {
    transition: none;
    animation: none;
  }
}

/* ===== RESPONSIVE - Adaptation écran ===== */
@media (max-width: 600px) {
  .result-card {
    min-width: 100% !important;
  }

  .card-header {
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  .card-platform-name {
    font-size: 1rem;
    max-width: 150px;
  }

  .card-body {
    padding: 12px 14px;
  }

  .card-footer {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-data-row {
    flex-wrap: wrap;
    gap: 4px;
  }

  .card-data-value {
    max-width: 100%;
    word-break: break-all;
  }
}
