/* ========================================================
   INVENTORY, MODAL & TOASTS : RPG-CARDS
   ======================================================== */

/* HUD Joueur & Bouton Besace */
.player-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 4px auto 2px;
  position: relative;
  z-index: 10;
}

.player-hud-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn-besace-icon {
  background: rgba(35, 28, 22, 0.95) !important;
  border: 1.5px solid var(--gold-highlight) !important;
  border-radius: 8px !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  max-width: 34px !important;
  max-height: 34px !important;
  padding: 0 !important;
  color: #ffeb3b !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  position: relative;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.btn-besace-icon .ico-pouch {
  width: 20px !important;
  height: 20px !important;
  color: #ffeb3b !important;
  stroke: #ffeb3b !important;
  fill: rgba(255, 235, 59, 0.15) !important;
  display: block !important;
  flex-shrink: 0;
  pointer-events: none;
}

.btn-besace-icon:hover {
  background: rgba(55, 44, 34, 0.98) !important;
  border-color: #ffd700 !important;
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 5px 14px rgba(212, 175, 55, 0.5) !important;
}

.btn-besace-icon:active {
  transform: translateY(0);
}

.btn-besace-icon .inventory-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ffd700;
  color: #1a1612;
  font-size: 0.72rem;
  font-weight: bold;
  padding: 1px 5px;
  border-radius: 8px;
  line-height: 1;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.btn-inventory-toggle {
  background: rgba(35, 28, 22, 0.88);
  border: 1px solid var(--gold-highlight);
  border-radius: 8px;
  color: #ffeb3b;
  font-family: var(--fontName);
  font-size: 0.95rem;
  padding: 4px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  user-select: none;
}

.btn-inventory-toggle:hover {
  background: rgba(52, 42, 34, 0.96);
  border-color: #ffd700;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.btn-inventory-toggle:active {
  transform: translateY(0);
}

.inventory-badge {
  background: var(--gold-highlight);
  color: #1a1612;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1;
}

/* Besace d'Aventurier (Fenêtre Flottante Non-Modale) */
.inventory-drawer {
  position: fixed;
  top: 75px;
  right: 20px;
  width: 320px;
  max-width: 90vw;
  max-height: 480px;
  background: rgba(24, 20, 16, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--gold-highlight);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(212, 175, 55, 0.25);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.2s ease;
  animation: drawerSlideIn 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.inventory-drawer.hide {
  display: none !important;
}

@keyframes drawerSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.inventory-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 8px;
}

.inventory-drawer-title {
  font-family: var(--fontName);
  color: var(--gold-highlight);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.inventory-close-btn {
  background: transparent;
  border: none;
  color: #bbb;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  box-shadow: none;
}

.inventory-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
  box-shadow: none;
}

.inventory-drawer-sub {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #ccc;
  padding: 0 2px;
}

.inventory-gold-display {
  color: #ffd740;
  font-weight: bold;
}

.inventory-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 70px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.inventory-empty {
  font-size: 0.9rem;
  color: #888;
  font-style: italic;
  text-align: center;
  padding: 20px 10px;
  width: 100%;
}

.inventory-item {
  width: 50px;
  height: 50px;
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  position: relative;
}

.inventory-item:hover {
  transform: scale(1.16);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.8), 0 0 10px var(--gold-highlight);
  border-color: var(--gold-highlight);
  z-index: 10;
}

@media (max-width: 600px) {
  .inventory-drawer {
    top: 55px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 65vh;
  }
}

/* Cartes d'Objets au Marché */
.item-card {
  width: 95px;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  margin: 4px;
  text-align: center;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  border-radius: 8px;
  background-color: rgba(30, 25, 20, 0.85);
  background-size: cover;
  background-position: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.item-card:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
  border-color: var(--gold-highlight);
}

/* Modale d'Achat & Détails */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal.show {
  display: block;
}

.modal-content {
  background: rgba(26, 22, 18, 0.95);
  margin: 10% auto;
  padding: 24px;
  border: 1px solid var(--gold-highlight);
  border-radius: 14px;
  width: 85%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  color: #eee;
}

.close-button {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close-button:hover,
.close-button:focus {
  color: #fff;
  text-decoration: none;
}

#modalCardImage {
  max-width: 70%;
  height: auto;
  border-radius: 10px;
  margin: 12px auto;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Zone des Messages de Combat */
#game-messages {
  position: relative;
  max-height: 14vh;
  overflow-y: auto;
  margin: 14px auto 8px;
  padding: 10px 16px;
  width: 95%;
  max-width: 900px;
  background: rgba(12, 10, 8, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

#game-messages p {
  margin: 5px 0;
  font-size: 1.1rem;
  line-height: 1.5;
  color: #f8fafc;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
}

#game-messages p.msg-success {
  color: #86efac; /* Vert lumineux très lisible */
}

#game-messages p.msg-danger {
  color: #fca5a5; /* Rouge clair / alerte */
}

#game-messages p.msg-warning {
  color: #fde047; /* Jaune ambré / avertissement */
}

#game-messages p.msg-info {
  color: #93c5fd; /* Bleu ciel doux */
}

#game-messages p.msg-gold,
#game-messages p.msg-reward {
  color: #fbbf24; /* Or ambré éclatant */
}

/* Système de Notifications (Toasts) */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 250px;
  padding: 12px 18px;
  border-radius: 8px;
  color: white;
  font-family: var(--font1);
  font-size: 1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  background: rgba(25, 22, 18, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  animation: toast-slide-in 0.4s ease forwards;
  pointer-events: auto;
}

.toast-success {
  background: rgba(35, 95, 40, 0.92);
  border-left: 5px solid #81c784;
}

.toast-error {
  background: rgba(160, 30, 30, 0.92);
  border-left: 5px solid #e57373;
}

.toast-info {
  background: rgba(2, 100, 160, 0.92);
  border-left: 5px solid #4fc3f7;
}

.toast-fade-out {
  animation: toast-fade-out 0.4s ease forwards;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-fade-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}
