/* ==========================================================================
   GAME UI OVERHAUL (Shop, Inventory, Equipment, Loadout)
   ========================================================================== */

/* --- SHOP --- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.shop-card {
  position: relative;
  transition:
    transform 0.15s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  cursor: pointer;
  overflow: hidden;
  /* Inset shadow creates a sunken depth effect */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 4px 12px rgba(0, 0, 0, 0.4);
}

.shop-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.6),
    0 0 10px rgba(199, 154, 60, 0.2);
}

.shop-card:active {
  transform: translateY(0);
}

.shop-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shop-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 12px;
}

.shop-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  padding-top: 8px;
  border-top: 1px dashed rgba(56, 67, 61, 0.8); /* Elegant divider */
}

/* Buy buttons should feel clickable and physical */
.shop-actions button,
.shop-actions .btn {
  background: linear-gradient(180deg, var(--panel-alt) 0%, var(--panel) 100%);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 2px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}

.shop-actions button:hover,
.shop-actions .btn:hover {
  background: var(--gold-dim);
  color: var(--bg);
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(199, 154, 60, 0.4);
}

/* --- INVENTORY (Slot-Based Grid) --- */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

/* Creates a classic RPG grid layout */
.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  font-size: 12px;
}

.inv-item {
  background: linear-gradient(145deg, var(--panel-alt), #171f1c);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  user-select: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
}

.inv-item:hover {
  border-color: var(--moss);
  background: linear-gradient(145deg, #26332e, var(--panel-alt));
  box-shadow:
    inset 0 0 8px rgba(122, 154, 110, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Quantity badge (e.g., x5, x10) */
.inv-item span.n {
  color: var(--moss);
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.inv-empty {
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
  opacity: 0.6;
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 4px;
}

/* --- EQUIPMENT (Gear Paperdoll / Slots) --- */
.equip-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  font-size: 12px;
  margin-top: 8px;
}

/* Transform equipment entries into visual gear slots */
.equip-row div {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  transition: border-color 0.2s ease;
}

/* Slot label (e.g., Weapon, Armor) */
.equip-row div::before {
  content: ""; /* Placeholder for slot accent */
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--border);
  border-radius: 4px 0 0 4px;
}

.equip-row div:hover {
  border-color: var(--gold-dim);
}

.equip-row div:hover::before {
  background: var(--gold);
}

.equip-row b {
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
}

/* --- LOADOUT / TACTICS --- */
.loadout-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 6px;
}

.tactic-pill {
  font-size: 11px;
  font-family: var(--font-display);
  color: var(--frost);
  background: rgba(111, 155, 176, 0.08);
  border: 1px solid var(--frost);
  border-radius: 2px; /* Sharper corners look more medieval/RPG */
  padding: 4px 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 0 6px rgba(111, 155, 176, 0.15);
  transition: all 0.2s ease;
  cursor: default;
}

.tactic-pill:hover {
  background: rgba(111, 155, 176, 0.2);
  box-shadow: 0 0 10px rgba(111, 155, 176, 0.4);
  transform: translateY(-1px);
}

/* --- Gear Card Upgrades --- */
.gear-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.gear-card.equipped {
  border-color: var(--gold);
  background: linear-gradient(
    180deg,
    var(--panel-alt) 0%,
    rgba(199, 154, 60, 0.08) 100%
  );
  box-shadow: 0 0 10px rgba(199, 154, 60, 0.15);
}

.gear-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.gear-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: bold;
  color: var(--text);
}

.gear-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.gear-tag.slot {
  color: var(--frost);
  border-color: rgba(111, 155, 176, 0.3);
}

/* --- Stat Badges --- */
.gear-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.stat-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.stat-badge b {
  color: var(--text);
}
.stat-badge.atk b {
  color: var(--blood);
}
.stat-badge.def b {
  color: var(--frost);
}
.stat-badge.elem {
  border-color: var(--gold-dim);
  color: var(--gold);
}

/* --- Summary & Paperdoll HUD --- */
.inventory-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 12px;
  align-items: start; /* stop the compact vitals card stretching to paperdoll height */
}

.summary-card.compact {
  padding-bottom: 12px;
}

.summary-label {
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  margin-bottom: 8px;
}

.vital-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vital-badge {
  font-size: 12px;
  background: var(--bg);
  padding: 6px 10px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.vital-badge b {
  color: var(--text);
}
.vital-badge.hp b {
  color: var(--blood);
}
.vital-badge.stamina b {
  color: var(--moss);
}

.paperdoll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}

