/* ══════════════════════════════════════════════════════════════════════
   INVENTORY SCREEN — ARC Raiders In-Game UI (pixel-precise)
   Base: 1920x1080 reference from Gemini specs
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --slot: 72px;
  --slot-gap: 4px;
  --slot-img: 54px;
  --panel-bg: rgba(12, 14, 18, 0.85);
  --slot-empty: rgba(255, 255, 255, 0.03);
  --slot-border: rgba(255, 255, 255, 0.1);
  --inv-font: 'Barlow', 'Rajdhani', sans-serif;
  --weapon-w: calc(var(--slot) * 2 + var(--slot-gap));
  --weapon-h: 110px;
}

/* ── Fullscreen override ─────────────────────────────────────────── */
#tab-inventory { padding: 0; max-width: 100vw; margin: 0; }
#tab-inventory.active { display: block; }
main:has(#tab-inventory.active) { max-width: 100%; padding: 0; }

/* ── Screen ──────────────────────────────────────────────────────── */
.inv-screen {
  background: linear-gradient(160deg, #0c1018 0%, #080d14 50%, #0a1016 100%);
  min-height: calc(100vh - 110px);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  font-family: var(--inv-font);
}
.inv-screen::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.45) 100%);
  pointer-events: none; z-index: 1;
}
.inv-screen > * { position: relative; z-index: 2; }

