/* =====================================================
   INVENTAIRE - Système professionnel et propre
   ===================================================== */

/* ==================== OVERLAY ==================== */
.inv-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.inv-overlay.active {
  display: flex;
}

/* ==================== CONTAINER ==================== */
.inv-container {
  background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9),
              0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  color: white;
  overflow: hidden;
}

/* ==================== HEADER ==================== */
.inv-header {
  padding: 24px 30px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
  border-bottom: 2px solid rgba(102, 126, 234, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.inv-header-left {
  flex: 1;
}

.inv-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.inv-subtitle {
  margin: 5px 0 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.inv-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.inv-count {
  background: rgba(102, 126, 234, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid rgba(102, 126, 234, 0.4);
}

.inv-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inv-close:hover {
  background: rgba(255, 59, 48, 0.3);
  transform: rotate(90deg);
}

/* ==================== TABS ==================== */
.inv-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 2px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.inv-tab {
  flex: 1;
  padding: 16px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inv-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}

.inv-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

/* ==================== BODY (zone scrollable) ==================== */
.inv-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  height: 500px;
  min-height: 500px;
  max-height: 500px;
}

.inv-body::-webkit-scrollbar {
  width: 10px;
}

.inv-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.inv-body::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.5);
  border-radius: 5px;
}

.inv-body::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.7);
}

/* ==================== PANES ==================== */
.inv-pane {
  display: none;
}

.inv-pane.active {
  display: block;
}

/* ==================== FILTERS ==================== */
.inv-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.inv-filter {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.inv-filter:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(102, 126, 234, 0.5);
  color: white;
}

.inv-filter.active {
  background: rgba(102, 126, 234, 0.3);
  border-color: #667eea;
  color: white;
  box-shadow: 0 0 15px rgba(102, 126, 234, 0.3);
}

/* ==================== ITEMS GRID ==================== */
.inv-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, 72px);
  gap: 12px;
  justify-content: center;
}

/* ==================== SLOT (item) ==================== */
.inv-slot {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6));
  border: 2px solid rgba(139, 139, 139, 0.5);
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.4),
              inset 2px 0 3px rgba(255, 255, 255, 0.05);
}

.inv-slot:hover {
  border-color: rgba(102, 126, 234, 0.9);
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4),
              inset 0 -3px 6px rgba(0, 0, 0, 0.4);
}

.inv-slot.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.inv-slot.disabled:hover {
  transform: none;
  border-color: rgba(139, 139, 139, 0.5);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.4);
}

.inv-slot-image {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}

.inv-slot-qty {
  position: absolute;
  bottom: 4px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 13px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

/* ==================== TOOLTIP (position fixed, en dehors du modal) ==================== */
.inv-tooltip {
  position: fixed;
  z-index: 999999999;
  background: rgba(10, 0, 20, 0.98);
  border: 2px solid rgba(102, 126, 234, 0.9);
  border-radius: 8px;
  padding: 14px 16px;
  min-width: 220px;
  max-width: 320px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.9),
              0 0 20px rgba(102, 126, 234, 0.3),
              inset 0 0 30px rgba(102, 126, 234, 0.1);
  color: white;
}

.inv-tooltip.show {
  opacity: 1;
  visibility: visible;
}

.inv-tooltip-image {
  text-align: center;
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.inv-tooltip-image img {
  max-width: 100px;
  max-height: 100px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.inv-tooltip-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.inv-tooltip-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
  margin-bottom: 10px;
  white-space: pre-line;
}

.inv-tooltip-action {
  font-size: 12px;
  color: rgba(100, 255, 150, 0.9);
  font-style: italic;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* ==================== EMPTY STATE ==================== */
.inv-empty {
  text-align: center;
  padding: 80px 40px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 16px;
}

.inv-empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

/* ==================== PAGINATION ==================== */
.inv-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.inv-pagination.hidden {
  display: none;
}

.inv-page-info {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  margin: 0 12px;
  user-select: none;
}

.inv-page-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  min-width: 36px;
  text-align: center;
}

.inv-page-btn:hover:not(:disabled) {
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.5);
  color: white;
  transform: translateY(-1px);
}

.inv-page-btn.active {
  background: rgba(102, 126, 234, 0.4);
  border-color: #667eea;
  color: white;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(102, 126, 234, 0.3);
}

.inv-page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.inv-page-btn.nav {
  font-weight: 600;
  min-width: 80px;
}

/* ==================== COFFRES — bordures rarete dans les slots ==================== */
.inv-slot.rarity-common    { border-color: rgba(154, 161, 173, 0.7); }
.inv-slot.rarity-rare      { border-color: rgba(76, 175, 80, 0.85);
                             box-shadow: inset 0 -3px 6px rgba(0,0,0,0.4),
                                         0 0 8px rgba(76,175,80,0.35); }
.inv-slot.rarity-very_rare { border-color: rgba(58, 166, 255, 0.9);
                             box-shadow: inset 0 -3px 6px rgba(0,0,0,0.4),
                                         0 0 10px rgba(58,166,255,0.45); }
.inv-slot.rarity-epic      { border-color: rgba(186, 85, 211, 0.95);
                             box-shadow: inset 0 -3px 6px rgba(0,0,0,0.4),
                                         0 0 12px rgba(186,85,211,0.55); }
.inv-slot.rarity-legendary {
  border-color: rgba(255, 170, 0, 1);
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.4),
              0 0 14px rgba(255, 170, 0, 0.7),
              inset 0 0 12px rgba(255, 215, 0, 0.2);
  animation: invSlotLegendaryPulse 2.2s ease-in-out infinite;
}
@keyframes invSlotLegendaryPulse {
  0%, 100% { box-shadow: inset 0 -3px 6px rgba(0,0,0,0.4),
                         0 0 14px rgba(255,170,0,0.7),
                         inset 0 0 12px rgba(255,215,0,0.2); }
  50%      { box-shadow: inset 0 -3px 6px rgba(0,0,0,0.4),
                         0 0 22px rgba(255,215,0,0.95),
                         inset 0 0 16px rgba(255,215,0,0.35); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .inv-container {
    max-width: 95%;
    max-height: 95vh;
  }

  .inv-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .inv-header-right {
    width: 100%;
    justify-content: center;
  }

  .inv-title {
    font-size: 24px;
  }

  .inv-items {
    grid-template-columns: repeat(auto-fill, 64px);
    gap: 10px;
  }

  .inv-slot {
    width: 64px;
    height: 64px;
  }

  .inv-slot-image {
    max-width: 42px;
    max-height: 42px;
  }
}
