/* Item Shop System Popup Modal */
#itemShopModal {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 90% !important;
  max-width: 900px !important;
  max-height: 85vh !important;
  background: linear-gradient(135deg, #3a2d1f 0%, #5a3d2f 100%);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: none;
  flex-direction: column;
  border: 3px solid #8b4513;
}

#itemShopModal.active {
  display: flex;
}

.itemShop-header {
  background: linear-gradient(180deg, #5a3d2f 0%, #3a2d1f 100%);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  border-bottom: 3px solid #8b4513;
  border-radius: 8px 8px 0 0;
}

.itemShop-header h3 {
  color: #ffd700;
  font-size: 1.5em;
  font-weight: 800;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.itemShop-header-actions {
  display: flex;
  gap: 8px;
}

.itemShop-btn-minimize,
.itemShop-btn-close {
  background: none;
  border: none;
  color: #ffd700;
  font-size: 1.5em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.itemShop-btn-minimize:hover,
.itemShop-btn-close:hover {
  background: rgba(255, 215, 0, 0.1);
}

.itemShop-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Item Shop specific styles */
.itemShop-header {
  background: linear-gradient(180deg, #5a3d2f 0%, #3a2d1f 100%);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  border-bottom: 3px solid #8b4513;
  border-radius: 8px 8px 0 0;
}

.itemShop-header h3 {
  color: #ffd700;
  font-size: 1.5em;
  font-weight: 800;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.itemShop-header-actions {
  display: flex;
  gap: 8px;
}

.itemShop-btn-minimize,
.itemShop-btn-close {
  background: none;
  border: none;
  color: #ffd700;
  font-size: 1.5em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.itemShop-btn-minimize:hover,
.itemShop-btn-close:hover {
  background: rgba(255, 215, 0, 0.1);
}

.itemShop-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.itemShop-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid #333;
}

.itemShop-tab {
  padding: 12px 20px;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.itemShop-tab.active {
  color: #ffd700;
  border-bottom-color: #ffd700;
}

.itemShop-tab:hover {
  color: #ffe066;
}

.itemShop-item-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* Keep old .market-* classes for compatibility but scope to itemShopModal */
#itemShopModal .market-tabs,
#itemShopModal .market-tab,
#itemShopModal .market-item-grid {
  /* Use itemShop styles above */
}

.itemShop-item-card {
  background: #1a1d21;
  border-radius: 8px;
  padding: 12px;
  border: 2px solid #333;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.itemShop-item-card:hover {
  border-color: #ffd700;
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.itemShop-item-icon {
  font-size: 2em;
  line-height: 1;
  user-select: none;
  text-align: center;
  color: #ffd700;
}

.itemShop-item-name {
  color: #ffd700;
  font-weight: 700;
  font-size: 0.95em;
}

.itemShop-item-description {
  color: #999;
  font-size: 0.75em;
  flex: 1;
  line-height: 1.3;
}

.itemShop-item-price {
  color: #4caf50;
  font-weight: 700;
  font-size: 1em;
  text-align: center;
}

.itemShop-btn-buy {
  width: 100%;
  padding: 8px;
  background: #ffd700;
  color: #1a1d21;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s;
}

.itemShop-btn-buy:hover {
  background: #ffe066;
  transform: scale(1.05);
}

.itemShop-btn-buy:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
  transform: none;
}

.market-balance {
  background: linear-gradient(135deg, #8b4513 0%, #654321 100%);
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffd700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.market-balance-amount {
  color: #ffd700;
  font-size: 1.2em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.market-balance-amount i {
  color: #ffd700;
  font-size: 1.3em;
}

.market-balance-amount span {
  color: #ffd700;
  font-size: 1.1em;
}

/* Minimized state */
#itemShopModal.minimized {
  height: auto;
  max-height: none;
}

#itemShopModal.minimized .itemShop-content,
#itemShopModal.minimized .market-content {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  #itemShopModal {
    width: 95%;
    max-width: 100%;
    max-height: 85vh;
  }
  
  .itemShop-item-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  
  .itemShop-header {
    padding: 12px 16px;
  }
  
  .itemShop-header h3 {
    font-size: 1.1em;
  }
}

@media (max-width: 576px) {
  #itemShopModal {
    width: 95%;
    max-width: 100%;
    max-height: 90vh;
  }
  
  .itemShop-item-card {
    padding: 12px;
  }
  
  .market-item-grid {
    grid-template-columns: 1fr;
  }
}

/* Tab System Styles */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.itemShop-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 0;
}

.itemShop-tab {
  flex: 1;
  padding: 14px 20px;
  background: linear-gradient(180deg, #5a3d2f 0%, #3a2d1f 100%);
  border: 2px solid #8b4513;
  color: #ffd700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 700;
  font-size: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.itemShop-tab:hover {
  background: linear-gradient(180deg, #6b4d3f 0%, #4a3d2f 100%);
  border-color: #a0522d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.itemShop-tab.active {
  background: linear-gradient(180deg, #ff6347 0%, #c0392b 100%);
  color: #fff;
  border-color: #8b0000;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 99, 71, 0.4);
  font-weight: 800;
}

/* Inventory Content Styles */
.inventory-items-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.inventory-slot {
  background: #1a1d21;
  border: 2px solid #333;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.inventory-slot:hover {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.05);
}

.inventory-slot-icon {
  font-size: 2.5em;
  margin-bottom: 8px;
}

.inventory-slot-name {
  font-size: 0.75em;
  color: #999;
  font-weight: 600;
}

.inventory-slot-quantity {
  font-size: 0.9em;
  color: #ffd700;
  font-weight: 700;
  margin-top: 4px;
}

.inventory-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.inventory-pagination button {
  padding: 6px 12px;
  background: #1a1d21;
  border: 1px solid #333;
  color: #ffd700;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.inventory-pagination button:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: #ffd700;
}

.inventory-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

