/* ==========================================================================
   MODULES ENCYCLOPÉDIE DU JEU — V9.2 ULTRA-ERGONOMIQUE & TACTIQUE
   ========================================================================== */

/* Barre de navigation collante (Sticky) collée exactement sous le menu principal */
.sticky-subnav-bar {
  position: sticky;
  top: 131px; /* Hauteur de header (110px logo + 20px padding + 1px border) */
  z-index: 15; /* Inférieur au header (z-index: 20) pour ne jamais passer par-dessus */
  background: rgba(7, 9, 12, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-2);
  border-top: 1px solid rgba(255, 106, 0, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  padding: 8px 0;
  transition: all 0.2s ease;
}

.sticky-subnav-bar .subnav {
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sticky-subnav-bar .subnav::-webkit-scrollbar {
  display: none;
}

.sticky-subnav-bar .subnav a {
  padding: 8px 18px;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid transparent;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  white-space: nowrap;
  transition: all 0.2s ease;
}

.sticky-subnav-bar .subnav a:hover,
.sticky-subnav-bar .subnav a.active {
  color: #fff;
  background: linear-gradient(180deg, #1b2633, #131c26);
  border-color: var(--orange);
  box-shadow: 0 0 12px rgba(255, 106, 0, 0.2);
}

/* Barre de contrôle tactique ergonomique (Filtres & Recherche) */
.encyclo-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, rgba(20, 28, 38, 0.96), rgba(12, 17, 24, 0.98));
  border: 1px solid var(--line);
  padding: 18px 22px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  margin-bottom: 28px;
}

.encyclo-controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
}

.encyclo-quick-info {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.encyclo-search-box {
  position: relative;
  min-width: 320px;
  flex: 1;
  max-width: 480px;
}

.encyclo-search-box input {
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--line-2);
  color: #fff;
  padding: 10px 16px 10px 42px;
  font-size: 0.9rem;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  transition: all 0.2s ease;
}

.encyclo-search-box input:focus {
  outline: none;
  border-color: var(--orange);
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 14px rgba(255, 106, 0, 0.3);
}

.encyclo-search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--orange2);
  pointer-events: none;
}

.encyclo-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.encyclo-tab {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #a0aec0;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  line-height: 1.2;
}

.encyclo-tab span:first-child {
  flex: 1;
  padding-right: 8px;
}

.encyclo-tab .count-tag {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 7px;
  color: #cbd5e1;
  font-family: monospace;
  font-weight: 800;
  border-radius: 2px;
  flex-shrink: 0;
}

.encyclo-tab:hover {
  background: rgba(255, 106, 0, 0.1);
  border-color: rgba(255, 106, 0, 0.5);
  color: #fff;
}

.encyclo-tab.active {
  background: linear-gradient(180deg, rgba(255, 106, 0, 0.25), rgba(255, 106, 0, 0.08));
  border-color: var(--orange);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 106, 0, 0.25);
}

.encyclo-tab.active .count-tag {
  background: var(--orange);
  color: #000;
}

/* Grille des Équipements / Armes */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 22px;
}

.item-card {
  background: linear-gradient(180deg, rgba(19, 27, 36, 0.98), rgba(12, 17, 23, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.item-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 2px;
  background: var(--orange);
}

.item-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 106, 0, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 16px rgba(255, 106, 0, 0.15);
}

.item-card-media {
  width: 100%;
  height: 160px;
  background: radial-gradient(circle at center, rgba(255, 106, 0, 0.08) 0%, rgba(7, 9, 12, 0.95) 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.item-card-media img {
  max-width: 86%;
  max-height: 82%;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.7));
  transition: transform 0.3s ease;
}

.item-card:hover .item-card-media img {
  transform: scale(1.06);
}

.item-badge-level {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(7, 9, 12, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 106, 0, 0.5);
  color: var(--orange2);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
}

.item-badge-price {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(40, 167, 69, 0.2);
  border: 1px solid rgba(40, 167, 69, 0.6);
  color: #5cd67b;
  font-family: monospace;
  font-size: 0.88rem;
  font-weight: 900;
  padding: 3px 9px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}

.item-card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.item-card-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--orange2);
  letter-spacing: 0.12em;
  font-weight: 800;
  margin-bottom: 4px;
}

.item-card h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: #fff;
  line-height: 1.2;
}

.item-card p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0 0 14px;
  flex: 1;
}

/* Mini Barres de stats tactiques */
.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 10px 12px;
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  margin-top: auto;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  text-transform: uppercase;
  color: #c9d2db;
  letter-spacing: 0.05em;
}

.stat-bar-container {
  width: 110px;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #ff9944);
}

/* Grille Factions */
.faction-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.faction-card {
  background: linear-gradient(180deg, rgba(21, 29, 39, 0.98), rgba(13, 17, 23, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 24px 100%, 0 calc(100% - 24px));
  padding: 26px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.faction-card:hover {
  transform: translateY(-4px);
  border-color: var(--orange);
}

.faction-code {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 900;
  margin-bottom: 6px;
}

.faction-card h3 {
  font-size: 1.55rem;
  margin: 0;
  color: #fff;
  letter-spacing: -0.02em;
}

.faction-doctrine {
  font-size: 0.85rem;
  color: #e2e8f0;
  font-weight: 700;
  margin: 12px 0;
  line-height: 1.4;
  padding-left: 10px;
  border-left: 3px solid var(--orange);
}

.faction-card p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 14px;
}

.faction-strengths {
  background: rgba(0, 0, 0, 0.35);
  padding: 12px 14px;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.5;
  white-space: pre-line;
}

/* Grille Cartes / Maps */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 24px;
}

.map-card {
  background: linear-gradient(180deg, rgba(19, 27, 36, 0.98), rgba(13, 18, 24, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
  overflow: hidden;
}

.map-card-media {
  height: 190px;
  background: #11171f;
  position: relative;
  overflow: hidden;
}

.map-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.map-card:hover .map-card-media img {
  transform: scale(1.05);
}

.map-card-body {
  padding: 22px;
}

.map-meta-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.map-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 106, 0, 0.15);
  border: 1px solid rgba(255, 106, 0, 0.35);
  color: var(--orange2);
  padding: 3px 8px;
  font-weight: 800;
}

/* Schéma Économique Tactique */
.eco-system-box {
  background: linear-gradient(180deg, rgba(16, 23, 31, 0.98), rgba(10, 14, 19, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 24px 100%, 0 calc(100% - 24px));
  padding: 32px;
  margin-top: 28px;
}

.eco-flow-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 20px;
}

.eco-flow-step {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  padding: 18px 16px;
  position: relative;
}

.eco-flow-step .step-number {
  font-family: monospace;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--orange2);
  margin-bottom: 4px;
}

.eco-flow-step h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: #fff;
}

.eco-flow-step p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  margin: 0;
}

/* État Aucun Résultat lors de la recherche */
.no-results-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 42px 20px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 1080px) {
  .faction-grid {
    grid-template-columns: 1fr;
  }
  .eco-flow-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .encyclo-controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .encyclo-search-box {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .eco-flow-grid {
    grid-template-columns: 1fr;
  }
  .item-grid, .map-grid {
    grid-template-columns: 1fr;
  }
}