.paperdoll-slot {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 8px;
  font-size: 11px;
  border-radius: 2px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paperdoll-slot b {
  color: var(--text-dim);
  text-transform: capitalize;
  font-family: var(--font-display);
  margin-right: 4px;
}

/* ==========================================================================
   PAPERDOLL SPATIAL LAYOUT
   ========================================================================== */

.paperdoll-layout {
  display: grid;
  grid-template-columns: 1fr 140px 1fr;
  grid-template-areas:
    "head    avatar  arms"
    "chest   avatar  waist"
    "weapon  avatar  legs";
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

/* Central Character Box */
.paperdoll-avatar {
  grid-area: avatar;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 180px;
  background: radial-gradient(circle, var(--panel-alt) 0%, var(--bg) 90%);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
}

.avatar-silhouette {
  font-size: 42px;
  opacity: 0.3;
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.8));
}

.avatar-title {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* Individual Slot Boxes */
.doll-slot {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  min-height: 48px;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}

.doll-slot:hover {
  border-color: var(--gold-dim);
  box-shadow: 0 0 8px rgba(199, 154, 60, 0.15);
}

.doll-slot .slot-label {
  font-family: var(--font-display);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.doll-slot .slot-item {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doll-slot .slot-item.highlight {
  color: var(--gold);
}

/* Map CSS Grid areas to slot positions */
.slot-head {
  grid-area: head;
}
.slot-chest {
  grid-area: chest;
}
.slot-arms {
  grid-area: arms;
}
.slot-waist {
  grid-area: waist;
}
.slot-legs {
  grid-area: legs;
}
.slot-weapon {
  grid-area: weapon;
  border-color: rgba(199, 154, 60, 0.4);
}

/* Mobile fallback */
@media (max-width: 600px) {
  .paperdoll-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "avatar avatar"
      "weapon head"
      "chest  arms"
      "waist  legs";
  }
}

/* ==========================================================================
   SHARED: STRIP + DETAIL SIDEBAR LAYOUT
   Canonical definition for the "flexible strip/grid feeding a fixed-width
   detail sidebar" pattern used across Forge (Armor tab, Weapon Presets),
   Quest Board, Inventory, and Camp. Each feature keeps its own inner card/
   tile classes (they render very different content) but shares this outer
   scaffold instead of redefining it four times.

   Usage: <div class="detail-layout">
            <div class="detail-strip [feature-grid-class]">...</div>
            <div class="detail-sidebar [feature-panel-class]">...</div>
          </div>

   NOTE: this lives here for now since Inventory/Camp were the last to adopt
   the pattern — worth moving to a genuinely shared stylesheet (layout.css?)
   next time any of these files gets touched.
   ========================================================================== */

.detail-layout {
  display: flex;
  width: 100%;
  height: 400px;
  box-sizing: border-box;
  padding: 16px;
  gap: 16px;
  overflow: auto;
}

.detail-strip,
.inv-icon-strip,
.icon-strip {
  flex: 1; /* Takes up ALL remaining space left over by the 280px sidebar */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  overflow-y: auto; /* Scroll items vertically if they overflow */
  padding-right: 8px;
}

.detail-sidebar {
  width: 280px;
  flex: 0 0 280px; /* Locked width: never shrink, never grow */
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
}

@media (max-width: 700px) {
  .detail-layout {
    flex-direction: column;
  }
  .detail-sidebar {
    flex: 1 1 auto;
    width: 100%;
  }
}

/* ==========================================================================
   INVENTORY / CAMP — TAB BAR + ICON STRIP TILES
   (paired with the shared .detail-layout/.detail-strip/.detail-sidebar above)
   ========================================================================== */

.inv-tab-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.inv-tab {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 14px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inv-tab:hover {
  border-color: var(--gold-dim);
  color: var(--text);
}

.inv-tab.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(199, 154, 60, 0.08);
}

/* .inv-tab-layout removed — use shared .detail-layout above.
   Pair .inv-icon-strip with .detail-strip in markup for flex sizing. */

.inv-icon-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}

.icon-item {
  position: relative;
  flex: 0 0 56px;
  height: 56px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-item:hover {
  border-color: var(--gold-dim);
}

.icon-item.selected {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(199, 154, 60, 0.25);
  background: rgba(199, 154, 60, 0.08);
}

.icon-item.equipped::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.icon-item.ready::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--moss);
  box-shadow: 0 0 4px var(--moss); /* Adds a nice subtle glow */
}

/* Ensure icon span doesn't add extra inline margins */
.inv-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;          /* Removes line-height spacing issues */
}

.icon-item.selected .inv-icon-label {
  color: var(--text);
}

.inv-icon-badge {
  display: none; /* dot indicator (::after) already covers this; kept for text-based fallback if needed */
}

/* .inv-detail-panel removed — use shared .detail-sidebar above */

.inv-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(56, 67, 61, 0.8);
}

.inv-detail-icon {
  font-size: 28px;
  line-height: 1;
}

.inv-detail-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.inv-detail-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 2px;
}

.inv-detail-tag.slot {
  color: var(--frost);
}
