/* inventory-ui.css */

#inventory-overlay {
  display: none;
  position: fixed; inset: 0;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7);
  z-index: 60;
}

.inv-panel {
  background: #1a1a2e;
  border: 2px solid #3a3a5e;
  border-radius: 8px;
  padding: 16px;
  width: 90%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  color: #eee;
  font-family: monospace;
  font-size: 12px;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: bold;
}

.inv-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

/* Bio card */
.inv-bio-card {
  background: #111;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 12px;
}

.inv-party-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 11px;
}

.inv-arrow {
  background: #2a2a4e;
  border: 1px solid #4a4a7e;
  border-radius: 4px;
  color: #eee;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
}

.inv-arrow:hover {
  background: #3a3a6e;
}

/* Top row: name/role + HP/MP */
.inv-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.inv-player-name {
  font-size: 11px;
  color: #fff;
  font-weight: bold;
}

.inv-player-role {
  font-size: 9px;
  color: #888;
}

.inv-bars {
  font-size: 10px;
  color: #aaa;
}

.inv-stat-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.inv-stat-row span { min-width: 55px; }
.inv-bars .inv-hp, .inv-stats-bar .inv-hp { color: #5f8; }
.inv-bars .inv-mp, .inv-stats-bar .inv-mp { color: #58f; }

.inv-bar {
  height: 6px;
  background: #222;
  border-radius: 3px;
  overflow: hidden;
}

.inv-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.inv-bar-fill.hp-fill { background: #22cc44; }
.inv-bar-fill.mp-fill { background: #4488ff; }
.inv-bar-fill.xp-fill { background: #e8a828; }

.inv-bars .inv-xp { color: #e8a828; }

.inv-currency {
  font-size: 10px;
  color: #e8a828;
  font-weight: normal;
}

/* Bottom row: sprite + equip */
.inv-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.inv-portrait canvas {
  image-rendering: pixelated;
}

.inv-equip-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Equip slots */
.inv-equip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inv-equip-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 50px;
}

.inv-slot-label {
  font-size: 9px;
  color: #888;
  text-transform: uppercase;
}

.inv-stat-line {
  font-size: 7px;
  color: #5f8;
  margin-top: 2px;
  text-align: center;
}

.inv-stat-nums {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 10px;
  color: #aaa;
  align-self: center;
}

/* Inventory section */
.inv-section-label {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.inv-bag {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.inv-slot {
  aspect-ratio: 1;
  background: #111;
  border: 2px solid #3a3a5e;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  min-height: 56px;
}

.inv-slot.selected {
  border-color: #58a6ff;
  box-shadow: 0 0 6px rgba(88,166,255,0.4);
}

.inv-slot.drag-over {
  border-color: #e87a28;
}

.inv-item {
  width: 32px;
  height: 32px;
  border-radius: 3px;
  image-rendering: pixelated;
}

.inv-item.empty {
  background: transparent !important;
  border: 1px dashed #3a3a5e;
}

.inv-item-name {
  font-size: 8px;
  color: #aaa;
  margin-top: 2px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Context menu */
.inv-context {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid #3a3a5e;
}

.inv-ctx-name {
  font-size: 11px;
  color: #fff;
  margin-bottom: 4px;
}

.inv-ctx-stats {
  font-size: 9px;
  color: #5f8;
  margin-bottom: 6px;
}

.inv-ctx-btn {
  padding: 6px 12px;
  background: #2a2a4e;
  border: 1px solid #4a4a7e;
  border-radius: 4px;
  color: #eee;
  font-size: 11px;
  font-family: monospace;
  cursor: pointer;
}

.inv-ctx-btn:hover {
  background: #3a3a6e;
}

.inv-ctx-btn[data-action="drop"] {
  color: #e55;
}

/* Storage */
.inv-storage {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px solid #3a3a5e;
}

.inv-empty-msg {
  color: #555;
  font-size: 11px;
  grid-column: 1 / -1;
  text-align: center;
  padding: 12px;
}

/* Inventory mobile button */
#btn-inventory {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 8;
  width: 40px;
  height: 40px;
  background: #e87a28;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.6;
}

#btn-inventory:active {
  opacity: 1;
}

/* Use text toast */
.inv-use-msg {
  position: fixed;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #5f8;
  font-size: 12px;
  font-family: monospace;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid #5f8;
  z-index: 20;
  animation: invMsgFade 2s forwards;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes invMsgFade {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  70% { opacity: 1; transform: translateX(-50%) translateY(-20px); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-30px); }
}