/* ── MAIN 2-PANEL LAYOUT: Reserve | Arsenal ──────────────────────── */
.inv-layout {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════════ */
/* LEFT PANEL: RÉSERVE                                               */
/* ══════════════════════════════════════════════════════════════════ */
.inv-reserve {
  width: 42%; flex-shrink: 0; max-width: 520px;
  background: var(--panel-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 16px;
  display: flex; flex-direction: column;
}
.inv-reserve-header { padding: 0 0 10px; }
.inv-reserve-title {
  font-size: 20px; font-weight: 700; letter-spacing: 0.12em;
  color: #eae0cd; text-transform: uppercase;
}

.inv-reserve-body { display: flex; flex: 1; min-height: 0; }

/* Category sidebar — circular icons */
.inv-cat-sidebar {
  display: flex; flex-direction: column; gap: 4px;
  width: 48px; flex-shrink: 0; margin-right: 8px;
}
.inv-cat-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: rgba(234,224,205,0.3); font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; position: relative;
}
.inv-cat-btn:hover {
  color: rgba(234,224,205,0.7);
  background: rgba(255,255,255,0.06);
}
.inv-cat-btn.active {
  color: #eae0cd;
  background: rgba(234,224,205,0.1);
  border-color: rgba(234,224,205,0.5);
}
.inv-cat-tooltip {
  display: none; position: absolute; left: 48px; top: 50%;
  transform: translateY(-50%);
  background: #1a2030; border: 1px solid rgba(234,224,205,0.2);
  border-radius: 4px; padding: 4px 10px;
  font-size: 11px; font-weight: 600; color: #eae0cd;
  white-space: nowrap; z-index: 10; pointer-events: none;
}
.inv-cat-btn:hover .inv-cat-tooltip { display: block; }

/* Reserve main area */
.inv-reserve-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Sort bar */
.inv-sort-bar { display: flex; align-items: center; gap: 4px; padding: 0 0 8px; }
.inv-sort-btn {
  width: 30px; height: 28px; border-radius: 4px;
  border: 1px solid var(--slot-border);
  background: var(--slot-empty);
  color: rgba(234,224,205,0.35); font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.inv-sort-btn:hover { color: #eae0cd; border-color: rgba(234,224,205,0.25); }
.inv-sort-select {
  flex: 1; height: 28px;
  background: var(--slot-empty);
  border: 1px solid var(--slot-border);
  border-radius: 4px;
  color: rgba(234,224,205,0.6);
  font-family: var(--inv-font); font-size: 13px; font-weight: 600;
  letter-spacing: 0.08em; padding: 0 10px; outline: none; cursor: pointer;
}
.inv-sort-select option { background: #0c0e12; color: #eae0cd; }
.inv-search-wrap {
  display: flex; align-items: center; gap: 6px;
  background: var(--slot-empty);
  border: 1px solid var(--slot-border);
  border-radius: 4px; padding: 0 8px; height: 28px;
  flex: 1; max-width: 140px;
  transition: border-color 0.15s;
}
.inv-search-wrap:focus-within { border-color: rgba(234,224,205,0.3); }
.inv-search-wrap i { color: rgba(234,224,205,0.2); font-size: 11px; flex-shrink: 0; }
.inv-search-wrap input {
  background: none; border: none; outline: none;
  color: #eae0cd; font-family: var(--inv-font);
  font-size: 12px; width: 100%;
}
.inv-search-wrap input::placeholder { color: rgba(234,224,205,0.2); }

/* ── ITEM GRID (reserve) — 4 cols of 72px ────────────────────────── */
.inv-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--slot));
  gap: var(--slot-gap);
  overflow-y: auto; overflow-x: hidden;
  max-height: calc(100vh - 220px);
  padding-right: 2px;
}

/* ══════════════════════════════════════════════════════════════════ */
/* UNIVERSAL SLOT (used everywhere)                                  */
/* ══════════════════════════════════════════════════════════════════ */
.inv-cell {
  width: var(--slot); height: var(--slot);
  background: var(--slot-empty);
  border: 1px solid var(--slot-border);
  border-radius: 4px;
  position: relative; cursor: pointer;
  transition: border-color 0.12s;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.inv-cell:hover { border-color: rgba(255,255,255,0.25); }
/* Rarity = BOTTOM border 3px (matching in-game) */
.inv-cell[data-rarity="common"]    { border-bottom: 3px solid #708090; }
.inv-cell[data-rarity="uncommon"]  { border-bottom: 3px solid #2ECC71; }
.inv-cell[data-rarity="rare"]      { border-bottom: 3px solid #00A3FF; }
.inv-cell[data-rarity="epic"]      { border-bottom: 3px solid #D63384; }
.inv-cell[data-rarity="legendary"] { border-bottom: 3px solid #FFD700; }
/* Image */
.inv-cell img {
  width: var(--slot-img); height: var(--slot-img);
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.inv-cell:hover img { transform: scale(1.05); }
/* Overlays */
.inv-cell-icons { position: absolute; bottom: 4px; left: 3px; display: flex; gap: 2px; }
.inv-cell-icon {
  font-size: 7px; color: rgba(234,224,205,0.4);
  background: rgba(0,0,0,0.4); padding: 1px 3px; border-radius: 2px;
}
.inv-cell-tier {
  position: absolute; bottom: 4px; right: 3px;
  font-family: var(--mono); font-size: 8px; font-weight: 700;
  color: rgba(234,224,205,0.5);
}
.inv-cell-qty {
  position: absolute; top: 3px; right: 4px;
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  color: #eae0cd; text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Empty slot */
.inv-slot-empty {
  width: var(--slot); height: var(--slot);
  background: var(--slot-empty);
  border: 1px solid var(--slot-border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color 0.12s; overflow: hidden;
}
.inv-slot-empty:hover { border-color: rgba(255,255,255,0.2); }
.inv-slot-plus { color: rgba(234,224,205,0.1); font-size: 16px; }

/* ══════════════════════════════════════════════════════════════════ */
/* RIGHT PANEL: ARSENAL (3 sub-columns)                              */
/* ══════════════════════════════════════════════════════════════════ */
.inv-arsenal {
  flex: 1;
  background: var(--panel-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 16px;
  display: flex; flex-direction: column;
}

.inv-arsenal-header {
  display: flex; align-items: center; gap: 12px; padding: 0 0 10px;
}
.inv-arsenal-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(234,224,205,0.05);
  border: 2px solid rgba(234,224,205,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: rgba(234,224,205,0.5);
}
.inv-arsenal-title {
  font-size: 24px; font-weight: 700; letter-spacing: 0.12em;
  color: #eae0cd; text-transform: uppercase;
}
.inv-arsenal-stats {
  margin-left: auto; display: flex; gap: 16px;
  font-family: var(--mono); font-size: 14px; color: rgba(234,224,205,0.5);
}
.inv-arsenal-stats i { margin-right: 4px; font-size: 11px; }

/* ── Arsenal body: 3 sub-columns ─────────────────────────────────── */
.inv-arsenal-body {
  display: flex;
  gap: 16px;
  flex: 1;
}

/* SUB-COL 1: Equipment (shields + weapons) */
.inv-equip-col {
  display: flex; flex-direction: column; gap: 6px;
  width: calc(var(--weapon-w) + 4px); flex-shrink: 0;
}
.inv-equip-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  color: rgba(234,224,205,0.4); text-transform: uppercase;
}
.inv-equip-top-row {
  display: flex; gap: var(--slot-gap);
}

/* Shield slot (same as regular slot) */
.inv-shield-slot {
  width: var(--slot); height: var(--slot);
  background: var(--slot-empty);
  border: 1px solid var(--slot-border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color 0.15s;
  position: relative; overflow: hidden;
}
.inv-shield-slot:hover { border-color: rgba(255,255,255,0.2); }
.inv-shield-slot[data-rarity="uncommon"]  { border-bottom: 3px solid #2ECC71; }
.inv-shield-slot[data-rarity="rare"]      { border-bottom: 3px solid #00A3FF; }
.inv-shield-slot[data-rarity="epic"]      { border-bottom: 3px solid #D63384; }
.inv-shield-slot .inv-shield-img {
  width: var(--slot-img); height: var(--slot-img); object-fit: contain;
}

/* Weapon slot (2 cells wide, ~110px tall) */
.inv-weapon-slot {
  width: var(--weapon-w);
  height: var(--weapon-h);
  background: var(--slot-empty);
  border: 1px solid var(--slot-border);
  border-radius: 4px;
  position: relative; overflow: hidden;
  cursor: pointer; transition: border-color 0.15s;
  display: flex; flex-direction: column;
}
.inv-weapon-slot:hover { border-color: rgba(255,255,255,0.2); }
.inv-weapon-slot[data-rarity="uncommon"]  { border-bottom: 3px solid #2ECC71; }
.inv-weapon-slot[data-rarity="rare"]      { border-bottom: 3px solid #00A3FF; }
.inv-weapon-slot[data-rarity="epic"]      { border-bottom: 3px solid #D63384; }
.inv-weapon-slot[data-rarity="legendary"] { border-bottom: 3px solid #FFD700; }

.inv-weapon-img-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 8px 12px;
}
.inv-weapon-img-area img {
  max-width: 120px; max-height: 55px; object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.inv-weapon-mods { display: flex; gap: 3px; padding: 0 8px 4px; }
.inv-weapon-mod-icon {
  width: 22px; height: 22px; border-radius: 3px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--slot-border);
  display: flex; align-items: center; justify-content: center;
}
.inv-weapon-mod-icon.empty { border-style: dashed; border-color: rgba(255,255,255,0.06); }
.inv-weapon-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 8px; background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.06);
  font-family: var(--mono); font-size: 10px; color: rgba(234,224,205,0.4);
}
.inv-weapon-ammo { display: flex; align-items: center; gap: 4px; }
.inv-weapon-ammo-bar { display: flex; gap: 1px; }
.inv-weapon-ammo-pip { width: 2px; height: 8px; background: rgba(234,224,205,0.12); border-radius: 1px; }
.inv-weapon-tier {
  font-weight: 700; color: rgba(234,224,205,0.5);
  background: rgba(234,224,205,0.06); padding: 1px 5px; border-radius: 2px;
}
.inv-weapon-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: rgba(234,224,205,0.1); font-size: 20px;
}

/* SUB-COL 2: Backpack */
.inv-backpack-col { display: flex; flex-direction: column; }
.inv-backpack-grid {
  display: grid;
  grid-template-columns: repeat(4, var(--slot));
  gap: var(--slot-gap);
}

/* SUB-COL 3: Quick use + Modules + Secure */
.inv-right-col { display: flex; flex-direction: column; }
.inv-quickuse-grid {
  display: grid;
  grid-template-columns: repeat(3, var(--slot));
  gap: var(--slot-gap);
}
.inv-module-grid { display: flex; gap: var(--slot-gap); }
.inv-secure-grid {
  display: grid;
  grid-template-columns: repeat(3, var(--slot));
  gap: var(--slot-gap);
}

/* ── Section headers ─────────────────────────────────────────────── */
.inv-section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 10px 0 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  color: rgba(234,224,205,0.4); text-transform: uppercase;
}
.inv-section-count {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.05em;
  color: rgba(234,224,205,0.5);
}

/* ══════════════════════════════════════════════════════════════════ */
/* DRAG & DROP                                                       */
/* ══════════════════════════════════════════════════════════════════ */
.inv-cell.dragging { opacity: 0.3; transform: scale(0.95); }
.inv-slot-empty.drag-over,
.inv-weapon-slot.drag-over,
.inv-shield-slot.drag-over {
  border-color: #eae0cd !important;
  background: rgba(234,224,205,0.05) !important;
}
.inv-slot-empty.drag-active,
.inv-weapon-slot.drag-active,
.inv-shield-slot.drag-active {
  border-color: rgba(234,224,205,0.2);
  border-style: dashed;
}
.inv-slot-empty.locked,
.inv-weapon-slot.locked,
.inv-shield-slot.locked {
  opacity: 0.2; pointer-events: none;
}

/* Unequip button */
.inv-unequip {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(234,224,205,0.5); font-size: 9px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s; z-index: 5;
}
.inv-cell:hover .inv-unequip,
.inv-weapon-slot:hover .inv-unequip,
.inv-shield-slot:hover .inv-unequip { opacity: 1; }
.inv-unequip:hover { color: #e83050; border-color: rgba(232,48,80,0.4); background: rgba(232,48,80,0.15); }

/* Module pulse animation (equip me!) */
.inv-module-pulse {
  animation: module-pulse 2s ease-in-out infinite;
  border-color: rgba(204,68,255,0.3) !important;
}
@keyframes module-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(204,68,255,0); }
  50% { box-shadow: 0 0 12px 2px rgba(204,68,255,0.2); }
}

/* ══════════════════════════════════════════════════════════════════ */
/* TOOLTIP (beige/cream like in-game)                                */
/* ══════════════════════════════════════════════════════════════════ */
.inv-tooltip {
  display: none; position: fixed; z-index: 9999; width: 260px;
  background: linear-gradient(180deg, #f5eed8 0%, #efe5c8 100%);
  border: 2px solid rgba(180,170,140,0.5); border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  overflow: hidden; pointer-events: none;
  font-family: var(--inv-font); color: #2a2520;
}
.inv-tooltip.visible { display: block; }
.inv-tooltip-actions {
  padding: 6px 12px; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: #4a4035; display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid rgba(180,170,140,0.3);
}
.inv-tooltip-actions i { color: #b0a080; }
.inv-tooltip-tags { padding: 6px 12px 0; display: flex; gap: 5px; flex-wrap: wrap; }
.inv-tooltip-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  padding: 2px 7px; border-radius: 3px; border: 1px solid;
}
.inv-tooltip-tag.tag-type      { background: rgba(50,140,80,0.15); border-color: rgba(50,140,80,0.4); color: #2a7a3a; }
.inv-tooltip-tag.tag-legendary { background: rgba(200,170,40,0.2); border-color: rgba(200,170,40,0.5); color: #8a7020; }
.inv-tooltip-tag.tag-epic      { background: rgba(160,50,200,0.15); border-color: rgba(160,50,200,0.4); color: #8a2aaa; }
.inv-tooltip-tag.tag-rare      { background: rgba(50,100,220,0.15); border-color: rgba(50,100,220,0.4); color: #2a5aaa; }
.inv-tooltip-tag.tag-uncommon  { background: rgba(50,160,90,0.15); border-color: rgba(50,160,90,0.4); color: #2a7a4a; }
.inv-tooltip-tag.tag-common    { background: rgba(100,100,100,0.15); border-color: rgba(100,100,100,0.4); color: #5a5a5a; }
.inv-tooltip-name { padding: 6px 12px 2px; font-size: 16px; font-weight: 700; color: #1a1510; }
.inv-tooltip-desc { padding: 2px 12px 8px; font-size: 12px; color: #4a4035; line-height: 1.5; }
.inv-tooltip-stats {
  padding: 6px 12px; border-top: 1px solid rgba(180,170,140,0.3);
  display: flex; flex-direction: column; gap: 3px;
}
.inv-tooltip-stat-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; }
.inv-tooltip-stat-row .stat-name { color: #4a4035; }
.inv-tooltip-stat-row .stat-value { color: #1a1510; font-family: var(--mono); }
.inv-tooltip-recipe { padding: 6px 12px; border-top: 1px solid rgba(180,170,140,0.3); }
.inv-tooltip-recipe-title { font-size: 9px; font-weight: 700; letter-spacing: 1.5px; color: #6a6050; margin-bottom: 4px; }
.inv-tooltip-recipe-items { display: flex; gap: 5px; flex-wrap: wrap; }
.inv-tooltip-recipe-item {
  width: 32px; height: 32px; border-radius: 4px;
  background: rgba(180,170,140,0.15); border: 1px solid rgba(180,170,140,0.3);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.inv-tooltip-recipe-item img { width: 24px; height: 24px; object-fit: contain; }
.inv-tooltip-footer {
  display: flex; justify-content: space-between; padding: 6px 12px;
  background: rgba(180,170,140,0.1); border-top: 1px solid rgba(180,170,140,0.3);
  font-family: var(--mono); font-size: 12px; font-weight: 700;
}
.inv-tooltip-footer .tt-weight, .inv-tooltip-footer .tt-value { color: #4a4035; }
.inv-tooltip-footer i { margin-right: 4px; font-size: 10px; }

/* Module layout preview in tooltip */
.inv-tooltip-module-layout {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(180,170,140,0.25);
  display: flex; flex-direction: column; gap: 3px;
}
.tt-mod-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: #3a3530;
}
.tt-mod-row i { width: 16px; text-align: center; color: #6a6050; font-size: 11px; }

/* ══════════════════════════════════════════════════════════════════ */
/* RESPONSIVE                                                        */
/* ══════════════════════════════════════════════════════════════════ */
@media (max-width: 1400px) {
  :root { --slot: 64px; --slot-img: 48px; --weapon-h: 95px; }
  .inv-reserve { width: 340px; }
}
@media (max-width: 1100px) {
  .inv-layout { flex-direction: column; padding: 8px; }
  .inv-reserve { width: 100%; }
  .inv-arsenal-body { flex-wrap: wrap; }
}
@media (max-width: 768px) {
  :root { --slot: 56px; --slot-img: 40px; --weapon-h: 80px; }
  .inv-reserve { padding: 10px; }
  .inv-arsenal { padding: 10px; }
  .inv-item-grid { grid-template-columns: repeat(4, var(--slot)); }
}
