/* ══════════════════════════════════════════════════════════════════════════════
   One'Bot — directory.css  v3.1
   Annuaire public — Design adaptatif PC / Tablet / Mobile
   PATCH: grille sans débordement, cartes adaptatives
══════════════════════════════════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────────────────────────────────
   HERO COMPACT
──────────────────────────────────────────────────────────────────────────── */
.dir-hero {
  position: relative;
  overflow: hidden;
  padding: 24px 20px 18px;
}

.dir-hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.14;
  animation: orbPulse 10s ease-in-out infinite alternate;
}
.orb-a {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #ff9f43, transparent 65%);
  top: -100px; left: -60px;
}
.orb-b {
  width: 240px; height: 240px;
  background: radial-gradient(circle, #5865f2, transparent 65%);
  bottom: -70px; right: -40px;
  animation-duration: 12s;
}
@keyframes orbPulse {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.1) translate(12px, 8px); }
}

.dir-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 100%;
  flex-wrap: wrap;
}

.dir-hero-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.dir-hero-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,159,67,.22), rgba(255,159,67,.06));
  border: 1px solid rgba(255,159,67,.38);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #ff9f43;
  flex-shrink: 0;
  box-shadow: 0 0 28px rgba(255,159,67,.2), 0 4px 14px rgba(0,0,0,.25);
  animation: iconPop .5s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes iconPop {
  from { opacity: 0; transform: scale(.55) rotate(-15deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

.dir-hero-text { min-width: 0; }

.dir-hero-title {
  font-family: var(--font-display, sans-serif);
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -.03em;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: fadeUp .45s .05s ease both;
}
.dir-hero-desc {
  font-size: .8rem;
  color: rgba(255,255,255,.45);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: fadeUp .45s .12s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Pills de stats */
.dir-hero-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
  animation: fadeUp .45s .2s ease both;
}

.dir-hero-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dir-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  color: rgba(255,255,255,.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
}
.dir-hero-pill i { color: #ff9f43; font-size: .7rem; }
.dir-hero-pill.pill-star { border-color: rgba(255,201,60,.3); color: #ffc93c; }
.dir-hero-pill.pill-star i { color: #ffc93c; }

/* ────────────────────────────────────────────────────────────────────────────
   TOOLBAR STICKY
──────────────────────────────────────────────────────────────────────────── */
.dir-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 10px;
  background: linear-gradient(to bottom, var(--bg-base, #0f0f17) 80%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-wrap: nowrap;  /* ← une seule ligne pour garder l'espace */
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  animation: fadeUp .45s .25s ease both;
}

/* Barre de recherche */
.dir-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;          /* ← crucial pour ne pas dépasser */
  max-width: 360px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 999px;
  padding: 8px 14px;
  transition: all .25s ease;
}
.dir-search:focus-within {
  border-color: rgba(255,159,67,.55);
  background: rgba(255,255,255,.08);
  box-shadow: 0 0 20px rgba(255,159,67,.18);
}
.dir-search > i {
  color: rgba(255,255,255,.3);
  font-size: .88rem;
  flex-shrink: 0;
  transition: color .2s;
}
.dir-search:focus-within > i { color: #ff9f43; }
.dir-search input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: #fff;
  font-size: .86rem;
}
.dir-search input::placeholder { color: rgba(255,255,255,.3); }

.dir-search-clear {
  display: none; align-items: center; justify-content: center;
  background: none; border: none;
  color: rgba(255,255,255,.3);
  font-size: .78rem;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: color .2s, background .2s;
}
.dir-search-clear.visible { display: flex; }
.dir-search-clear:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Filtres / tri */
.dir-filters {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;  /* ← ne se compresse pas */
}

.dir-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  color: rgba(255,255,255,.45);
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.dir-filter-btn i { font-size: .72rem; }
.dir-filter-btn:hover {
  background: rgba(255,255,255,.09);
  color: rgba(255,255,255,.8);
}
.dir-filter-btn.is-active {
  background: rgba(255,159,67,.15);
  border-color: rgba(255,159,67,.5);
  color: #ff9f43;
  box-shadow: 0 0 12px rgba(255,159,67,.18);
}

/* ────────────────────────────────────────────────────────────────────────────
   GRILLE — ANTI-OVERFLOW
   Utilise min() pour que les colonnes ne dépassent jamais le container
──────────────────────────────────────────────────────────────────────────── */
.dir-grid {
  display: grid;
  /* min(280px, 100%) = la carte fait au maximum 280px, et au minimum la
     largeur du conteneur → plus jamais de dépassement horizontal */
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 16px;
  padding: 4px 20px 72px;
  width: 100%;
  box-sizing: border-box;    /* ← le padding est inclus dans la width */
  overflow-x: hidden;        /* ← filet de sécurité */
}

/* ────────────────────────────────────────────────────────────────────────────
   CARTE SERVEUR
──────────────────────────────────────────────────────────────────────────── */
.srv-card {
  position: relative;
  background: rgba(255,255,255,.035);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;              /* ← empêche la carte d'élargir la grille */
  width: 100%;
  box-sizing: border-box;
  transition: transform .28s cubic-bezier(.2,.8,.2,1),
              border-color .28s ease,
              box-shadow .28s ease;
  animation: cardIn .4s ease both;
  overflow: hidden;
}

/* Trait de couleur sur la gauche au hover */
.srv-card::before {
  content: '';
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(to bottom, #ff9f43, #ff6b35);
  opacity: 0;
  transition: opacity .28s ease;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.srv-card:hover {
  border-color: rgba(255,159,67,.38);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,.38), 0 0 18px rgba(255,159,67,.12);
}
.srv-card:hover::before { opacity: 1; }

/* Spotlight */
.srv-card.is-spot {
  background: linear-gradient(160deg, rgba(255,201,60,.07), rgba(255,255,255,.025));
  border-color: rgba(255,201,60,.4);
  box-shadow: 0 0 22px rgba(255,201,60,.12);
}
.srv-card.is-spot::before {
  background: linear-gradient(to bottom, #ffc93c, #ff9f43);
}
.srv-card.is-spot:hover {
  box-shadow: 0 12px 36px rgba(0,0,0,.4), 0 0 28px rgba(255,201,60,.2);
}

/* Badge spotlight */
.srv-spot-ribbon {
  position: absolute;
  top: -1px; right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #ffc93c, #ff9f43);
  color: #1a1000;
  font-weight: 800;
  font-size: .62rem;
  padding: 3px 10px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(255,159,67,.35);
  letter-spacing: .3px;
}

/* ── Ligne supérieure ───────────── */
.srv-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.srv-icon-box {
  position: relative;
  flex-shrink: 0;
}

.srv-icon,
.srv-icon-fallback {
  width: 48px; height: 48px;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
  display: block;
}
.srv-icon-fallback {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.09);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.3);
  font-size: 1.15rem;
}

.srv-crown {
  position: absolute;
  bottom: -4px; right: -4px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffc93c, #ff9f43);
  display: flex; align-items: center; justify-content: center;
  font-size: .5rem;
  color: #1a1000;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  border: 2px solid rgba(15,15,23,.8);
}

.srv-info {
  min-width: 0;          /* ← CRUCIAL : permet le text-overflow */
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.srv-name {
  font-family: var(--font-display, sans-serif);
  font-size: .97rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  min-width: 0;
}

.srv-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.srv-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .61rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
}
.badge-premium { background: rgba(255,201,60,.1); color: #ffc93c; border: 1px solid rgba(255,201,60,.22); }
.badge-hot     { background: rgba(255,80,60,.12);  color: #ff6b6b; border: 1px solid rgba(255,80,60,.2);  }
.badge-new     { background: rgba(35,209,96,.12);  color: #23d160; border: 1px solid rgba(35,209,96,.22); }

/* ── Description ──────────────────── */
.srv-desc {
  min-width: 0;
}
.srv-desc p {
  margin: 0;
  font-size: .82rem;
  color: rgba(255,255,255,.58);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.45em;
  word-break: break-word;   /* ← casse les longs mots plutôt que déborder */
}
.srv-desc p.is-empty {
  color: rgba(255,255,255,.24);
  font-style: italic;
}

/* ── Stats ────────────────────────── */
.srv-stats {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}

.srv-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 7px;
  font-size: .73rem;
  font-weight: 700;
  color: rgba(255,255,255,.82);
  white-space: nowrap;
}
.srv-stat i { color: #ff9f43; font-size: .7rem; }

/* ── Actions ──────────────────────── */
.srv-actions {
  display: flex;
  gap: 7px;
  margin-top: auto;
}

.srv-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all .22s ease;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

/* Shimmer */
.srv-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.13) 50%, transparent 62%);
  transform: translateX(-120%);
  transition: transform .42s ease;
}
.srv-btn:hover::after { transform: translateX(120%); }

/* Vote */
.btn-vote {
  background: rgba(255,159,67,.12);
  color: #ffaa5b;
  border-color: rgba(255,159,67,.28);
}
.btn-vote:hover:not(:disabled) {
  background: rgba(255,159,67,.23);
  color: #fff;
  border-color: rgba(255,159,67,.6);
  box-shadow: 0 4px 14px rgba(255,159,67,.3);
  transform: translateY(-2px);
}
.btn-vote:active:not(:disabled) { transform: translateY(0); }
.btn-vote:disabled { opacity: .4; cursor: not-allowed; }
.btn-vote.is-loading { animation: pulseBorder .8s ease-in-out infinite alternate; }
@keyframes pulseBorder { to { border-color: rgba(255,159,67,.7); } }
.btn-vote.is-voted {
  background: rgba(35,209,96,.14);
  color: #23d160;
  border-color: rgba(35,209,96,.35);
}

/* Rejoindre */
.btn-join {
  background: #5865f2;
  color: #fff;
}
.btn-join:hover {
  background: #4752c4;
  box-shadow: 0 4px 14px rgba(88,101,242,.42);
  transform: translateY(-2px);
}
.btn-join:active { transform: translateY(0); }

/* ────────────────────────────────────────────────────────────────────────────
   ÉTAT VIDE
──────────────────────────────────────────────────────────────────────────── */
.dir-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 60px 20px;
  color: rgba(255,255,255,.35);
  text-align: center;
  background: rgba(255,255,255,.02);
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,.08);
}
.dir-empty-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.dir-empty-icon i { font-size: 1.5rem; opacity: .4; }
.dir-empty-title { font-size: .92rem; font-weight: 700; color: rgba(255,255,255,.5); margin: 0; }
.dir-empty-sub   { font-size: .8rem; color: rgba(255,255,255,.26); margin: 0; }

/* ────────────────────────────────────────────────────────────────────────────
   RESPONSIVE — TABLETTE ≤ 1100px
──────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .dir-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: 14px;
    padding: 4px 16px 64px;
  }
}

/* ────────────────────────────────────────────────────────────────────────────
   RESPONSIVE — MOBILE ≤ 768px
──────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Hero : tout sur une ligne */
  .dir-hero { padding: 14px 14px 10px; }
  .dir-hero-inner { gap: 10px; flex-wrap: wrap; }
  .dir-hero-icon  { width: 42px; height: 42px; font-size: 1.25rem; border-radius: 12px; }
  .dir-hero-title { font-size: 1rem; }
  .dir-hero-desc  { display: none; }
  .dir-hero-right { width: 100%; }
  .dir-hero-pill  { font-size: .7rem; padding: 4px 9px; }

  /* Toolbar : recherche prend tout l'espace, filtres icônes */
  .dir-toolbar { padding: 7px 14px 9px; gap: 7px; }
  .dir-search { max-width: 100%; }
  .dir-filter-btn span { display: none; }
  .dir-filter-btn { padding: 7px 10px; }

  /* Grille : 1 colonne */
  .dir-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 4px 12px 56px;
  }

  /* Carte : plus compacte */
  .srv-card { padding: 14px; gap: 9px; border-radius: 14px; }
  .srv-icon, .srv-icon-fallback { width: 42px; height: 42px; border-radius: 11px; }
  .srv-name { font-size: .9rem; }
  .srv-desc p { -webkit-line-clamp: 1; min-height: 1.5em; }
  .srv-stat { padding: 3px 7px; font-size: .7rem; }
  .srv-btn { padding: 9px 8px; font-size: .78rem; }
}

/* ────────────────────────────────────────────────────────────────────────────
   RESPONSIVE — TRÈS PETIT ≤ 420px
──────────────────────────────────────────────────────────────────────────── */
@media (max-width: 420px) {
  .dir-hero-pills { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .dir-hero-pill  { font-size: .67rem; padding: 3px 8px; }
  .dir-toolbar    { flex-wrap: wrap; }
  .dir-search     { max-width: 100%; flex: 1 1 100%; }
  .dir-filters    { width: 100%; justify-content: center; }

  /* Boutons empilés en colonne */
  .srv-actions    { flex-direction: column; }
  .srv-btn        { flex: unset; width: 100%; }
}
