/* ==========================================================================
   REAL-TIME PLAYER TRADE SYSTEM UI
   ========================================================================== */

/* Context Menu */
.player-context-menu {
  position: absolute;
  background: linear-gradient(180deg, #2a221b 0%, #15110d 100%);
  border: 1px solid var(--ui-gold, #d8b46a);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 4px;
  min-width: 170px;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.player-context-menu.hidden {
  display: none !important;
}

.context-menu-title {
  text-align: center;
  font-family: 'Outfit', sans-serif;
  color: var(--ui-gold, #d8b46a);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(216, 180, 106, 0.2);
  margin-bottom: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.context-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--ui-text, #efe6d2) !important;
  padding: 8px 12px !important;
  font-size: 0.85rem !important;
  text-align: left !important;
  text-transform: none !important;
  font-weight: 600 !important;
  letter-spacing: normal !important;
  border-radius: 4px !important;
  min-height: auto !important;
  box-shadow: none !important;
  display: flex;
  align-items: center !important;
  gap: 8px;
  cursor: pointer;
  width: 100%;
}

.context-btn[style*="display: none"],
.context-btn[style*="display:none"],
.context-btn.hidden {
  display: none !important;
}

.context-btn:hover {
  background: rgba(216, 180, 106, 0.15) !important;
  border-color: rgba(216, 180, 106, 0.3) !important;
  color: #fff !important;
}

.context-btn.secondary {
  color: #a7977c !important;
  justify-content: center !important;
  font-size: 0.8rem !important;
}

/* Trade Modals */
.tradeCard {
  width: min(980px, calc(100vw - 24px)) !important;
  max-height: min(88vh, 820px) !important;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  pointer-events: auto !important;
  background: radial-gradient(circle at 50% 0%, #282119 0%, #15110d 60%, #0d0a07 100%) !important;
  border: 2px solid var(--ui-gold, #d8b46a) !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 45px rgba(216, 180, 106, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.2), inset 0 0 40px rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  position: relative;
}

.tradeHeaderTitleBox {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tradeHeaderIcon {
  font-size: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px rgba(216, 180, 106, 0.6));
}

.tradeContent {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

@media (max-width: 768px) {
  .tradeContent {
    grid-template-columns: 1fr;
    max-height: 480px;
    overflow-y: auto;
  }
}

.tradePane {
  background: linear-gradient(180deg, rgba(32, 26, 19, 0.92) 0%, rgba(18, 14, 10, 0.96) 100%) !important;
  border: 1.5px solid rgba(216, 180, 106, 0.35) !important;
  border-radius: 12px !important;
  padding: 14px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  min-height: 320px !important;
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.85), 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  position: relative !important;
  transition: all 0.3s ease !important;
}

.tradePaneHeader {
  color: var(--ui-gold, #ffd700);
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1.5px solid rgba(216, 180, 106, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-shadow: 0 0 8px rgba(216, 180, 106, 0.4);
}

.paneHeaderIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.tradeGrid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  grid-auto-rows: 64px;
  gap: 8px;
  padding: 8px;
  background: rgba(8, 6, 4, 0.65) !important;
  border-radius: 10px !important;
  border: 1.5px dashed rgba(216, 180, 106, 0.25) !important;
  align-content: start;
  min-height: 180px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9) !important;
}

.tradeEmptyNotice {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #a7977c;
  font-size: 0.85rem;
  font-family: 'Outfit', sans-serif;
  padding: 30px 10px;
}

.tradeEmptyNotice .emptyIcon {
  font-size: 1.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

/* Trade items slot */
.tradeItem {
  position: relative;
  background: linear-gradient(135deg, rgba(48, 38, 26, 0.95) 0%, rgba(24, 18, 12, 0.95) 100%) !important;
  border: 1.5px solid rgba(216, 180, 106, 0.35) !important;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.tradeItem:hover {
  background: linear-gradient(135deg, rgba(80, 64, 42, 0.95) 0%, rgba(45, 34, 22, 0.95) 100%) !important;
  border-color: var(--ui-gold, #ffd700) !important;
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.4), inset 0 0 10px rgba(255, 215, 0, 0.2) !important;
  transform: translateY(-2px) scale(1.04) !important;
}

/* Rarity border styles for Trade Items */
.tradeItem.rarity-uncommon {
  border-color: #55efc4 !important;
  box-shadow: inset 0 0 8px rgba(85, 239, 196, 0.2) !important;
}
.tradeItem.rarity-rare {
  border-color: #74b9ff !important;
  box-shadow: inset 0 0 8px rgba(116, 185, 255, 0.2) !important;
}
.tradeItem.rarity-epic {
  border-color: #a29bfe !important;
  box-shadow: inset 0 0 8px rgba(162, 155, 254, 0.25) !important;
}
.tradeItem.rarity-legendary {
  border-color: #ffd700 !important;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3), inset 0 0 10px rgba(255, 215, 0, 0.3) !important;
}

.tradeItemIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
}

.tradeItemIcon .equipment-css-render,
.tradeItemIcon .resource-icon-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tradeItemQty {
  position: absolute;
  bottom: 3px;
  right: 4px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--ui-gold, #ffd700);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  z-index: 6;
}

/* Gold Offer Inputs & Display */
.tradeGoldInputContainer,
.tradeGoldDisplayContainer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 6px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  border: 1.5px solid rgba(216, 180, 106, 0.35);
  min-height: 38px;
  transition: all 0.2s ease;
}

.tradeGoldInputContainer:focus-within {
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.goldCoinIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.goldInput {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffd700;
  font-weight: bold;
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  font-family: 'Outfit', sans-serif;
}

.partnerGoldVal {
  color: #ffd700;
  font-weight: bold;
  font-size: 0.95rem;
  font-family: 'Outfit', sans-serif;
}

/* Validation Status Badges */
.tradeValidationState {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Outfit', sans-serif;
  border: 1px solid rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.12);
  color: #facc15;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.tradeValidationState.isOK,
.tradePane.validated .tradeValidationState {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: #22c55e !important;
  color: #4ade80 !important;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.3) !important;
}

.tradePane.validated {
  border-color: #22c55e !important;
  box-shadow: inset 0 0 15px rgba(34, 197, 94, 0.2), 0 0 10px rgba(34, 197, 94, 0.2) !important;
}

/* Tabs for Inventory */
.tradeInventoryTabs {
  display: flex;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid rgba(216, 180, 106, 0.2);
  gap: 4px;
}

.tradeTabBtn {
  flex: 1;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  padding: 8px 10px !important;
  font-size: 0.82rem !important;
  color: #94a3b8 !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  cursor: pointer;
  min-height: auto !important;
  box-shadow: none !important;
  transition: all 0.2s !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px;
}

.tradeTabBtn.active {
  background: linear-gradient(180deg, rgba(216, 180, 106, 0.3) 0%, rgba(181, 141, 67, 0.2) 100%) !important;
  color: #ffd700 !important;
  border-color: rgba(216, 180, 106, 0.6) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

.tradeMyGoldTotal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #cbd5e1;
  font-size: 0.88rem;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(216, 180, 106, 0.25);
  font-family: 'Outfit', sans-serif;
}

.tradeMyGoldTotal strong {
  color: #ffd700;
  font-size: 0.95rem;
}

/* Action Area */
.tradeActions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding-top: 12px;
  border-top: 1.5px solid rgba(216, 180, 106, 0.2);
}

.tradeActionBtn {
  min-width: 150px;
  padding: 10px 20px !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  border-radius: 8px !important;
  letter-spacing: 0.03em !important;
  transition: all 0.2s ease !important;
}

.tradeActionBtn.successBtn {
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%) !important;
  border: 1.5px solid #4ade80 !important;
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4) !important;
}

.tradeActionBtn.successBtn:hover:not(:disabled) {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.6) !important;
}

.tradeActionBtn.dangerBtn {
  background: linear-gradient(180deg, #ef4444 0%, #991b1b 100%) !important;
  border: 1.5px solid #f87171 !important;
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3) !important;
}

.tradeActionBtn.dangerBtn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5) !important;
}

/* Item Detail Inspection Card Modal */
.itemDetailModalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 1000000 !important;
  pointer-events: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Custom Quantity Modal */
.tradeQuantityModalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 1000000 !important;
  pointer-events: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tradeQuantityCard {
  position: relative;
  width: 330px;
  max-width: 90vw;
  background: linear-gradient(145deg, #1c1813 0%, #120e0a 100%);
  border: 2px solid var(--ui-gold, #d8b46a);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(216, 180, 106, 0.25);
  padding: 20px;
  color: #efe6d2;
  font-family: 'Outfit', sans-serif;
  pointer-events: auto !important;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tradeQuantityHeader h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ui-gold, #d8b46a);
  text-align: center;
}

.tradeQuantitySub {
  margin: 0 0 10px 0;
  font-size: 0.82rem;
  color: #a7977c;
  text-align: center;
}

.tradeQuantityInputRow {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.tradeQuantityInput {
  width: 90px;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(216, 180, 106, 0.4);
  border-radius: 6px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 6px;
  outline: none;
  font-family: 'Outfit', sans-serif;
}

.qtyBtn {
  background: rgba(216, 180, 106, 0.15) !important;
  border: 1px solid rgba(216, 180, 106, 0.3) !important;
  color: var(--ui-gold, #d8b46a) !important;
  padding: 6px 12px !important;
  border-radius: 6px !important;
  font-weight: bold !important;
  cursor: pointer;
}

.qtyBtn:hover {
  background: rgba(216, 180, 106, 0.3) !important;
  color: #fff !important;
}

.tradeQuantityActions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}

.tradeQuantityActions button {
  flex: 1;
}

.itemDetailCard {
  position: relative;
  width: 320px;
  max-width: 90vw;
  background: linear-gradient(145deg, #1c1813 0%, #120e0a 100%);
  border: 2px solid var(--ui-gold, #d8b46a);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(216, 180, 106, 0.25);
  padding: 16px;
  color: #efe6d2;
  font-family: 'Outfit', sans-serif;
}

.itemDetailHeader {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(216, 180, 106, 0.2);
}

.itemDetailIcon {
  width: 48px;
  height: 48px;
  background: rgba(216, 180, 106, 0.1);
  border: 1px solid rgba(216, 180, 106, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.itemDetailIcon svg, .itemDetailIcon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.itemDetailTitle h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--ui-gold, #d8b46a);
  font-weight: 700;
}

.itemDetailLevel {
  font-size: 0.8rem;
  color: #a7977c;
}

.itemDetailClassBadge {
  display: block;
  font-size: 0.72rem;
  color: var(--window-accent, #f59e0b);
  margin-top: 2px;
  font-weight: 600;
}

.itemPreviewCharacterStage {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(circle at 50% 60%, rgba(245, 158, 11, 0.22) 0%, rgba(15, 23, 42, 0.9) 70%);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
  flex-shrink: 0;
}

.itemPreviewCharacterStage .charSprite {
  transform: scale(2.0);
  transform-origin: center center;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -32px;
  margin-left: -32px;
}

.itemDetailDescription {
  font-size: 0.85rem;
  color: #ccc;
  font-style: italic;
  margin: 10px 0;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
}

.itemDetailStatsHeader {
  font-size: 0.82rem;
  font-weight: bold;
  color: #d8b46a;
  margin: 10px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.itemDetailStatsList {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(216, 180, 106, 0.1);
}

.itemDetailStatRow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: #fff;
}

.itemDetailStatRow .statIcon {
  display: inline-flex;
  align-items: center;
  width: 18px;
  height: 18px;
}

.itemDetailStatRow .statIcon svg {
  width: 16px;
  height: 16px;
}

.itemDetailNoStats {
  font-size: 0.82rem;
  color: #8a7a65;
  font-style: italic;
  padding: 6px;
}

.itemDetailFooter {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed rgba(216, 180, 106, 0.2);
  font-size: 0.85rem;
  color: #a7977c;
  text-align: right;
}
